mirror of
https://github.com/nextcloud/passman.git
synced 2024-11-10 17:27:40 +08:00
Scrutinizer Auto-Fixes
This commit consists of patches automatically generated for this project on https://scrutinizer-ci.com
This commit is contained in:
parent
cee3ea9865
commit
ae73bff5c4
1 changed files with 27 additions and 27 deletions
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue