mirror of
https://github.com/bitwarden/browser.git
synced 2024-11-27 12:36:14 +01:00
manage subvaults for login in vault
This commit is contained in:
parent
673485b5c4
commit
08aa53748e
@ -29,7 +29,8 @@
|
||||
'import': { url: _apiUri + '/ciphers/import', method: 'POST', params: {} },
|
||||
favorite: { url: _apiUri + '/ciphers/:id/favorite', method: 'POST', params: { id: '@id' } },
|
||||
putPartial: { url: _apiUri + '/ciphers/:id/partial', method: 'POST', params: { id: '@id' } },
|
||||
move: { url: _apiUri + '/ciphers/:id/move', method: 'POST', params: { id: '@id' } },
|
||||
putShare: { url: _apiUri + '/ciphers/:id/share', method: 'POST', params: { id: '@id' } },
|
||||
putSubvaults: { url: _apiUri + '/ciphers/:id/subvaults', method: 'POST', params: { id: '@id' } },
|
||||
del: { url: _apiUri + '/ciphers/:id/delete', method: 'POST', params: { id: '@id' } }
|
||||
});
|
||||
|
||||
|
@ -84,17 +84,25 @@
|
||||
return Object.keys($scope.selectedSubvaults).length === $scope.subvaults.length;
|
||||
};
|
||||
|
||||
$scope.submit = function (model) {
|
||||
$scope.submit = function () {
|
||||
var request = {
|
||||
subvaultIds: model.subvaultIds
|
||||
subvaultIds: []
|
||||
};
|
||||
|
||||
$scope.submitPromise = apiService.ciphers.putSubvaults({ id: loginId }, request, function (response) {
|
||||
for (var id in $scope.selectedSubvaults) {
|
||||
if ($scope.selectedSubvaults.hasOwnProperty(id)) {
|
||||
request.subvaultIds.push(id);
|
||||
}
|
||||
}
|
||||
|
||||
$scope.submitPromise = apiService.ciphers.putSubvaults({ id: loginId }, request)
|
||||
.$promise.then(function (response) {
|
||||
$analytics.eventTrack('Edited Login Subvaults');
|
||||
$uibModalInstance.close({
|
||||
action: 'subvaultsEdit'
|
||||
action: 'subvaultsEdit',
|
||||
subvaultIds: request.subvaultIds
|
||||
});
|
||||
});
|
||||
}).$promise;
|
||||
};
|
||||
|
||||
$scope.close = function () {
|
||||
|
@ -103,7 +103,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
$scope.submitPromise = apiService.ciphers.move({ id: loginId }, request, function (response) {
|
||||
$scope.submitPromise = apiService.ciphers.putShare({ id: loginId }, request, function (response) {
|
||||
$analytics.eventTrack('Shared Login');
|
||||
$uibModalInstance.close();
|
||||
}).$promise;
|
||||
|
@ -100,6 +100,23 @@
|
||||
});
|
||||
};
|
||||
|
||||
$scope.editSubvaults = function (login) {
|
||||
var modal = $uibModal.open({
|
||||
animation: true,
|
||||
templateUrl: 'app/vault/views/vaultLoginSubvaults.html',
|
||||
controller: 'vaultLoginSubvaultsController',
|
||||
resolve: {
|
||||
loginId: function () { return login.id; }
|
||||
}
|
||||
});
|
||||
|
||||
modal.result.then(function (response) {
|
||||
if (response.subvaultIds) {
|
||||
login.subvaultIds = response.subvaultIds;
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
function getFoldersPromise() {
|
||||
var deferred = $q.defer();
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
<button type="button" class="close" ng-click="close()" aria-label="Close"><span aria-hidden="true">×</span></button>
|
||||
<h4 class="modal-title"><i class="fa fa-share-alt"></i> Subvaults <small>{{login.name}}</small></h4>
|
||||
</div>
|
||||
<form name="form" ng-submit="form.$valid && submit(model)" api-form="submitPromise">
|
||||
<form name="form" ng-submit="form.$valid && submit()" api-form="submitPromise">
|
||||
<div class="modal-body">
|
||||
<p>This login is shared with the following subvaults.</p>
|
||||
<div class="callout callout-danger validation-errors" ng-show="form.$errors">
|
||||
|
@ -47,7 +47,7 @@
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="javascript:void(0)" ng-click="subvaults(login)">
|
||||
<a href="javascript:void(0)" ng-click="editSubvaults(login)">
|
||||
<i class="fa fa-fw fa-share-alt"></i> Subvaults
|
||||
</a>
|
||||
</li>
|
||||
|
Loading…
Reference in New Issue
Block a user