diff --git a/lib/Service/ShareService.php b/lib/Service/ShareService.php index ae4e7f69..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,9 +129,9 @@ 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"); - $return = $acl->jsonSerialize(); + $tmp = $acl->jsonSerialize(); $tmp['credential_data'] = $this->credential->getCredentialById($acl->getItemId())->jsonSerialize(); if (!$acl->hasPermission(SharingACL::FILES)) unset($tmp['credential_data']['files']);