Fix permission not being int

Signed-off-by: Carl Schwan <carl@carlschwan.eu>
pull/34628/head
Carl Schwan 4 years ago
parent 53e408f76a
commit c6b8a3bec3
  1. 2
      apps/files_sharing/lib/Controller/ShareAPIController.php
  2. 8
      apps/files_sharing/lib/External/Storage.php

@ -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 // 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; $permissions |= Constants::PERMISSION_SHARE;
} }

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

Loading…
Cancel
Save