only get the permissions from the share source if it's not already cached

this prevents having to setup the share source when doing metadata stuff on the share root

Signed-off-by: Robin Appelman <robin@icewind.nl>
This commit is contained in:
Robin Appelman 2020-09-09 13:48:48 +02:00 committed by backportbot[bot]
parent c1a7a026f6
commit f140e3a03a
1 changed files with 5 additions and 6 deletions

View File

@ -146,17 +146,16 @@ class Cache extends CacheJail {
} }
try { try {
$sharePermissions = $this->storage->getPermissions($entry['path']); if (isset($entry['permissions'])) {
$entry['permissions'] &= $this->storage->getShare()->getPermissions();
} else {
$entry['permissions'] = $this->storage->getPermissions($entry['path']);
}
} catch (StorageNotAvailableException $e) { } catch (StorageNotAvailableException $e) {
// thrown by FailedStorage e.g. when the sharer does not exist anymore // thrown by FailedStorage e.g. when the sharer does not exist anymore
// (IDE may say the exception is never thrown false negative) // (IDE may say the exception is never thrown false negative)
$sharePermissions = 0; $sharePermissions = 0;
} }
if (isset($entry['permissions'])) {
$entry['permissions'] &= $sharePermissions;
} else {
$entry['permissions'] = $sharePermissions;
}
$entry['uid_owner'] = $this->storage->getOwner(''); $entry['uid_owner'] = $this->storage->getOwner('');
$entry['displayname_owner'] = $this->getOwnerDisplayName(); $entry['displayname_owner'] = $this->getOwnerDisplayName();
if ($path === '') { if ($path === '') {