From: Bjoern Schiessle Date: Wed, 4 Sep 2013 15:25:15 +0000 (+0200) Subject: intermediate results, share api X-Git-Tag: v6.0.0alpha2~95^2~33 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=21a0a96e4395fedb7fae8fe5f731ca283ce937b1;p=nextcloud-server.git intermediate results, share api --- diff --git a/apps/files_sharing/appinfo/routes.php b/apps/files_sharing/appinfo/routes.php index 15af5226e18..2e26033cad0 100644 --- a/apps/files_sharing/appinfo/routes.php +++ b/apps/files_sharing/appinfo/routes.php @@ -19,20 +19,6 @@ OC_API::register('get', array('path' => ''), array('path' => '.+')); //allow slashes in parameter path /* -OC_API::register('get', - '/apps/files_sharing/api/share/group/{path}', - array('\OCA\Files\Share\Api', 'getShare'), - 'files_sharing', - OC_API::USER_AUTH, - array('path' => '')); - -OC_API::register('get', - '/apps/files_sharing/api/share/user/{path}', - array('\OCA\Files\Share\Api', 'getShare'), - 'files_sharing', - OC_API::USER_AUTH, - array('path' => '')); - OC_API::register('get', '/apps/files_sharing/api/permission/{path}', array('\OCA\Files\Share\Api', 'getShare'), diff --git a/apps/files_sharing/lib/api.php b/apps/files_sharing/lib/api.php new file mode 100644 index 00000000000..cfe1fc2da46 --- /dev/null +++ b/apps/files_sharing/lib/api.php @@ -0,0 +1,48 @@ +. + * + */ + +namespace OCA\Files\Share; + +class Api { + + /** + * @brief get share information for a given file/folder + * + * @param array $params which contains a 'path' to a file/folder + * @return \OC_OCS_Result share information + */ + public static function getShare($params) { + $path = $params['path']; + + $view = new \OC\Files\View('/'.\OCP\User::getUser().'/files'); + $fileInfo = $view->getFileInfo($path); + if ($fileInfo) { + $share = \OCP\Share::getItemShared('file', $fileInfo['fileid']); + } else { + \OCP\Util::writeLog('files_sharing', 'OCS API getShare, file ' . $path . ' does not exists', \OCP\Util::WARN); + $share = array(); + } + + return new \OC_OCS_Result($share); + } + +} \ No newline at end of file