diff options
author | Robin Appelman <robin@icewind.nl> | 2022-03-08 16:18:43 +0100 |
---|---|---|
committer | Robin Appelman <robin@icewind.nl> | 2022-03-24 17:01:01 +0100 |
commit | 46d0eef8da5bf0f9fc9719e9727e6c36553d24a1 (patch) | |
tree | 9501ceaa8a9789b6b07602a358391c4dc4de5385 /lib/private/Files/Node/LazyFolder.php | |
parent | c80ba69b7a2470d429f027584f2c049770508cb0 (diff) | |
download | nextcloud-server-46d0eef8da5bf0f9fc9719e9727e6c36553d24a1.tar.gz nextcloud-server-46d0eef8da5bf0f9fc9719e9727e6c36553d24a1.zip |
allow setting some metadata in the lazyfolder without having to get the real folder
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'lib/private/Files/Node/LazyFolder.php')
-rw-r--r-- | lib/private/Files/Node/LazyFolder.php | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/lib/private/Files/Node/LazyFolder.php b/lib/private/Files/Node/LazyFolder.php index bfdaeeccff7..45451e5c53c 100644 --- a/lib/private/Files/Node/LazyFolder.php +++ b/lib/private/Files/Node/LazyFolder.php @@ -25,6 +25,8 @@ declare(strict_types=1); */ namespace OC\Files\Node; +use OCP\Constants; + /** * Class LazyFolder * @@ -40,13 +42,16 @@ class LazyFolder implements \OCP\Files\Folder { /** @var LazyFolder | null */ protected $folder = null; + protected array $data; + /** * LazyFolder constructor. * * @param \Closure $folderClosure */ - public function __construct(\Closure $folderClosure) { + public function __construct(\Closure $folderClosure, array $data = []) { $this->folderClosure = $folderClosure; + $this->data = $data; } /** @@ -181,6 +186,9 @@ class LazyFolder implements \OCP\Files\Folder { * @inheritDoc */ public function getPath() { + if (isset($this->data['path'])) { + return $this->data['path']; + } return $this->__call(__FUNCTION__, func_get_args()); } @@ -230,6 +238,9 @@ class LazyFolder implements \OCP\Files\Folder { * @inheritDoc */ public function getPermissions() { + if (isset($this->data['permissions'])) { + return $this->data['permissions']; + } return $this->__call(__FUNCTION__, func_get_args()); } @@ -237,6 +248,9 @@ class LazyFolder implements \OCP\Files\Folder { * @inheritDoc */ public function isReadable() { + if (isset($this->data['permissions'])) { + return ($this->data['permissions'] & Constants::PERMISSION_READ) == Constants::PERMISSION_READ; + } return $this->__call(__FUNCTION__, func_get_args()); } @@ -244,6 +258,9 @@ class LazyFolder implements \OCP\Files\Folder { * @inheritDoc */ public function isUpdateable() { + if (isset($this->data['permissions'])) { + return ($this->data['permissions'] & Constants::PERMISSION_UPDATE) == Constants::PERMISSION_UPDATE; + } return $this->__call(__FUNCTION__, func_get_args()); } @@ -251,6 +268,9 @@ class LazyFolder implements \OCP\Files\Folder { * @inheritDoc */ public function isDeletable() { + if (isset($this->data['permissions'])) { + return ($this->data['permissions'] & Constants::PERMISSION_DELETE) == Constants::PERMISSION_DELETE; + } return $this->__call(__FUNCTION__, func_get_args()); } @@ -258,6 +278,9 @@ class LazyFolder implements \OCP\Files\Folder { * @inheritDoc */ public function isShareable() { + if (isset($this->data['permissions'])) { + return ($this->data['permissions'] & Constants::PERMISSION_SHARE) == Constants::PERMISSION_SHARE; + } return $this->__call(__FUNCTION__, func_get_args()); } |