diff options
author | Ferdinand Thiessen <opensource@fthiessen.de> | 2023-11-22 13:54:01 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-22 13:54:01 +0100 |
commit | 9c3321c524be0da20f614ee19c664c98e048955a (patch) | |
tree | ed0348bea3a0f84e1f0e30fc6dbceb42103344a0 /lib | |
parent | 8877f9bec9f886ad5c62127485e19b7006d86e9b (diff) | |
parent | 5172baaf8b0b028328a59e7692bd395b5da2883b (diff) | |
download | nextcloud-server-9c3321c524be0da20f614ee19c664c98e048955a.tar.gz nextcloud-server-9c3321c524be0da20f614ee19c664c98e048955a.zip |
Merge pull request #41565 from nextcloud/fix/object-storage-inconsitent-behavior
fix(ObjectStore): Make copying behavior consistent with local storage
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/Files/ObjectStore/ObjectStoreStorage.php | 7 | ||||
-rw-r--r-- | lib/public/Files/Cache/ICacheEntry.php | 4 |
2 files changed, 9 insertions, 2 deletions
diff --git a/lib/private/Files/ObjectStore/ObjectStoreStorage.php b/lib/private/Files/ObjectStore/ObjectStoreStorage.php index 4dceee9a58b..eb8aaffe1e0 100644 --- a/lib/private/Files/ObjectStore/ObjectStoreStorage.php +++ b/lib/private/Files/ObjectStore/ObjectStoreStorage.php @@ -68,6 +68,8 @@ class ObjectStoreStorage extends \OC\Files\Storage\Common implements IChunkedFil private $logger; + private bool $handleCopiesAsOwned; + /** @var bool */ protected $validateWrites = true; @@ -88,6 +90,7 @@ class ObjectStoreStorage extends \OC\Files\Storage\Common implements IChunkedFil if (isset($params['validateWrites'])) { $this->validateWrites = (bool)$params['validateWrites']; } + $this->handleCopiesAsOwned = (bool)($params['handleCopiesAsOwned'] ?? false); $this->logger = \OC::$server->getLogger(); } @@ -651,6 +654,10 @@ class ObjectStoreStorage extends \OC\Files\Storage\Common implements IChunkedFil try { $this->objectStore->copyObject($sourceUrn, $targetUrn); + if ($this->handleCopiesAsOwned) { + // Copied the file thus we gain all permissions as we are the owner now ! warning while this aligns with local storage it should not be used and instead fix local storage ! + $cache->update($targetId, ['permissions' => \OCP\Constants::PERMISSION_ALL]); + } } catch (\Exception $e) { $cache->remove($to); diff --git a/lib/public/Files/Cache/ICacheEntry.php b/lib/public/Files/Cache/ICacheEntry.php index e1e8129394c..3a069ca69e0 100644 --- a/lib/public/Files/Cache/ICacheEntry.php +++ b/lib/public/Files/Cache/ICacheEntry.php @@ -123,8 +123,8 @@ interface ICacheEntry extends ArrayAccess { public function getEtag(); /** - * Get the permissions for the file stored as bitwise combination of \OCP\PERMISSION_READ, \OCP\PERMISSION_CREATE - * \OCP\PERMISSION_UPDATE, \OCP\PERMISSION_DELETE and \OCP\PERMISSION_SHARE + * Get the permissions for the file stored as bitwise combination of \OCP\Constants::PERMISSION_READ, \OCP\Constants::PERMISSION_CREATE + * \OCP\Constants::PERMISSION_UPDATE, \OCP\Constants::PERMISSION_DELETE and \OCP\Constants::PERMISSION_SHARE * * @return int * @since 9.0.0 |