diff options
author | Vincent Petry <vincent@nextcloud.com> | 2022-05-25 09:55:22 +0200 |
---|---|---|
committer | Carl Schwan <carl@carlschwan.eu> | 2022-07-28 16:53:22 +0200 |
commit | 03b1791cca3e0334637aa232d1f7c11850793646 (patch) | |
tree | 33db9b8db60a592089aaa7a4d6c04f4db4c1860f /lib | |
parent | 9493f86de34e76e37c13f87aab3123a3efbfdd84 (diff) | |
download | nextcloud-server-03b1791cca3e0334637aa232d1f7c11850793646.tar.gz nextcloud-server-03b1791cca3e0334637aa232d1f7c11850793646.zip |
Fix share attribute related tests + code style
Signed-off-by: Vincent Petry <vincent@nextcloud.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/Share20/Manager.php | 15 | ||||
-rw-r--r-- | lib/private/Share20/Share.php | 4 | ||||
-rw-r--r-- | lib/public/Share/IAttributes.php | 8 | ||||
-rw-r--r-- | lib/public/Share/IShare.php | 8 |
4 files changed, 11 insertions, 24 deletions
diff --git a/lib/private/Share20/Manager.php b/lib/private/Share20/Manager.php index d0120a299be..a46126b7ac4 100644 --- a/lib/private/Share20/Manager.php +++ b/lib/private/Share20/Manager.php @@ -70,7 +70,6 @@ use OCP\Share; use OCP\Share\Exceptions\AlreadySharedException; use OCP\Share\Exceptions\GenericShareException; use OCP\Share\Exceptions\ShareNotFound; -use OCP\Share\IAttributes; use OCP\Share\IManager; use OCP\Share\IProviderFactory; use OCP\Share\IShare; @@ -1094,7 +1093,7 @@ class Manager implements IManager { 'shareWith' => $share->getSharedWith(), 'uidOwner' => $share->getSharedBy(), 'permissions' => $share->getPermissions(), - 'attributes' => $share->getAttributes(), + 'attributes' => $share->getAttributes() !== null ? $share->getAttributes()->toArray() : null, 'path' => $userFolder->getRelativePath($share->getNode()->getPath()), ]); } @@ -2089,16 +2088,4 @@ class Manager implements IManager { yield from $provider->getAllShares(); } } - - /** - * @param IAttributes|null $perms - * @return string - */ - private function hashAttributes($perms) { - if ($perms === null || empty($perms->toArray())) { - return ""; - } - - return \md5(\json_encode($perms->toArray())); - } } diff --git a/lib/private/Share20/Share.php b/lib/private/Share20/Share.php index 1aeb79d4d31..9ba5db5252e 100644 --- a/lib/private/Share20/Share.php +++ b/lib/private/Share20/Share.php @@ -345,7 +345,7 @@ class Share implements IShare { /** * @inheritdoc */ - public function setAttributes(IAttributes $attributes) { + public function setAttributes(?IAttributes $attributes) { $this->attributes = $attributes; return $this; } @@ -353,7 +353,7 @@ class Share implements IShare { /** * @inheritdoc */ - public function getAttributes() { + public function getAttributes(): ?IAttributes { return $this->attributes; } diff --git a/lib/public/Share/IAttributes.php b/lib/public/Share/IAttributes.php index 9f2556e4005..6e4cee08b12 100644 --- a/lib/public/Share/IAttributes.php +++ b/lib/public/Share/IAttributes.php @@ -24,7 +24,7 @@ namespace OCP\Share; * Interface IAttributes * * @package OCP\Share - * @since 10.2.0 + * @since 25.0.0 */ interface IAttributes { @@ -35,7 +35,7 @@ interface IAttributes { * @param string $key key * @param bool $enabled enabled * @return IAttributes The modified object - * @since 10.2.0 + * @since 25.0.0 */ public function setAttribute($scope, $key, $enabled); @@ -46,7 +46,7 @@ interface IAttributes { * @param string $scope scope * @param string $key key * @return bool|null - * @since 10.2.0 + * @since 25.0.0 */ public function getAttribute($scope, $key); @@ -62,7 +62,7 @@ interface IAttributes { * ] * * @return array formatted IAttributes - * @since 10.2.0 + * @since 25.0.0 */ public function toArray(); } diff --git a/lib/public/Share/IShare.php b/lib/public/Share/IShare.php index d81f263b464..f86e1ec542d 100644 --- a/lib/public/Share/IShare.php +++ b/lib/public/Share/IShare.php @@ -325,19 +325,19 @@ interface IShare { /** * Set share attributes * - * @param IAttributes $attributes + * @param ?IAttributes $attributes * @since 25.0.0 * @return IShare The modified object */ - public function setAttributes(IAttributes $attributes); + public function setAttributes(?IAttributes $attributes); /** * Get share attributes * * @since 25.0.0 - * @return IAttributes + * @return ?IAttributes */ - public function getAttributes(); + public function getAttributes(): ?IAttributes; /** * Set the accepted status |