Unshare credentials

This commit is contained in:
brantje 2016-10-03 17:23:03 +02:00
parent 48b621a378
commit 3355db8d89
No known key found for this signature in database
GPG key ID: 5FF1D117F918687F
4 changed files with 14 additions and 4 deletions

View file

@ -116,7 +116,7 @@ class CredentialController extends ApiController {
'delete_time' => $delete_time,
'hidden' => $hidden,
'otp' => $otp,
'shared_key' => $shared_key,
'shared_key' => ($shared_key) ? $shared_key : null,
);

View file

@ -9,7 +9,7 @@
* This file is part of passman, licensed under AGPLv3
*/
angular.module('passmanApp')
.controller('ShareCtrl', ['$scope', 'VaultService', 'CredentialService', 'SettingsService', '$location', '$routeParams', 'ShareService', function ($scope, VaultService, CredentialService, SettingsService, $location, $routeParams, ShareService) {
.controller('ShareCtrl', ['$scope', 'VaultService', 'CredentialService', 'SettingsService', '$location', '$routeParams', 'ShareService', 'NotificationService', function ($scope, VaultService, CredentialService, SettingsService, $location, $routeParams, ShareService, NotificationService) {
$scope.active_vault = VaultService.getActiveVault();
$scope.tabs = [{
@ -60,7 +60,6 @@ angular.module('passmanApp')
$location.path('/vault/' + $scope.storedCredential.vault_id);
};
console.log($location);
$scope.share_link = $location.$$protocol + '://'+ $location.$$host + OC.generateUrl('apps/passman/share/public#') + $scope.storedCredential.guid;
$scope.share_settings = {
linkSharing:{
@ -116,6 +115,16 @@ angular.module('passmanApp')
}
};
$scope.unshareCredential = function(credential){
ShareService.unshareCredential(credential).then(function(){
var _credential = angular.copy(credential);
_credential.shared_key = null;
CredentialService.updateCredential(_credential).then(function () {
NotificationService.showNotification('Credential unshared', 4000)
})
})
}
$scope.applyShare = function(){
$scope.share_settings.cypher_progress.percent = 0;
$scope.share_settings.cypher_progress.done = 0;

View file

@ -107,7 +107,7 @@ angular.module('views/settings.html', []).run(['$templateCache', function($templ
angular.module('views/share_credential.html', []).run(['$templateCache', function($templateCache) {
'use strict';
$templateCache.put('views/share_credential.html',
'<div id="controls"><div class="actions creatable"><div class="breadcrumb"><div class="crumb svg ui-droppable" data-dir="/"><a ng-click="logout()"><i class="fa fa-home"></i></a></div><div class="crumb svg" data-dir="/Test"><a ng-click="cancel()">{{active_vault.name}}</a></div><div class="crumb svg last" data-dir="/Test"><a ng-if="storedCredential.credential_id">Share credential "{{storedCredential.label}}"</a></div></div></div></div><ul class="tab_header"><li ng-repeat="tab in tabs track by $index" class="tab" ng-class="{active:isActiveTab(tab)}" ng-click="onClickTab(tab)" use-theme>{{tab.title}}</li></ul><div class="tab_container edit_credential"><div ng-include="currentTab.url"></div><button ng-click="applyShare()">Share</button> <button ng-click="cancel()">Cancel</button></div>');
'<div id="controls"><div class="actions creatable"><div class="breadcrumb"><div class="crumb svg ui-droppable" data-dir="/"><a ng-click="logout()"><i class="fa fa-home"></i></a></div><div class="crumb svg" data-dir="/Test"><a ng-click="cancel()">{{active_vault.name}}</a></div><div class="crumb svg last" data-dir="/Test"><a ng-if="storedCredential.credential_id">Share credential "{{storedCredential.label}}"</a></div></div></div></div><ul class="tab_header"><li ng-repeat="tab in tabs track by $index" class="tab" ng-class="{active:isActiveTab(tab)}" ng-click="onClickTab(tab)" use-theme>{{tab.title}}</li></ul><div class="tab_container edit_credential"><div ng-include="currentTab.url"></div><button ng-click="applyShare()">Share</button> <button ng-click="cancel()">Cancel</button> <button class="btn btn-danger" ng-click="unshareCredential(storedCredential)">Unshare</button></div>');
}]);
angular.module('views/show_vault.html', []).run(['$templateCache', function($templateCache) {

View file

@ -25,6 +25,7 @@
<button ng-click="applyShare()">Share</button>
<button ng-click="cancel()">Cancel</button>
<button class="btn btn-danger" ng-click="unshareCredential(storedCredential)">Unshare</button>
</div>