Merge branch 'sharing_no_groups' of github.com:nextcloud/passman into sharing_no_groups

This commit is contained in:
brantje 2016-10-04 00:21:59 +02:00
commit 8b1b90ac5d
No known key found for this signature in database
GPG key ID: 5FF1D117F918687F

View file

@ -16,6 +16,7 @@ use OCA\Passman\Db\ShareRequest;
use OCA\Passman\Db\ShareRequestMapper; use OCA\Passman\Db\ShareRequestMapper;
use OCA\Passman\Db\SharingACL; use OCA\Passman\Db\SharingACL;
use OCA\Passman\Db\SharingACLMapper; use OCA\Passman\Db\SharingACLMapper;
use OCP\AppFramework\Db\DoesNotExistException;
class ShareService { class ShareService {
private $sharingACL; private $sharingACL;
@ -128,9 +129,9 @@ class ShareService {
$acl = $this->sharingACL->getItemACL($user_id, $item_guid); $acl = $this->sharingACL->getItemACL($user_id, $item_guid);
// Check if the user can read the credential, probably unnecesary, but just to be sure // 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(); $tmp['credential_data'] = $this->credential->getCredentialById($acl->getItemId())->jsonSerialize();
if (!$acl->hasPermission(SharingACL::FILES)) unset($tmp['credential_data']['files']); if (!$acl->hasPermission(SharingACL::FILES)) unset($tmp['credential_data']['files']);