diff options
author | Bjoern Schiessle <schiessle@owncloud.com> | 2014-05-07 16:49:07 +0200 |
---|---|---|
committer | Bjoern Schiessle <schiessle@owncloud.com> | 2014-05-07 16:49:07 +0200 |
commit | 31bf2d4b33ea28cb8db28201312ad48108136926 (patch) | |
tree | c299e02278af2706983612069cdd3d252ce887fb /apps | |
parent | 254fa5eb22efa5ba572702064377a6ad9eec9a53 (diff) | |
download | nextcloud-server-31bf2d4b33ea28cb8db28201312ad48108136926.tar.gz nextcloud-server-31bf2d4b33ea28cb8db28201312ad48108136926.zip |
we can take the permission directly from the share, no need to call the share api first
Diffstat (limited to 'apps')
-rw-r--r-- | apps/files_sharing/lib/sharedstorage.php | 26 |
1 files changed, 6 insertions, 20 deletions
diff --git a/apps/files_sharing/lib/sharedstorage.php b/apps/files_sharing/lib/sharedstorage.php index 4733dff3d14..d4a817fca34 100644 --- a/apps/files_sharing/lib/sharedstorage.php +++ b/apps/files_sharing/lib/sharedstorage.php @@ -102,14 +102,15 @@ class Shared extends \OC\Files\Storage\Common { /** * @brief Get the permissions granted for a shared file * @param string Shared target file path - * @return int CRUDS permissions granted or false if not found + * @return int CRUDS permissions granted */ public function getPermissions($target) { - $source = $this->getFile($target); - if ($source) { - return $source['permissions']; + $permissions = $this->share['permissions']; + // part file are always have delete permissions + if (pathinfo($target, PATHINFO_EXTENSION) === 'part') { + $permissions |= \OCP\PERMISSION_DELETE; } - return false; + return $permissions; } public function mkdir($path) { @@ -183,9 +184,6 @@ class Shared extends \OC\Files\Storage\Common { } public function isCreatable($path) { - if ($path == '') { - $path = $this->getMountPoint(); - } return ($this->getPermissions($path) & \OCP\PERMISSION_CREATE); } @@ -194,23 +192,14 @@ class Shared extends \OC\Files\Storage\Common { } public function isUpdatable($path) { - if ($path == '') { - $path = $this->getMountPoint(); - } return ($this->getPermissions($path) & \OCP\PERMISSION_UPDATE); } public function isDeletable($path) { - if ($path == '') { - $path = $this->getMountPoint(); - } return ($this->getPermissions($path) & \OCP\PERMISSION_DELETE); } public function isSharable($path) { - if ($path == '') { - $path = $this->getMountPoint(); - } return ($this->getPermissions($path) & \OCP\PERMISSION_SHARE); } @@ -454,9 +443,6 @@ class Shared extends \OC\Files\Storage\Common { } public function free_space($path) { - if ($path == '') { - $path = $this->getMountPoint(); - } $source = $this->getSourcePath($path); if ($source) { list($storage, $internalPath) = \OC\Files\Filesystem::resolvePath($source); |