diff options
author | Julius Härtl <jus@bitgrid.net> | 2019-01-24 11:50:01 +0100 |
---|---|---|
committer | Julius Härtl <jus@bitgrid.net> | 2019-03-01 20:56:17 +0100 |
commit | 506eb885bcaf7d745b417a155defc7c1e0f344c1 (patch) | |
tree | befcc41987dc41476f71859026cd7b6685e14e54 /apps/files | |
parent | d85e3e3a6d775261cd4a504e07b111224cda8fc8 (diff) | |
download | nextcloud-server-506eb885bcaf7d745b417a155defc7c1e0f344c1.tar.gz nextcloud-server-506eb885bcaf7d745b417a155defc7c1e0f344c1.zip |
Only call resource provider if type matches
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'apps/files')
-rw-r--r-- | apps/files/lib/Collaboration/Resources/ResourceProvider.php | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/apps/files/lib/Collaboration/Resources/ResourceProvider.php b/apps/files/lib/Collaboration/Resources/ResourceProvider.php index 62dcbe19c1d..4beb882ae3f 100644 --- a/apps/files/lib/Collaboration/Resources/ResourceProvider.php +++ b/apps/files/lib/Collaboration/Resources/ResourceProvider.php @@ -24,12 +24,15 @@ namespace OCA\Files\Collaboration\Resources; use OCP\Collaboration\Resources\IProvider; use OCP\Collaboration\Resources\IResource; +use OCP\Collaboration\Resources\ResourceException; use OCP\Files\IRootFolder; use OCP\Files\Node; use OCP\IUser; class ResourceProvider implements IProvider { + const RESOURCE_TYPE = 'files'; + /** @var IRootFolder */ protected $rootFolder; @@ -63,10 +66,6 @@ class ResourceProvider implements IProvider { * @since 15.0.0 */ public function canAccess(IResource $resource, IUser $user = null): bool { - if ($resource->getType() !== 'files') { - return false; - } - if (!$user instanceof IUser) { return false; } @@ -92,4 +91,15 @@ class ResourceProvider implements IProvider { public function getIconClass(IResource $resource): string { return 'icon-folder'; } + + /** + * Get the type of a resource + * + * @param IResource $resource + * @return string + * @since 15.0.0 + */ + public function getType(): string { + return self::RESOURCE_TYPE; + } } |