diff options
author | brantje <brantje@gmail.com> | 2016-12-29 02:07:27 +0300 |
---|---|---|
committer | brantje <brantje@gmail.com> | 2016-12-29 14:29:48 +0300 |
commit | 9ab74be344d3f7eaacd66c24727180aaacb6e317 (patch) | |
tree | 3e3b35514227fcab2f5b2a32f98979ea996f1ea3 /controller | |
parent | 80973c77a852e3696d2f759c9be15d93bb6704f4 (diff) |
Check if shared_key exists
Remove value set by php
Replace DoesNotExistException with Exeption
Diffstat (limited to 'controller')
-rw-r--r-- | controller/credentialcontroller.php | 8 | ||||
-rw-r--r-- | controller/filecontroller.php | 2 | ||||
-rw-r--r-- | controller/sharecontroller.php | 32 | ||||
-rw-r--r-- | controller/vaultcontroller.php | 4 |
4 files changed, 23 insertions, 23 deletions
diff --git a/controller/credentialcontroller.php b/controller/credentialcontroller.php index fdc391fb..2ab356d3 100644 --- a/controller/credentialcontroller.php +++ b/controller/credentialcontroller.php @@ -192,7 +192,7 @@ class CredentialController extends ApiController { try { $acl_list = $this->sharingService->getCredentialAclList($storedCredential->getGuid()); - } catch (DoesNotExistException $exception) { + } catch (\Exception $exception) { // Just check if we have an acl list } if (!empty($acl_list)) { @@ -270,7 +270,7 @@ class CredentialController extends ApiController { public function getRevision($credential_guid) { try { $credential = $this->credentialService->getCredentialByGUID($credential_guid); - } catch (DoesNotExistException $ex) { + } catch (\Exception $ex) { return new NotFoundJSONResponse(); } @@ -306,13 +306,13 @@ class CredentialController extends ApiController { $revision = null; try { $this->credentialService->getCredentialByGUID($credential_guid, $this->userId); - } catch (DoesNotExistException $e) { + } catch (\Exception $e) { return new NotFoundJSONResponse(); } try { $revision = $this->credentialRevisionService->getRevision($revision_id); - } catch (DoesNotExistException $exception) { + } catch (\Exception $exception) { return new NotFoundJSONResponse(); } diff --git a/controller/filecontroller.php b/controller/filecontroller.php index 618133ea..d3c29ea5 100644 --- a/controller/filecontroller.php +++ b/controller/filecontroller.php @@ -62,7 +62,7 @@ class FileController extends ApiController { public function updateFile($file_id, $file_data, $filename, $mimetype, $size){ try{ $file = $this->fileService->getFile($file_id, $this->userId); - } catch (DoesNotExistException $doesNotExistException){ + } catch (\Exception $doesNotExistException){ } if($file){ diff --git a/controller/sharecontroller.php b/controller/sharecontroller.php index aa061432..f8c137c2 100644 --- a/controller/sharecontroller.php +++ b/controller/sharecontroller.php @@ -96,13 +96,13 @@ class ShareController extends ApiController { try { $credential = $this->credentialService->getCredentialByGUID($item_guid); - } catch (DoesNotExistException $exception) { + } catch (\Exception $exception) { return new NotFoundResponse(); } try { $acl = $this->shareService->getACL(null, $item_guid); - } catch (DoesNotExistException $exception) { + } catch (\Exception $exception) { $acl = new SharingACL(); } @@ -145,14 +145,14 @@ class ShareController extends ApiController { if (count($shareRequests) > 0) { return new JSONResponse(array('error' => 'User got already pending requests')); } - } catch (DoesNotExistException $exception) { + } catch (\Exception $exception) { // no need to catch this } $acl = null; try { $acl = $this->shareService->getCredentialAclForUser($first_vault['user_id'], $item_guid); - } catch (DoesNotExistException $exception) { + } catch (\Exception $exception) { // no need to catch this } @@ -247,12 +247,12 @@ class ShareController extends ApiController { $sr = null; try { $acl = $this->shareService->getCredentialAclForUser($user_id, $item_guid); - } catch (DoesNotExistException $e) { + } catch (\Exception $e) { } try { $sr = array_pop($this->shareService->getPendingShareRequestsForCredential($item_guid, $user_id)); - } catch (DoesNotExistException $e) { + } catch (\Exception $e) { // no need to catch this } @@ -307,7 +307,7 @@ class ShareController extends ApiController { public function savePendingRequest($item_guid, $target_vault_guid, $final_shared_key) { try { $sr = $this->shareService->getRequestByGuid($item_guid, $target_vault_guid); - } catch (DoesNotExistException $ex) { + } catch (\Exception $ex) { return new NotFoundResponse(); } @@ -348,7 +348,7 @@ class ShareController extends ApiController { array_push($results, $result); } return new JSONResponse($results); - } catch (DoesNotExistException $ex) { + } catch (\Exception $ex) { return new NotFoundResponse(); } } @@ -362,7 +362,7 @@ class ShareController extends ApiController { public function getRevisions($item_guid) { try { return new JSONResponse($this->shareService->getItemHistory($this->userId, $item_guid)); - } catch (DoesNotExistException $ex) { + } catch (\Exception $ex) { return new NotFoundJSONResponse(); } } @@ -378,7 +378,7 @@ class ShareController extends ApiController { try { return new JSONResponse($this->shareService->getSharedItems($this->userId->getUID(), $vault_guid)); - } catch (DoesNotExistException $ex) { + } catch (\Exception $ex) { return new NotFoundResponse(); } } @@ -413,7 +413,7 @@ class ShareController extends ApiController { $this->shareService->cleanItemRequestsForUser($sr); return new JSONResponse(array('result' => true)); - } catch (DoesNotExistException $ex) { + } catch (\Exception $ex) { return new NotFoundJSONResponse(); } } @@ -447,7 +447,7 @@ class ShareController extends ApiController { try { $credential = $this->shareService->getSharedItem(null, $credential_guid); return new JSONResponse($credential); - } catch (DoesNotExistException $ex) { + } catch (\Exception $ex) { return new NotFoundJSONResponse(); } } @@ -472,7 +472,7 @@ class ShareController extends ApiController { } else { return new NotFoundResponse(); } - } catch (DoesNotExistException $ex) { + } catch (\Exception $ex) { return new JSONResponse(array()); } } @@ -488,7 +488,7 @@ class ShareController extends ApiController { public function getFile($item_guid, $file_guid) { try { $credential = $this->credentialService->getCredentialByGUID($item_guid); - } catch (DoesNotExistException $e) { + } catch (\Exception $e) { return new NotFoundJSONResponse(); } $userId = ($this->userId) ? $this->userId->getUID() : null; @@ -511,7 +511,7 @@ class ShareController extends ApiController { public function updateSharedCredentialACL($item_guid, $user_id, $permission) { try { $credential = $this->credentialService->getCredentialByGUID($item_guid); - } catch (DoesNotExistException $exception) { + } catch (\Exception $exception) { return new NotFoundJSONResponse(); } if ($this->userId->getUID() === $credential->getUserId()) { @@ -520,7 +520,7 @@ class ShareController extends ApiController { $acl = $this->shareService->getACL($user_id, $item_guid); $acl->setPermissions($permission); return $this->shareService->updateCredentialACL($acl); - } catch (DoesNotExistException $exception) { + } catch (\Exception $exception) { } diff --git a/controller/vaultcontroller.php b/controller/vaultcontroller.php index 40f051c1..c206a39e 100644 --- a/controller/vaultcontroller.php +++ b/controller/vaultcontroller.php @@ -86,7 +86,7 @@ class VaultController extends ApiController { $vault = null; try { $vault = $this->vaultService->getByGuid($vault_guid, $this->userId); - } catch (DoesNotExistException $e) { + } catch (\Exception $e) { return new NotFoundJSONResponse(); } $result = array(); @@ -136,7 +136,7 @@ class VaultController extends ApiController { $vault = null; try { $vault = $this->vaultService->getByGuid($vault_guid, $this->userId); - } catch (DoesNotExistException $e) { + } catch (\Exception $e) { } |