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) { } diff --git a/lib/Db/CredentialMapper.php b/lib/Db/CredentialMapper.php index 32303ca8..5d3443f6 100644 --- a/lib/Db/CredentialMapper.php +++ b/lib/Db/CredentialMapper.php @@ -131,7 +131,9 @@ class CredentialMapper extends Mapper { $credential->setCustomFields($raw_credential['custom_fields']); $credential->setOtp($raw_credential['otp']); $credential->setHidden($raw_credential['hidden']); - $credential->setSharedKey($raw_credential['shared_key']); + if(isset($raw_credential['shared_key'])) { + $credential->setSharedKey($raw_credential['shared_key']); + } return parent::insert($credential); } diff --git a/templates/settings-admin.php b/templates/settings-admin.php index 5642a9d0..4ca60bf0 100644 --- a/templates/settings-admin.php +++ b/templates/settings-admin.php @@ -52,7 +52,7 @@ if ($checkVersion) {

/> + value="1" />