Fix permission not being int

Signed-off-by: Carl Schwan <carl@carlschwan.eu>
This commit is contained in:
Carl Schwan 2022-10-17 12:37:46 +02:00
parent 53e408f76a
commit c6b8a3bec3
2 changed files with 5 additions and 5 deletions

View file

@ -581,7 +581,7 @@ class ShareAPIController extends OCSController {
}
// TODO: It might make sense to have a dedicated setting to allow/deny converting link shares into federated ones
if (($permissions & Constants::PERMISSION_READ) && $this->shareManager->outgoingServer2ServerSharesAllowed()) {
if ($this->shareManager->outgoingServer2ServerSharesAllowed()) {
$permissions |= Constants::PERMISSION_SHARE;
}

View file

@ -355,18 +355,18 @@ class Storage extends DAV implements ISharedStorage, IDisableEncryptionStorage,
return $this->cloudId->getDisplayId();
}
public function isSharable($path) {
public function isSharable($path): bool {
if (\OCP\Util::isSharingDisabledForUser() || !\OC\Share\Share::isResharingAllowed()) {
return false;
}
return ($this->getPermissions($path) & Constants::PERMISSION_SHARE);
return (bool)($this->getPermissions($path) & Constants::PERMISSION_SHARE);
}
public function getPermissions($path) {
public function getPermissions($path): int {
$response = $this->propfind($path);
// old federated sharing permissions
if (isset($response['{http://open-collaboration-services.org/ns}share-permissions'])) {
$permissions = $response['{http://open-collaboration-services.org/ns}share-permissions'];
$permissions = (int)$response['{http://open-collaboration-services.org/ns}share-permissions'];
} elseif (isset($response['{http://open-cloud-mesh.org/ns}share-permissions'])) {
// permissions provided by the OCM API
$permissions = $this->ocmPermissions2ncPermissions($response['{http://open-collaboration-services.org/ns}share-permissions'], $path);