@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | ShareRequestMapper $shareRequest, |
48 | 48 | CredentialMapper $credentials, |
49 | 49 | CredentialRevisionService $revisions, |
50 | - EncryptService $encryptService |
|
50 | + EncryptService $encryptService |
|
51 | 51 | ) { |
52 | 52 | $this->sharingACL = $sharingACL; |
53 | 53 | $this->shareRequest = $shareRequest; |
@@ -200,31 +200,31 @@ discard block |
||
200 | 200 | } |
201 | 201 | |
202 | 202 | |
203 | - /** |
|
204 | - * Deletes a share request by the item ID |
|
205 | - * @param ShareRequest $request |
|
206 | - * @return \PDOStatement |
|
207 | - */ |
|
203 | + /** |
|
204 | + * Deletes a share request by the item ID |
|
205 | + * @param ShareRequest $request |
|
206 | + * @return \PDOStatement |
|
207 | + */ |
|
208 | 208 | public function cleanItemRequestsForUser(ShareRequest $request) { |
209 | 209 | return $this->shareRequest->cleanItemRequestsForUser($request->getItemId(), $request->getTargetUserId()); |
210 | 210 | } |
211 | 211 | |
212 | - /** |
|
213 | - * Get an share request by id |
|
214 | - * @param $id |
|
215 | - * @return ShareRequest |
|
216 | - */ |
|
212 | + /** |
|
213 | + * Get an share request by id |
|
214 | + * @param $id |
|
215 | + * @return ShareRequest |
|
216 | + */ |
|
217 | 217 | public function getShareRequestById($id) { |
218 | 218 | return $this->shareRequest->getShareRequestById($id); |
219 | 219 | } |
220 | 220 | |
221 | - /** |
|
222 | - * Get an share request by $item_guid and $target_vault_guid |
|
223 | - * |
|
224 | - * @param $item_guid |
|
225 | - * @param $target_vault_guid |
|
226 | - * @return ShareRequest |
|
227 | - */ |
|
221 | + /** |
|
222 | + * Get an share request by $item_guid and $target_vault_guid |
|
223 | + * |
|
224 | + * @param $item_guid |
|
225 | + * @param $target_vault_guid |
|
226 | + * @return ShareRequest |
|
227 | + */ |
|
228 | 228 | public function getRequestByGuid($item_guid, $target_vault_guid) { |
229 | 229 | return $this->shareRequest->getRequestByItemAndVaultGuid($item_guid, $target_vault_guid); |
230 | 230 | } |
@@ -284,11 +284,11 @@ discard block |
||
284 | 284 | return $this->sharingACL->deleteShareACL($ACL); |
285 | 285 | } |
286 | 286 | |
287 | - /** |
|
288 | - * Updates the given ACL entry |
|
289 | - * @param SharingACL $sharingACL |
|
290 | - * @return SharingACL |
|
291 | - */ |
|
287 | + /** |
|
288 | + * Updates the given ACL entry |
|
289 | + * @param SharingACL $sharingACL |
|
290 | + * @return SharingACL |
|
291 | + */ |
|
292 | 292 | public function updateCredentialACL(SharingACL $sharingACL) { |
293 | 293 | return $this->sharingACL->updateCredentialACL($sharingACL); |
294 | 294 | } |
@@ -310,6 +310,6 @@ discard block |
||
310 | 310 | |
311 | 311 | |
312 | 312 | public function updatePendingShareRequestsForCredential($item_guid, $user_id, $permissions){ |
313 | - return $this->shareRequest->updatePendingRequestPermissions($item_guid, $user_id, $permissions); |
|
314 | - } |
|
313 | + return $this->shareRequest->updatePendingRequestPermissions($item_guid, $user_id, $permissions); |
|
314 | + } |
|
315 | 315 | } |
316 | 316 | \ No newline at end of file |
@@ -36,14 +36,14 @@ discard block |
||
36 | 36 | class CredentialService { |
37 | 37 | |
38 | 38 | private $credentialMapper; |
39 | - private $sharingACL; |
|
39 | + private $sharingACL; |
|
40 | 40 | private $encryptService; |
41 | 41 | private $server_key; |
42 | 42 | |
43 | 43 | public function __construct(CredentialMapper $credentialMapper, SharingACLMapper $sharingACL, EncryptService $encryptService) { |
44 | 44 | $this->credentialMapper = $credentialMapper; |
45 | - $this->sharingACL = $sharingACL; |
|
46 | - $this->encryptService = $encryptService; |
|
45 | + $this->sharingACL = $sharingACL; |
|
46 | + $this->encryptService = $encryptService; |
|
47 | 47 | $this->server_key = \OC::$server->getConfig()->getSystemValue('passwordsalt', ''); |
48 | 48 | } |
49 | 49 | |
@@ -136,18 +136,18 @@ discard block |
||
136 | 136 | * @throws DoesNotExistException |
137 | 137 | */ |
138 | 138 | public function getCredentialById($credential_id, $user_id){ |
139 | - $credential = $this->credentialMapper->getCredentialById($credential_id); |
|
140 | - if ($credential->getUserId() === $user_id){ |
|
141 | - return $credential; |
|
142 | - } |
|
143 | - else { |
|
144 | - $acl = $this->sharingACL->getItemACL($user_id, $credential->getGuid()); |
|
145 | - if ($acl->hasPermission(SharingACL::READ)) { |
|
139 | + $credential = $this->credentialMapper->getCredentialById($credential_id); |
|
140 | + if ($credential->getUserId() === $user_id){ |
|
141 | + return $credential; |
|
142 | + } |
|
143 | + else { |
|
144 | + $acl = $this->sharingACL->getItemACL($user_id, $credential->getGuid()); |
|
145 | + if ($acl->hasPermission(SharingACL::READ)) { |
|
146 | 146 | return $this->encryptService->decryptCredential($credential); |
147 | 147 | } else { |
148 | 148 | throw new DoesNotExistException("Did expect one result but found none when executing"); |
149 | 149 | } |
150 | - } |
|
150 | + } |
|
151 | 151 | } |
152 | 152 | |
153 | 153 | /** |
@@ -169,5 +169,5 @@ discard block |
||
169 | 169 | public function getCredentialByGUID($credential_guid, $user_id = null){ |
170 | 170 | $credential = $this->credentialMapper->getCredentialByGUID($credential_guid); |
171 | 171 | return $this->encryptService->decryptCredential($credential); |
172 | - } |
|
172 | + } |
|
173 | 173 | } |
174 | 174 | \ No newline at end of file |