mirror of
https://github.com/bitwarden/web
synced 2025-12-10 13:23:15 +00:00
collection add/edit groups
This commit is contained in:
@@ -18,9 +18,12 @@
|
||||
};
|
||||
|
||||
var collections = {};
|
||||
if (group.CollectionIds) {
|
||||
for (var i = 0; i < group.CollectionIds.length; i++) {
|
||||
collections[group.CollectionIds[i]] = true;
|
||||
if (group.Collections) {
|
||||
for (var i = 0; i < group.Collections.length; i++) {
|
||||
collections[group.Collections[i].Id] = {
|
||||
id: group.Collections[i].Id,
|
||||
readOnly: group.Collections[i].ReadOnly
|
||||
};
|
||||
}
|
||||
}
|
||||
$scope.selectedCollections = collections;
|
||||
@@ -35,7 +38,11 @@
|
||||
var collections = {};
|
||||
if ($event.target.checked) {
|
||||
for (var i = 0; i < $scope.collections.length; i++) {
|
||||
collections[$scope.collections[i].id] = true;
|
||||
collections[$scope.collections[i].id] = {
|
||||
id: $scope.collections[i].id,
|
||||
readOnly: ($scope.collections[i].id in $scope.selectedCollections) ?
|
||||
$scope.selectedCollections[$scope.collections[i].id].readOnly : false
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,7 +54,16 @@
|
||||
delete $scope.selectedCollections[id];
|
||||
}
|
||||
else {
|
||||
$scope.selectedCollections[id] = true;
|
||||
$scope.selectedCollections[id] = {
|
||||
id: id,
|
||||
readOnly: false
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
$scope.toggleCollectionReadOnlySelection = function (id) {
|
||||
if (id in $scope.selectedCollections) {
|
||||
$scope.selectedCollections[id].readOnly = !!!$scope.selectedCollections[id].readOnly;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -66,10 +82,10 @@
|
||||
};
|
||||
|
||||
if (!group.accessAll) {
|
||||
group.collectionIds = [];
|
||||
for (var collId in $scope.selectedCollections) {
|
||||
if ($scope.selectedCollections.hasOwnProperty(collId)) {
|
||||
group.collectionIds.push(collId);
|
||||
group.collections = [];
|
||||
for (var collectionId in $scope.selectedCollections) {
|
||||
if ($scope.selectedCollections.hasOwnProperty(collectionId)) {
|
||||
group.collections.push($scope.selectedCollections[collectionId]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user