diff options
author | Morris Jobke <hey@morrisjobke.de> | 2015-12-10 09:35:56 +0100 |
---|---|---|
committer | Morris Jobke <hey@morrisjobke.de> | 2015-12-10 09:35:56 +0100 |
commit | fccfa3cf0b5559de77b9218f978a5fb29d773b5e (patch) | |
tree | dd9a5a6fcea2272c026cb3714f7e89064e185f2e /lib | |
parent | c132f91f9dd0881f3cc44f8d50dbf6a883d1b576 (diff) | |
parent | 2f2e932e0284b748479d2d27770fe603b6493411 (diff) | |
download | nextcloud-server-fccfa3cf0b5559de77b9218f978a5fb29d773b5e.tar.gz nextcloud-server-fccfa3cf0b5559de77b9218f978a5fb29d773b5e.zip |
Merge pull request #21081 from owncloud/stable8.1-share-computesharepermissions-notstore
[stable8.1] Fix (re)share permission checks in a few code paths
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/files/fileinfo.php | 8 | ||||
-rw-r--r-- | lib/private/files/storage/common.php | 4 | ||||
-rw-r--r-- | lib/private/share/share.php | 2 |
3 files changed, 8 insertions, 6 deletions
diff --git a/lib/private/files/fileinfo.php b/lib/private/files/fileinfo.php index 82c8f3de690..a4a424c88ba 100644 --- a/lib/private/files/fileinfo.php +++ b/lib/private/files/fileinfo.php @@ -83,6 +83,8 @@ class FileInfo implements \OCP\Files\FileInfo, \ArrayAccess { public function offsetGet($offset) { if ($offset === 'type') { return $this->getType(); + } elseif ($offset === 'permissions') { + return $this->getPermissions(); } elseif (isset($this->data[$offset])) { return $this->data[$offset]; } else { @@ -171,7 +173,11 @@ class FileInfo implements \OCP\Files\FileInfo, \ArrayAccess { * @return int */ public function getPermissions() { - return $this->data['permissions']; + $perms = $this->data['permissions']; + if (\OCP\Util::isSharingDisabledForUser() || ($this->isShared() && !\OC\Share\Share::isResharingAllowed())) { + $perms = $perms & ~\OCP\Constants::PERMISSION_SHARE; + } + return $perms; } /** diff --git a/lib/private/files/storage/common.php b/lib/private/files/storage/common.php index 847cb8492fe..43a1102626a 100644 --- a/lib/private/files/storage/common.php +++ b/lib/private/files/storage/common.php @@ -136,10 +136,6 @@ abstract class Common implements Storage { } public function isSharable($path) { - if (\OC_Util::isSharingDisabledForUser()) { - return false; - } - return $this->isReadable($path); } diff --git a/lib/private/share/share.php b/lib/private/share/share.php index c569a957df7..b1640910b1e 100644 --- a/lib/private/share/share.php +++ b/lib/private/share/share.php @@ -623,7 +623,7 @@ class Share extends Constants { throw new \Exception($message_t); } // verify that the user has share permission - if (!\OC\Files\Filesystem::isSharable($path)) { + if (!\OC\Files\Filesystem::isSharable($path) || \OCP\Util::isSharingDisabledForUser()) { $message = 'You are not allowed to share %s'; $message_t = $l->t('You are not allowed to share %s', [$path]); \OC_Log::write('OCP\Share', sprintf($message, $path), \OC_Log::ERROR); |