From 62b54aee8e3033a84a5a3800ac6b2647660ce50d Mon Sep 17 00:00:00 2001 From: Marcos Zuriaga Date: Tue, 4 Oct 2016 00:21:27 +0200 Subject: [PATCH] Behave as if no item was found if public user has no read permission --- lib/Service/ShareService.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/Service/ShareService.php b/lib/Service/ShareService.php index e72b378b..7517ce76 100644 --- a/lib/Service/ShareService.php +++ b/lib/Service/ShareService.php @@ -16,6 +16,7 @@ use OCA\Passman\Db\ShareRequest; use OCA\Passman\Db\ShareRequestMapper; use OCA\Passman\Db\SharingACL; use OCA\Passman\Db\SharingACLMapper; +use OCP\AppFramework\Db\DoesNotExistException; class ShareService { private $sharingACL; @@ -128,7 +129,7 @@ class ShareService { $acl = $this->sharingACL->getItemACL($user_id, $item_guid); // Check if the user can read the credential, probably unnecesary, but just to be sure - if (!$acl->hasPermission(SharingACL::READ)) return null; + if (!$acl->hasPermission(SharingACL::READ)) throw new DoesNotExistException("Item not found or wrong access level"); $tmp = $acl->jsonSerialize(); $tmp['credential_data'] = $this->credential->getCredentialById($acl->getItemId())->jsonSerialize();