@@ -36,11 +36,11 @@ discard block |
||
| 36 | 36 | class CredentialService { |
| 37 | 37 | |
| 38 | 38 | private $credentialMapper; |
| 39 | - private $sharingACL; |
|
| 39 | + private $sharingACL; |
|
| 40 | 40 | |
| 41 | 41 | public function __construct(CredentialMapper $credentialMapper, SharingACLMapper $sharingACL) { |
| 42 | 42 | $this->credentialMapper = $credentialMapper; |
| 43 | - $this->sharingACL = $sharingACL; |
|
| 43 | + $this->sharingACL = $sharingACL; |
|
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | /** |
@@ -117,18 +117,18 @@ discard block |
||
| 117 | 117 | * @throws DoesNotExistException |
| 118 | 118 | */ |
| 119 | 119 | public function getCredentialById($credential_id, $user_id){ |
| 120 | - $credential = $this->credentialMapper->getCredentialById($credential_id); |
|
| 121 | - if ($credential->getUserId() === $user_id){ |
|
| 122 | - return $credential; |
|
| 123 | - } |
|
| 124 | - else { |
|
| 125 | - $acl = $this->sharingACL->getItemACL($user_id, $credential->getGuid()); |
|
| 126 | - if ($acl->hasPermission(SharingACL::READ)) { |
|
| 120 | + $credential = $this->credentialMapper->getCredentialById($credential_id); |
|
| 121 | + if ($credential->getUserId() === $user_id){ |
|
| 122 | + return $credential; |
|
| 123 | + } |
|
| 124 | + else { |
|
| 125 | + $acl = $this->sharingACL->getItemACL($user_id, $credential->getGuid()); |
|
| 126 | + if ($acl->hasPermission(SharingACL::READ)) { |
|
| 127 | 127 | return $credential; |
| 128 | 128 | } else { |
| 129 | 129 | throw new DoesNotExistException("Did expect one result but found none when executing"); |
| 130 | 130 | } |
| 131 | - } |
|
| 131 | + } |
|
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | /** |
@@ -147,6 +147,6 @@ discard block |
||
| 147 | 147 | * @return Credential |
| 148 | 148 | */ |
| 149 | 149 | public function getCredentialByGUID($credential_guid, $user_id = null){ |
| 150 | - return $this->credentialMapper->getCredentialByGUID($credential_guid, $user_id); |
|
| 151 | - } |
|
| 150 | + return $this->credentialMapper->getCredentialByGUID($credential_guid, $user_id); |
|
| 151 | + } |
|
| 152 | 152 | } |
| 153 | 153 | \ No newline at end of file |