diff options
author | brantje <brantje@gmail.com> | 2017-02-21 23:44:36 +0300 |
---|---|---|
committer | brantje <brantje@gmail.com> | 2017-02-22 20:02:55 +0300 |
commit | acedaf15356b8866d067a8a28165a271c25c589f (patch) | |
tree | 01348613f9e6c5797e1e9a4c5cc9b053db234b11 /controller | |
parent | f55299ffba2624e2ab4d2a2e9b28feed4df761e8 (diff) |
Code style fixes
Diffstat (limited to 'controller')
-rw-r--r-- | controller/admincontroller.php | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/controller/admincontroller.php b/controller/admincontroller.php index 7e9328ca..d7e47909 100644 --- a/controller/admincontroller.php +++ b/controller/admincontroller.php @@ -11,6 +11,7 @@ namespace OCA\Passman\Controller; +use OCA\Passman\Db\Credential; use OCA\Passman\Db\CredentialRevision; use OCA\Passman\Db\DeleteVaultRequest; use OCA\Passman\Service\CredentialRevisionService; @@ -23,8 +24,7 @@ use OCP\IRequest; use OCP\AppFramework\Http\JSONResponse; use OCP\AppFramework\ApiController; use OCA\Passman\Service\CredentialService; -use \OCP\App; -use OCP\JSON; + class AdminController extends ApiController { private $userId; @@ -130,17 +130,20 @@ class AdminController extends ApiController { if(isset($vault)){ $credentials = $this->credentialService->getCredentialsByVaultId($vault->getId(), $requested_by); - foreach($credentials as $credential){ $revisions = $this->revisionService->getRevisions($credential->getId()); foreach($revisions as $revision){ $this->revisionService->deleteRevision($revision['revision_id'], $requested_by); } - $this->credentialService->deleteCredential($credential); + if($credential instanceof Credential){ + $this->credentialService->deleteCredential($credential); + } } $this->vaultService->deleteVault($vault_guid, $requested_by); } - $this->deleteVaultRequestService->removeDeleteRequestForVault($req); + if($req instanceof DeleteVaultRequest) { + $this->deleteVaultRequestService->removeDeleteRequestForVault($req); + } return new JSONResponse(array('result' => true)); } @@ -179,7 +182,7 @@ class AdminController extends ApiController { // Ignore it } - if ($delete_request) { + if ($delete_request instanceof DeleteVaultRequest) { $this->deleteVaultRequestService->removeDeleteRequestForVault($delete_request); $result = true; } |