diff options
author | brantje <brantje@gmail.com> | 2016-10-08 14:45:44 +0300 |
---|---|---|
committer | brantje <brantje@gmail.com> | 2016-10-08 14:45:44 +0300 |
commit | e96911e50f3d3592afa3aed0420ca064fe29a765 (patch) | |
tree | 2abe3de10a9e472e882e5d4bcc118f864ced2368 /controller | |
parent | 6dc3ddf63fcf46f2ebc6a67a11c481057c068abc (diff) |
Revert "Scrutinizer Auto-Fixes"
This reverts commit ae73bff5c4a8a1441c8509fb06fd2a94133b58f5.
Diffstat (limited to 'controller')
-rw-r--r-- | controller/credentialcontroller.php | 54 |
1 files changed, 27 insertions, 27 deletions
diff --git a/controller/credentialcontroller.php b/controller/credentialcontroller.php index 07e8052b..cdb8065b 100644 --- a/controller/credentialcontroller.php +++ b/controller/credentialcontroller.php @@ -84,7 +84,7 @@ class CredentialController extends ApiController { ); $credential = $this->credentialService->createCredential($credential); $link = ''; // @TODO create direct link to credential - if (!$credential->getHidden()) { + if(!$credential->getHidden()) { $this->activityService->add( Activity::SUBJECT_ITEM_CREATED_SELF, array($label, $this->userId), '', array(), @@ -202,7 +202,7 @@ class CredentialController extends ApiController { foreach ($acl_list as $sharingACL) { $target_user = $sharingACL->getUserId(); - if ($target_user === $this->userId) { + if($target_user === $this->userId){ continue; } $this->activityService->add( @@ -217,15 +217,15 @@ class CredentialController extends ApiController { $link, $storedCredential->getUserId(), Activity::TYPE_ITEM_ACTION); } } - if ($set_share_key === true) { + if($set_share_key === true){ $storedCredential->setSharedKey($shared_key); $credential['shared_key'] = $shared_key; } - if ($unshare_action === true) { + if($unshare_action === true){ $storedCredential->setSharedKey(''); $credential['shared_key'] = ''; } - if (!$skip_revision) { + if(!$skip_revision) { $this->credentialRevisionService->createRevision($storedCredential, $storedCredential->getUserId(), $credential_id, $this->userId); } $credential = $this->credentialService->updateCredential($credential); @@ -255,26 +255,26 @@ class CredentialController extends ApiController { * @NoAdminRequired */ public function getRevision($credential_guid) { - try { - $credential = $this->credentialService->getCredentialByGUID($credential_guid); - } - catch (DoesNotExistException $ex){ - return new NotFoundJSONResponse(); - } + try { + $credential = $this->credentialService->getCredentialByGUID($credential_guid); + } + catch (DoesNotExistException $ex){ + return new NotFoundJSONResponse(); + } - // If the request was made by the owner of the credential - if ($this->userId === $credential->getUserId()) { - $result = $this->credentialRevisionService->getRevisions($credential->getId(), $this->userId); - } - else { - $acl = $this->sharingService->getACL($this->userId, $credential_guid); - if ($acl->hasPermission(SharingACL::HISTORY)){ - $result = $this->credentialRevisionService->getRevisions($credential->getId()); - } - else { - return new NotFoundJSONResponse(); - } - } + // If the request was made by the owner of the credential + if ($this->userId === $credential->getUserId()) { + $result = $this->credentialRevisionService->getRevisions($credential->getId(), $this->userId); + } + else { + $acl = $this->sharingService->getACL($this->userId, $credential_guid); + if ($acl->hasPermission(SharingACL::HISTORY)){ + $result = $this->credentialRevisionService->getRevisions($credential->getId()); + } + else { + return new NotFoundJSONResponse(); + } + } return new JSONResponse($result); } @@ -290,7 +290,7 @@ class CredentialController extends ApiController { /** * @NoAdminRequired */ - public function updateRevision($credential_guid, $revision_id, $credential_data) { + public function updateRevision($credential_guid, $revision_id, $credential_data){ $revision = null; try { $credential = $this->credentialService->getCredentialByGUID($credential_guid, $this->userId); @@ -298,9 +298,9 @@ class CredentialController extends ApiController { return new NotFoundJSONResponse(); } - try { + try{ $revision = $this->credentialRevisionService->getRevision($revision_id); - } catch (DoesNotExistException $exception) { + } catch(DoesNotExistException $exception){ return new NotFoundJSONResponse(); } |