mirror of
https://github.com/bitwarden/browser
synced 2026-01-02 00:23:35 +00:00
rename subvault => collection
This commit is contained in:
@@ -6,68 +6,68 @@
|
||||
$analytics.eventTrack('organizationPeopleInviteController', { category: 'Modal' });
|
||||
|
||||
$scope.loading = true;
|
||||
$scope.subvaults = [];
|
||||
$scope.selectedSubvaults = {};
|
||||
$scope.collections = [];
|
||||
$scope.selectedCollections = {};
|
||||
$scope.model = {
|
||||
type: 'User'
|
||||
};
|
||||
|
||||
$uibModalInstance.opened.then(function () {
|
||||
apiService.subvaults.listOrganization({ orgId: $state.params.orgId }, function (list) {
|
||||
$scope.subvaults = cipherService.decryptSubvaults(list.Data, $state.params.orgId, true);
|
||||
apiService.collections.listOrganization({ orgId: $state.params.orgId }, function (list) {
|
||||
$scope.collections = cipherService.decryptCollections(list.Data, $state.params.orgId, true);
|
||||
$scope.loading = false;
|
||||
});
|
||||
});
|
||||
|
||||
$scope.toggleSubvaultSelectionAll = function ($event) {
|
||||
var subvaults = {};
|
||||
$scope.toggleCollectionSelectionAll = function ($event) {
|
||||
var collections = {};
|
||||
if ($event.target.checked) {
|
||||
for (var i = 0; i < $scope.subvaults.length; i++) {
|
||||
subvaults[$scope.subvaults[i].id] = {
|
||||
subvaultId: $scope.subvaults[i].id,
|
||||
readOnly: ($scope.subvaults[i].id in $scope.selectedSubvaults) ?
|
||||
$scope.selectedSubvaults[$scope.subvaults[i].id].readOnly : false
|
||||
for (var i = 0; i < $scope.collections.length; i++) {
|
||||
collections[$scope.collections[i].id] = {
|
||||
collectionId: $scope.collections[i].id,
|
||||
readOnly: ($scope.collections[i].id in $scope.selectedCollections) ?
|
||||
$scope.selectedCollections[$scope.collections[i].id].readOnly : false
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
$scope.selectedSubvaults = subvaults;
|
||||
$scope.selectedCollections = collections;
|
||||
};
|
||||
|
||||
$scope.toggleSubvaultSelection = function (id) {
|
||||
if (id in $scope.selectedSubvaults) {
|
||||
delete $scope.selectedSubvaults[id];
|
||||
$scope.toggleCollectionSelection = function (id) {
|
||||
if (id in $scope.selectedCollections) {
|
||||
delete $scope.selectedCollections[id];
|
||||
}
|
||||
else {
|
||||
$scope.selectedSubvaults[id] = {
|
||||
subvaultId: id,
|
||||
$scope.selectedCollections[id] = {
|
||||
collectionId: id,
|
||||
readOnly: false
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
$scope.toggleSubvaultReadOnlySelection = function (id) {
|
||||
if (id in $scope.selectedSubvaults) {
|
||||
$scope.selectedSubvaults[id].readOnly = !!!$scope.selectedSubvaults[id].readOnly;
|
||||
$scope.toggleCollectionReadOnlySelection = function (id) {
|
||||
if (id in $scope.selectedCollections) {
|
||||
$scope.selectedCollections[id].readOnly = !!!$scope.selectedCollections[id].readOnly;
|
||||
}
|
||||
};
|
||||
|
||||
$scope.subvaultSelected = function (subvault) {
|
||||
return subvault.id in $scope.selectedSubvaults;
|
||||
$scope.collectionSelected = function (collection) {
|
||||
return collection.id in $scope.selectedCollections;
|
||||
};
|
||||
|
||||
$scope.allSelected = function () {
|
||||
return Object.keys($scope.selectedSubvaults).length === $scope.subvaults.length;
|
||||
return Object.keys($scope.selectedCollections).length === $scope.collections.length;
|
||||
};
|
||||
|
||||
$scope.submitPromise = null;
|
||||
$scope.submit = function (model) {
|
||||
var subvaults = [];
|
||||
var collections = [];
|
||||
|
||||
if (!model.accessAllSubvaults) {
|
||||
for (var subvaultId in $scope.selectedSubvaults) {
|
||||
if ($scope.selectedSubvaults.hasOwnProperty(subvaultId)) {
|
||||
subvaults.push($scope.selectedSubvaults[subvaultId]);
|
||||
if (!model.accessAllCollections) {
|
||||
for (var collectionId in $scope.selectedCollections) {
|
||||
if ($scope.selectedCollections.hasOwnProperty(collectionId)) {
|
||||
collections.push($scope.selectedCollections[collectionId]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -75,8 +75,8 @@
|
||||
$scope.submitPromise = apiService.organizationUsers.invite({ orgId: $state.params.orgId }, {
|
||||
email: model.email,
|
||||
type: model.type,
|
||||
subvaults: subvaults,
|
||||
accessAllSubvaults: model.accessAllSubvaults
|
||||
collections: collections,
|
||||
accessAllCollections: model.accessAllCollections
|
||||
}, function () {
|
||||
$analytics.eventTrack('Invited User');
|
||||
$uibModalInstance.close();
|
||||
|
||||
Reference in New Issue
Block a user