@@ -30,11 +30,11 @@ |
||
30 | 30 | private $urlGenerator; |
31 | 31 | |
32 | 32 | public function __construct($AppName, |
33 | - IRequest $request, |
|
34 | - $UserId, |
|
35 | - CredentialService $credentialService, |
|
36 | - AppManager $am, |
|
37 | - IURLGenerator $urlGenerator |
|
33 | + IRequest $request, |
|
34 | + $UserId, |
|
35 | + CredentialService $credentialService, |
|
36 | + AppManager $am, |
|
37 | + IURLGenerator $urlGenerator |
|
38 | 38 | ) { |
39 | 39 | parent::__construct( |
40 | 40 | $AppName, |
@@ -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,28 +129,28 @@ 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 | - try{ |
|
134 | + try { |
|
135 | 135 | $vault = $this->vaultService->getByGuid($vault_guid, $requested_by); |
136 | - } catch (\Exception $e){ |
|
136 | + } catch (\Exception $e) { |
|
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 | } |
151 | 151 | $this->vaultService->deleteVault($vault_guid, $requested_by); |
152 | 152 | } |
153 | - if($req instanceof DeleteVaultRequest) { |
|
153 | + if ($req instanceof DeleteVaultRequest) { |
|
154 | 154 | $this->deleteVaultRequestService->removeDeleteRequestForVault($req); |
155 | 155 | } |
156 | 156 | |
@@ -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); |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | $result = false; |
188 | 188 | try { |
189 | 189 | $delete_request = $this->deleteVaultRequestService->getDeleteRequestForVault($vault_guid); |
190 | - } catch (\Exception $exception){ |
|
190 | + } catch (\Exception $exception) { |
|
191 | 191 | // Ignore it |
192 | 192 | } |
193 | 193 |
@@ -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); |