Fix error 500

This commit is contained in:
brantje 2016-10-05 18:52:14 +02:00
parent 4051602a13
commit 94c418bd5c
No known key found for this signature in database
GPG key ID: 5FF1D117F918687F
2 changed files with 20 additions and 7 deletions

View file

@ -36,14 +36,14 @@ class CredentialController extends ApiController {
public function __construct($AppName,
IRequest $request,
IUser $UserId,
$userId,
CredentialService $credentialService,
ActivityService $activityService,
CredentialRevisionService $credentialRevisionService,
ShareService $sharingService
) {
parent::__construct($AppName, $request);
$this->userId = $UserId;
$this->userId = $userId;
$this->credentialService = $credentialService;
$this->activityService = $activityService;
$this->credentialRevisionService = $credentialRevisionService;
@ -255,11 +255,11 @@ class CredentialController extends ApiController {
}
// If the request was made by the owner of the credential
if ($this->userId->getUID() == $credential->getUserId()) {
if ($this->userId == $credential->getUserId()) {
$result = $this->credentialRevisionService->getRevisions($credential->getId(), $this->userId);
}
else {
$acl = $this->sharingService->getACL($this->userId->getUID(), $credential_guid);
$acl = $this->sharingService->getACL($this->userId, $credential_guid);
if ($acl->hasPermission(SharingACL::HISTORY)){
$result = $this->credentialRevisionService->getRevisions($credential->getId());
}

View file

@ -89,11 +89,24 @@ angular.module('passmanApp')
};
$scope.restoreRevision = function (revision) {
var key;
var _revision = angular.copy(revision);
var _credential = _revision.credential_data;
//@TODO make sure the shared key doesn't get restored
_credential.revision_created = $filter('date')(_revision.created * 1000 , "dd-MM-yyyy @ HH:mm:ss");
CredentialService.updateCredential(_credential).then(function (result) {
if(!$scope.storedCredential.hasOwnProperty('acl') && $scope.storedCredential.hasOwnProperty('shared_key')){
key = EncryptService.decryptString(angular.copy($scope.storedCredential.shared_key));
}
if($scope.storedCredential.hasOwnProperty('acl')){
key = EncryptService.decryptString(angular.copy($scope.storedCredential.acl.shared_key));
}
if(key){
_credential = ShareService.encryptSharedCredential($scope.storedCredential, key);
}
delete _credential.shared_key;
//_credential.revision_created = $filter('date')(_revision.created * 1000 , "dd-MM-yyyy @ HH:mm:ss");
CredentialService.updateCredential(_credential, (key)).then(function (result) {
SettingsService.setSetting('revision_credential', null);
$rootScope.$emit('app_menu', false);
$location.path('/vault/' + $routeParams.vault_id);