@@ -33,12 +33,18 @@ |
||
33 | 33 | return $this->findEntities($sql, [$user_id, $vault_id]); |
34 | 34 | } |
35 | 35 | |
36 | + /** |
|
37 | + * @param integer $vault_id |
|
38 | + */ |
|
36 | 39 | public function getRandomCredentialByVaultId($vault_id, $user_id) { |
37 | 40 | $sql = 'SELECT * FROM `*PREFIX*passman_credentials` ' . |
38 | 41 | 'WHERE `user_id` = ? and vault_id = ? AND shared_key is NULL ORDER BY RAND() LIMIT 1'; |
39 | 42 | return $this->findEntities($sql, [$user_id, $vault_id]); |
40 | 43 | } |
41 | 44 | |
45 | + /** |
|
46 | + * @param integer $timestamp |
|
47 | + */ |
|
42 | 48 | public function getExpiredCredentials($timestamp) { |
43 | 49 | $sql = 'SELECT * FROM `*PREFIX*passman_credentials` ' . |
44 | 50 | 'WHERE `expire_time` > 0 AND `expire_time` < ?'; |
@@ -255,21 +255,18 @@ |
||
255 | 255 | public function getRevision($credential_guid) { |
256 | 256 | try { |
257 | 257 | $credential = $this->credentialService->getCredentialByGUID($credential_guid); |
258 | - } |
|
259 | - catch (DoesNotExistException $ex) { |
|
258 | + } catch (DoesNotExistException $ex) { |
|
260 | 259 | return new NotFoundJSONResponse(); |
261 | 260 | } |
262 | 261 | |
263 | 262 | // If the request was made by the owner of the credential |
264 | 263 | if ($this->userId === $credential->getUserId()) { |
265 | 264 | $result = $this->credentialRevisionService->getRevisions($credential->getId(), $this->userId); |
266 | - } |
|
267 | - else { |
|
265 | + } else { |
|
268 | 266 | $acl = $this->sharingService->getACL($this->userId, $credential_guid); |
269 | 267 | if ($acl->hasPermission(SharingACL::HISTORY)) { |
270 | 268 | $result = $this->credentialRevisionService->getRevisions($credential->getId()); |
271 | - } |
|
272 | - else { |
|
269 | + } else { |
|
273 | 270 | return new NotFoundJSONResponse(); |
274 | 271 | } |
275 | 272 | } |