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:
parent
e241d26316
commit
6e4006d139
3 changed files with 10 additions and 2 deletions
8
apps/files_sharing/lib/external/storage.php
vendored
8
apps/files_sharing/lib/external/storage.php
vendored
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue