diff options
author | Scrutinizer Auto-Fixer <auto-fixer@scrutinizer-ci.com> | 2016-10-08 01:59:30 +0300 |
---|---|---|
committer | Scrutinizer Auto-Fixer <auto-fixer@scrutinizer-ci.com> | 2016-10-08 01:59:30 +0300 |
commit | ae73bff5c4a8a1441c8509fb06fd2a94133b58f5 (patch) | |
tree | 73e69827aedb0d946a76d45be19017c189218ab2 /controller | |
parent | cee3ea986579e5e0f417fde37b2d27e0f1993b76 (diff) |
Scrutinizer Auto-Fixes
This commit consists of patches automatically generated for this project on https://scrutinizer-ci.com
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 cdb8065b..07e8052b 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(); } |