Add reshare permission checks

Added in isSharable() in incoming remote share.
Added in isSharable() in regular incoming share.
Added in FileInfo to make sure the proper attributes are returned to the
clients.
This commit is contained in:
Vincent Petry 2015-12-08 13:02:57 +01:00
parent e241d26316
commit 6e4006d139
3 changed files with 10 additions and 2 deletions

View File

@ -265,4 +265,12 @@ class Storage extends DAV implements ISharedStorage {
list(, $remote) = explode('://', $this->remote, 2);
return $this->remoteUser . '@' . $remote;
}
public function isSharable($path) {
if (\OCP\Util::isSharingDisabledForUser() || !\OC\Share\Share::isResharingAllowed()) {
return false;
}
return ($this->getPermissions($path) & \OCP\Constants::PERMISSION_SHARE);
}
}

View File

@ -257,7 +257,7 @@ class Shared extends \OC\Files\Storage\Common implements ISharedStorage {
}
public function isSharable($path) {
if (\OCP\Util::isSharingDisabledForUser()) {
if (\OCP\Util::isSharingDisabledForUser() || !\OC\Share\Share::isResharingAllowed()) {
return false;
}
return ($this->getPermissions($path) & \OCP\Constants::PERMISSION_SHARE);

View File

@ -196,7 +196,7 @@ class FileInfo implements \OCP\Files\FileInfo, \ArrayAccess {
*/
public function getPermissions() {
$perms = $this->data['permissions'];
if (\OCP\Util::isSharingDisabledForUser()) {
if (\OCP\Util::isSharingDisabledForUser() || ($this->isShared() && !\OC\Share\Share::isResharingAllowed())) {
$perms = $perms & ~\OCP\Constants::PERMISSION_SHARE;
}
return $perms;