summaryrefslogtreecommitdiffstats
path: root/lib/private
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2015-12-09 10:04:56 +0100
committerThomas Müller <thomas.mueller@tmit.eu>2015-12-09 10:04:56 +0100
commitbc744ff6debe5f812b3c4a32f56b133b3cb3c145 (patch)
treebfd74101cc806c56bfe2f0c1d5c2ced5b6849328 /lib/private
parent6ba22f0243b8d0f33a4c2b7e56bae5b971614d02 (diff)
parentd0cca6c3aded2aaa35e5b2caab46ff49676eecbd (diff)
downloadnextcloud-server-bc744ff6debe5f812b3c4a32f56b133b3cb3c145.tar.gz
nextcloud-server-bc744ff6debe5f812b3c4a32f56b133b3cb3c145.zip
Merge pull request #21038 from owncloud/share-computesharepermissions-notstore
Fix (re)share permission checks in a few code paths
Diffstat (limited to 'lib/private')
-rw-r--r--lib/private/files/fileinfo.php8
-rw-r--r--lib/private/files/storage/common.php4
-rw-r--r--lib/private/share/share.php2
3 files changed, 8 insertions, 6 deletions
diff --git a/lib/private/files/fileinfo.php b/lib/private/files/fileinfo.php
index 5b5e8697004..5ed65cd3795 100644
--- a/lib/private/files/fileinfo.php
+++ b/lib/private/files/fileinfo.php
@@ -100,6 +100,8 @@ class FileInfo implements \OCP\Files\FileInfo, \ArrayAccess {
return $this->getType();
} else if ($offset === 'etag') {
return $this->getEtag();
+ } elseif ($offset === 'permissions') {
+ return $this->getPermissions();
} elseif (isset($this->data[$offset])) {
return $this->data[$offset];
} else {
@@ -193,7 +195,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 0cd67e343ff..b06543d0a6a 100644
--- a/lib/private/files/storage/common.php
+++ b/lib/private/files/storage/common.php
@@ -141,10 +141,6 @@ abstract class Common implements Storage {
}
public function isSharable($path) {
- if (\OCP\Util::isSharingDisabledForUser()) {
- return false;
- }
-
return $this->isReadable($path);
}
diff --git a/lib/private/share/share.php b/lib/private/share/share.php
index 8899df25636..e62bdebc08e 100644
--- a/lib/private/share/share.php
+++ b/lib/private/share/share.php
@@ -635,7 +635,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]);
\OCP\Util::writeLog('OCP\Share', sprintf($message, $path), \OCP\Util::DEBUG);