@@ -38,7 +38,7 @@ |
||
38 | 38 | */ |
39 | 39 | |
40 | 40 | |
41 | -class DeleteVaultRequest extends Entity implements \JsonSerializable{ |
|
41 | +class DeleteVaultRequest extends Entity implements \JsonSerializable { |
|
42 | 42 | |
43 | 43 | use EntityJSONSerializer; |
44 | 44 |
@@ -181,7 +181,7 @@ |
||
181 | 181 | } |
182 | 182 | |
183 | 183 | |
184 | - private function parseLinkElement($htmlHead, $pageUrlInfo, $base_href){ |
|
184 | + private function parseLinkElement($htmlHead, $pageUrlInfo, $base_href) { |
|
185 | 185 | if (preg_match('#<\s*link[^>]*(rel=(["\'])[^>\2]*icon[^>\2]*\2)[^>]*>#i', $htmlHead, $matches)) { |
186 | 186 | $link_tag = $matches[0]; |
187 | 187 | $this->debugInfo['link_tag'] = $link_tag; |
@@ -101,7 +101,9 @@ discard block |
||
101 | 101 | * @return Entity |
102 | 102 | */ |
103 | 103 | public function createACLEntry(SharingACL $acl) { |
104 | - if ($acl->getCreated() === null) $acl->setCreated((new \DateTime())->getTimestamp()); |
|
104 | + if ($acl->getCreated() === null) { |
|
105 | + $acl->setCreated((new \DateTime())->getTimestamp()); |
|
106 | + } |
|
105 | 107 | return $this->sharingACL->createACLEntry($acl); |
106 | 108 | } |
107 | 109 | |
@@ -159,13 +161,17 @@ discard block |
||
159 | 161 | $return = []; |
160 | 162 | foreach ($entries as $entry) { |
161 | 163 | // Check if the user can read the credential, probably unnecesary, but just to be sure |
162 | - if (!$entry->hasPermission(SharingACL::READ)) continue; |
|
164 | + if (!$entry->hasPermission(SharingACL::READ)) { |
|
165 | + continue; |
|
166 | + } |
|
163 | 167 | $tmp = $entry->jsonSerialize(); |
164 | 168 | $credential = $this->credential->getCredentialById($entry->getItemId()); |
165 | 169 | $credential = $this->encryptService->decryptCredential($credential); |
166 | 170 | $tmp['credential_data'] = $credential->jsonSerialize(); |
167 | 171 | |
168 | - if (!$entry->hasPermission(SharingACL::FILES)) unset($tmp['credential_data']['files']); |
|
172 | + if (!$entry->hasPermission(SharingACL::FILES)) { |
|
173 | + unset($tmp['credential_data']['files']); |
|
174 | + } |
|
169 | 175 | unset($tmp['credential_data']['shared_key']); |
170 | 176 | $return[] = $tmp; |
171 | 177 | } |
@@ -194,7 +200,9 @@ discard block |
||
194 | 200 | $acl = $this->sharingACL->getItemACL($user_id, $item_guid); |
195 | 201 | |
196 | 202 | // Check if the user can read the credential, probably unnecesary, but just to be sure |
197 | - if (!$acl->hasPermission(SharingACL::READ)) throw new DoesNotExistException("Item not found or wrong access level"); |
|
203 | + if (!$acl->hasPermission(SharingACL::READ)) { |
|
204 | + throw new DoesNotExistException("Item not found or wrong access level"); |
|
205 | + } |
|
198 | 206 | |
199 | 207 | $tmp = $acl->jsonSerialize(); |
200 | 208 | $credential = $this->credential->getCredentialById($acl->getItemId()); |
@@ -202,7 +210,9 @@ discard block |
||
202 | 210 | |
203 | 211 | $tmp['credential_data'] = $credential->jsonSerialize(); |
204 | 212 | |
205 | - if (!$acl->hasPermission(SharingACL::FILES)) unset($tmp['credential_data']['files']); |
|
213 | + if (!$acl->hasPermission(SharingACL::FILES)) { |
|
214 | + unset($tmp['credential_data']['files']); |
|
215 | + } |
|
206 | 216 | unset($tmp['credential_data']['shared_key']); |
207 | 217 | |
208 | 218 | return $tmp; |
@@ -217,7 +227,9 @@ discard block |
||
217 | 227 | */ |
218 | 228 | public function getItemHistory(string $user_id, string $item_guid) { |
219 | 229 | $acl = $this->sharingACL->getItemACL($user_id, $item_guid); |
220 | - if (!$acl->hasPermission(SharingACL::READ | SharingACL::HISTORY)) return []; |
|
230 | + if (!$acl->hasPermission(SharingACL::READ | SharingACL::HISTORY)) { |
|
231 | + return []; |
|
232 | + } |
|
221 | 233 | |
222 | 234 | return $this->revisions->getRevisions($acl->getItemId()); |
223 | 235 | } |
@@ -45,8 +45,7 @@ discard block |
||
45 | 45 | * @return string |
46 | 46 | */ |
47 | 47 | public static function GUID() { |
48 | - if (function_exists('com_create_guid') === true) |
|
49 | - { |
|
48 | + if (function_exists('com_create_guid') === true) { |
|
50 | 49 | return trim(com_create_guid(), '{}'); |
51 | 50 | } |
52 | 51 | |
@@ -58,7 +57,7 @@ discard block |
||
58 | 57 | * @param IUserManager $userManager |
59 | 58 | * @return string |
60 | 59 | */ |
61 | - public static function getNameByUid(string $uid, IUserManager $userManager){ |
|
60 | + public static function getNameByUid(string $uid, IUserManager $userManager) { |
|
62 | 61 | $u = $userManager->get($uid); |
63 | 62 | return $u->getDisplayName(); |
64 | 63 | } |
@@ -68,10 +67,10 @@ discard block |
||
68 | 67 | * @param array $results |
69 | 68 | * @return array|mixed |
70 | 69 | */ |
71 | - public static function getDirContents(string $dir, &$results = array()){ |
|
70 | + public static function getDirContents(string $dir, &$results = array()) { |
|
72 | 71 | $files = scandir($dir); |
73 | 72 | |
74 | - foreach($files as $value){ |
|
73 | + foreach($files as $value) { |
|
75 | 74 | $path = realpath($dir.DIRECTORY_SEPARATOR.$value); |
76 | 75 | if(!is_dir($path)) { |
77 | 76 | $results[] = $path; |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | |
81 | 81 | public function moveCredentials($source_account, $destination_account) { |
82 | 82 | $succeed = false; |
83 | - if ($source_account != $destination_account){ |
|
83 | + if ($source_account != $destination_account) { |
|
84 | 84 | $vaults = $this->vaultService->getByUser($source_account); |
85 | 85 | foreach ($vaults as $vault) { |
86 | 86 | $credentials = $this->credentialService->getCredentialsByVaultId($vault->getId(), $source_account); |
@@ -118,10 +118,10 @@ discard block |
||
118 | 118 | return new JSONResponse(array('success' => $succeed)); |
119 | 119 | } |
120 | 120 | |
121 | - public function listRequests(){ |
|
121 | + public function listRequests() { |
|
122 | 122 | $requests = $this->deleteVaultRequestService->getDeleteRequests(); |
123 | 123 | $results = array(); |
124 | - foreach($requests as $request){ |
|
124 | + foreach($requests as $request) { |
|
125 | 125 | $r = $request->jsonSerialize(); |
126 | 126 | $r['displayName'] = Utils::getNameByUid($request->getRequestedBy(), $this->userManager); |
127 | 127 | array_push($results, $r); |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | return new JSONResponse($results); |
130 | 130 | } |
131 | 131 | |
132 | - public function acceptRequestDeletion($vault_guid, $requested_by){ |
|
132 | + public function acceptRequestDeletion($vault_guid, $requested_by) { |
|
133 | 133 | $req = $this->deleteVaultRequestService->getDeleteRequestForVault($vault_guid); |
134 | 134 | try{ |
135 | 135 | $vault = $this->vaultService->getByGuid($vault_guid, $requested_by); |
@@ -137,14 +137,14 @@ discard block |
||
137 | 137 | //Ignore |
138 | 138 | } |
139 | 139 | |
140 | - if(isset($vault)){ |
|
140 | + if(isset($vault)) { |
|
141 | 141 | $credentials = $this->credentialService->getCredentialsByVaultId($vault->getId(), $requested_by); |
142 | - foreach($credentials as $credential){ |
|
142 | + foreach($credentials as $credential) { |
|
143 | 143 | $revisions = $this->revisionService->getRevisions($credential->getId()); |
144 | - foreach($revisions as $revision){ |
|
144 | + foreach($revisions as $revision) { |
|
145 | 145 | $this->revisionService->deleteRevision($revision['revision_id'], $requested_by); |
146 | 146 | } |
147 | - if($credential instanceof Credential){ |
|
147 | + if($credential instanceof Credential) { |
|
148 | 148 | $this->credentialService->deleteCredential($credential); |
149 | 149 | } |
150 | 150 | } |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | */ |
163 | 163 | public function requestDeletion($vault_guid, $reason) { |
164 | 164 | $req = $this->deleteVaultRequestService->getDeleteRequestForVault($vault_guid); |
165 | - if($req){ |
|
165 | + if($req) { |
|
166 | 166 | return new JSONResponse('Already exists'); |
167 | 167 | } |
168 | 168 | $vault = $this->vaultService->getByGuid($vault_guid, $this->userId); |