Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/passman.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrantje <brantje@gmail.com>2016-10-08 13:28:29 +0300
committerbrantje <brantje@gmail.com>2016-10-08 13:28:29 +0300
commit8f6ab6cacf7248d58d3b6abff5b3cad6943cb079 (patch)
tree24dcbeb394f4e0dcb91a0769b7de937b6d59171d /controller
parent23e8b08fb284dc6fe1244605d243e795deb94cc2 (diff)
parent41dd5058ba18e20da9dcd1bfc49e6740d725d551 (diff)
fix conflicts
Diffstat (limited to 'controller')
-rw-r--r--controller/credentialcontroller.php62
-rw-r--r--controller/filecontroller.php8
-rw-r--r--controller/internalcontroller.php4
-rw-r--r--controller/sharecontroller.php8
4 files changed, 41 insertions, 41 deletions
diff --git a/controller/credentialcontroller.php b/controller/credentialcontroller.php
index baa43f9a..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(),
@@ -152,19 +152,19 @@ class CredentialController extends ApiController {
$activity . '_self', array($label, $this->userId, $revision_created),
'', array(),
$link, $this->userId, Activity::TYPE_ITEM_ACTION);
- } else if (($storedCredential->getDeleteTime() == 0) && $delete_time > 0) {
+ } else if (($storedCredential->getDeleteTime() === 0) && (int) $delete_time > 0) {
$activity = 'item_deleted';
$this->activityService->add(
$activity . '_self', array($label, $this->userId),
'', array(),
$link, $this->userId, Activity::TYPE_ITEM_ACTION);
- } else if (($storedCredential->getDeleteTime() > 0) && $delete_time == 0) {
+ } else if (($storedCredential->getDeleteTime() > 0) && (int) $delete_time === 0) {
$activity = 'item_recovered';
$this->activityService->add(
$activity . '_self', array($label, $this->userId),
'', array(),
$link, $this->userId, Activity::TYPE_ITEM_ACTION);
- } else if ($label != $storedCredential->getLabel()) {
+ } else if ($label !== $storedCredential->getLabel()) {
$activity = 'item_renamed';
$this->activityService->add(
$activity . '_self', array($storedCredential->getLabel(), $label, $this->userId),
@@ -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(
@@ -210,22 +210,22 @@ class CredentialController extends ApiController {
'', array(),
$link, $target_user, Activity::TYPE_ITEM_ACTION);
}
- if ($this->userId != $storedCredential->getUserId()) {
+ if ($this->userId !== $storedCredential->getUserId()) {
$this->activityService->add(
$activity, $params,
'', array(),
$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();
}
diff --git a/controller/filecontroller.php b/controller/filecontroller.php
index eef277ce..dd118ef9 100644
--- a/controller/filecontroller.php
+++ b/controller/filecontroller.php
@@ -40,20 +40,20 @@ class FileController extends ApiController {
'mimetype' => $mimetype,
'file_data' => $data
);
- return $this->fileService->createFile($file, $this->userId);
+ return new JSONResponse($this->fileService->createFile($file, $this->userId));
}
/**
* @NoAdminRequired
*/
public function getFile($file_id) {
- return $this->fileService->getFile($file_id, $this->userId);
+ return new JSONResponse($this->fileService->getFile($file_id, $this->userId));
}
/**
* @NoAdminRequired
*/
public function deleteFile($file_id) {
- return $this->fileService->deleteFile($file_id, $this->userId);
+ return new JSONResponse($this->fileService->deleteFile($file_id, $this->userId));
}
public function updateFile($file_id, $file_data, $filename, $mimetype, $size){
@@ -70,7 +70,7 @@ class FileController extends ApiController {
$file->setFilename($filename);
}
if($filename || $file_data){
- $this->fileService->updateFile($file);
+ new JSONResponse($this->fileService->updateFile($file));
}
}
}
diff --git a/controller/internalcontroller.php b/controller/internalcontroller.php
index b967f51f..8b689887 100644
--- a/controller/internalcontroller.php
+++ b/controller/internalcontroller.php
@@ -15,7 +15,7 @@ use OCP\IRequest;
use OCP\AppFramework\Http\JSONResponse;
use OCP\AppFramework\ApiController;
use OCA\Passman\Service\CredentialService;
-use \OC_App;
+
class InternalController extends ApiController {
private $userId;
@@ -67,7 +67,7 @@ class InternalController extends ApiController {
* @NoAdminRequired
*/
public function getAppVersion() {
- return new JSONResponse(array('version' => OC_App::getAppVersion('passman')));
+ return new JSONResponse(array('version' => '1.0.2.24'));
}
/**
diff --git a/controller/sharecontroller.php b/controller/sharecontroller.php
index 66e8ad99..00284a68 100644
--- a/controller/sharecontroller.php
+++ b/controller/sharecontroller.php
@@ -196,7 +196,7 @@ class ShareController extends ApiController {
$usersTmp = $this->userManager->searchDisplayName($search, $this->limit, $this->offset);
foreach ($usersTmp as $user) {
- if ($this->userId->getUID() != $user->getUID() && count($this->vaultService->getByUser($user->getUID())) >= 1) {
+ if ($this->userId->getUID() !== $user->getUID() && count($this->vaultService->getByUser($user->getUID())) >= 1) {
$users[] = array(
'text' => $user->getDisplayName(),
'uid' => $user->getUID(),
@@ -416,7 +416,7 @@ class ShareController extends ApiController {
$views = $acl->getExpireViews();
if ($views === 0) {
return new NotFoundJSONResponse();
- } else if ($views != -1) {
+ } else if ($views !== -1) {
$views--;
$acl->setExpireViews($views);
$this->shareService->updateCredentialACL($acl);
@@ -441,7 +441,7 @@ class ShareController extends ApiController {
$pending = $this->shareService->getCredentialPendingAclList($item_guid);
try {
$credential = $this->credentialService->getCredentialByGUID($item_guid);
- if ($credential->getUserId() == $this->userId->getUID()) {
+ if ($credential->getUserId() === $this->userId->getUID()) {
foreach ($pending as &$item) {
$item = $item->asACLJson();
}
@@ -490,7 +490,7 @@ class ShareController extends ApiController {
} catch (DoesNotExistException $exception) {
return new NotFoundJSONResponse();
}
- if ($this->userId->getUID() == $credential->getUserId()) {
+ if ($this->userId->getUID() === $credential->getUserId()) {
$acl = null;
try {
$acl = $this->shareService->getACL($user_id, $item_guid);