@@ -61,8 +61,7 @@ |
||
| 61 | 61 | $filter = [$item_guid]; |
| 62 | 62 | if ($user_id === null){ |
| 63 | 63 | $q .= 'user_id is null'; |
| 64 | - } |
|
| 65 | - else { |
|
| 64 | + } else { |
|
| 66 | 65 | $q .= 'user_id = ? '; |
| 67 | 66 | $filter[] = $user_id; |
| 68 | 67 | } |
@@ -81,17 +81,17 @@ discard block |
||
| 81 | 81 | } |
| 82 | 82 | |
| 83 | 83 | public function getCredentialById($credential_id, $user_id) { |
| 84 | - $credential = $this->credentialMapper->getCredentialById($credential_id); |
|
| 85 | - if ($credential->getUserId() === $user_id) { |
|
| 86 | - return $credential; |
|
| 87 | - } |
|
| 88 | - else { |
|
| 89 | - $acl = $this->sharingACL->getItemACL($user_id, $credential->getGuid()); |
|
| 90 | - if ($acl->hasPermission(SharingACL::READ)); |
|
| 91 | - return $credential; |
|
| 92 | - } |
|
| 93 | - |
|
| 94 | - throw new DoesNotExistException("Did expect one result but found none when executing"); |
|
| 84 | + $credential = $this->credentialMapper->getCredentialById($credential_id); |
|
| 85 | + if ($credential->getUserId() === $user_id) { |
|
| 86 | + return $credential; |
|
| 87 | + } |
|
| 88 | + else { |
|
| 89 | + $acl = $this->sharingACL->getItemACL($user_id, $credential->getGuid()); |
|
| 90 | + if ($acl->hasPermission(SharingACL::READ)); |
|
| 91 | + return $credential; |
|
| 92 | + } |
|
| 93 | + |
|
| 94 | + throw new DoesNotExistException("Did expect one result but found none when executing"); |
|
| 95 | 95 | } |
| 96 | 96 | |
| 97 | 97 | /** |
@@ -102,6 +102,6 @@ discard block |
||
| 102 | 102 | } |
| 103 | 103 | |
| 104 | 104 | public function getCredentialByGUID($credential_guid, $user_id = null){ |
| 105 | - return $this->credentialMapper->getCredentialByGUID($credential_guid, $user_id); |
|
| 106 | - } |
|
| 105 | + return $this->credentialMapper->getCredentialByGUID($credential_guid, $user_id); |
|
| 106 | + } |
|
| 107 | 107 | } |
| 108 | 108 | \ No newline at end of file |