@@ -49,6 +49,7 @@ discard block |
||
49 | 49 | * @param $target_item_guid string The shared item GUID |
50 | 50 | * @param $request_array array |
51 | 51 | * @param $permissions integer Must be created with a bitmask from options on the ShareRequest class |
52 | + * @param string $credential_owner |
|
52 | 53 | * @return array Array of sharing requests |
53 | 54 | */ |
54 | 55 | public function createBulkRequests($target_item_id, $target_item_guid, $request_array, $permissions, $credential_owner) { |
@@ -253,7 +254,6 @@ discard block |
||
253 | 254 | /** |
254 | 255 | * Delete ACL |
255 | 256 | * |
256 | - * @param ShareRequest $request |
|
257 | 257 | * @return \OCA\Passman\Db\ShareRequest[] |
258 | 258 | */ |
259 | 259 | public function deleteShareACL(SharingACL $ACL) { |
@@ -277,7 +277,6 @@ discard block |
||
277 | 277 | /** |
278 | 278 | * Get pending share requests by guid and uid |
279 | 279 | * |
280 | - * @param ShareRequest $request |
|
281 | 280 | * @return \OCA\Passman\Db\ShareRequest[] |
282 | 281 | */ |
283 | 282 | public function getPendingShareRequestsForCredential($item_guid, $user_id) { |
@@ -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 | } |
@@ -257,21 +257,18 @@ |
||
257 | 257 | public function getRevision($credential_guid) { |
258 | 258 | try { |
259 | 259 | $credential = $this->credentialService->getCredentialByGUID($credential_guid); |
260 | - } |
|
261 | - catch (DoesNotExistException $ex){ |
|
260 | + } catch (DoesNotExistException $ex){ |
|
262 | 261 | return new NotFoundJSONResponse(); |
263 | 262 | } |
264 | 263 | |
265 | 264 | // If the request was made by the owner of the credential |
266 | 265 | if ($this->userId === $credential->getUserId()) { |
267 | 266 | $result = $this->credentialRevisionService->getRevisions($credential->getId(), $this->userId); |
268 | - } |
|
269 | - else { |
|
267 | + } else { |
|
270 | 268 | $acl = $this->sharingService->getACL($this->userId, $credential_guid); |
271 | 269 | if ($acl->hasPermission(SharingACL::HISTORY)){ |
272 | 270 | $result = $this->credentialRevisionService->getRevisions($credential->getId()); |
273 | - } |
|
274 | - else { |
|
271 | + } else { |
|
275 | 272 | return new NotFoundJSONResponse(); |
276 | 273 | } |
277 | 274 | } |
@@ -25,6 +25,7 @@ discard block |
||
25 | 25 | /** |
26 | 26 | * @throws \OCP\AppFramework\Db\DoesNotExistException if not found |
27 | 27 | * @throws \OCP\AppFramework\Db\MultipleObjectsReturnedException if more than one result |
28 | + * @param integer $vault_id |
|
28 | 29 | */ |
29 | 30 | public function getCredentialsByVaultId($vault_id, $user_id) { |
30 | 31 | $sql = 'SELECT * FROM `*PREFIX*passman_credentials` ' . |
@@ -32,12 +33,18 @@ discard block |
||
32 | 33 | return $this->findEntities($sql, [$user_id, $vault_id]); |
33 | 34 | } |
34 | 35 | |
36 | + /** |
|
37 | + * @param integer $vault_id |
|
38 | + */ |
|
35 | 39 | public function getRandomCredentialByVaultId($vault_id, $user_id) { |
36 | 40 | $sql = 'SELECT * FROM `*PREFIX*passman_credentials` ' . |
37 | 41 | 'WHERE `user_id` = ? and vault_id = ? AND shared_key is NULL ORDER BY RAND() LIMIT 1'; |
38 | 42 | return $this->findEntities($sql, [$user_id, $vault_id]); |
39 | 43 | } |
40 | 44 | |
45 | + /** |
|
46 | + * @param integer $timestamp |
|
47 | + */ |
|
41 | 48 | public function getExpiredCredentials($timestamp){ |
42 | 49 | $sql = 'SELECT * FROM `*PREFIX*passman_credentials` ' . |
43 | 50 | 'WHERE `expire_time` > 0 AND `expire_time` < ?'; |
@@ -61,6 +68,9 @@ discard block |
||
61 | 68 | return $this->findEntity($sql,$params); |
62 | 69 | } |
63 | 70 | |
71 | + /** |
|
72 | + * @param integer $credential_id |
|
73 | + */ |
|
64 | 74 | public function getCredentialLabelById($credential_id){ |
65 | 75 | $sql = 'SELECT id, label FROM `*PREFIX*passman_credentials` ' . |
66 | 76 | 'WHERE `id` = ? '; |
@@ -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 | } |