diff --git a/apps/files_sharing/appinfo/routes.php b/apps/files_sharing/appinfo/routes.php index 15af5226e1..2e26033cad 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 0000000000..cfe1fc2da4 --- /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