only show selected collection that are writeable
This commit is contained in:
parent
63033ca12d
commit
465304b004
|
@ -24,28 +24,34 @@
|
|||
var collections = {};
|
||||
if (cipher.CollectionIds) {
|
||||
for (var i = 0; i < cipher.CollectionIds.length; i++) {
|
||||
collections[cipher.CollectionIds[i]] = true;
|
||||
collections[cipher.CollectionIds[i]] = null;
|
||||
}
|
||||
}
|
||||
$scope.selectedCollections = collections;
|
||||
|
||||
return cipher;
|
||||
return {
|
||||
cipher: cipher,
|
||||
cipherCollections: collections
|
||||
};
|
||||
}
|
||||
|
||||
return null;
|
||||
}).then(function (cipher) {
|
||||
if (!cipher) {
|
||||
}).then(function (cipherAndCols) {
|
||||
if (!cipherAndCols) {
|
||||
$scope.loadingCollections = false;
|
||||
return;
|
||||
}
|
||||
|
||||
apiService.collections.listMe({ writeOnly: true }, function (response) {
|
||||
var collections = [];
|
||||
var selectedCollections = {};
|
||||
|
||||
for (var i = 0; i < response.Data.length; i++) {
|
||||
if (response.Data[i].OrganizationId !== cipher.OrganizationId || response.Data[i].ReadOnly) {
|
||||
if (response.Data[i].Id in $scope.selectedCollections) {
|
||||
delete $scope.selectedCollections[response.Data[i].Id];
|
||||
}
|
||||
// clean out selectCollections that aren't from this organization or read only
|
||||
if (response.Data[i].Id in cipherAndCols.cipherCollections &&
|
||||
response.Data[i].OrganizationId === cipherAndCols.cipher.OrganizationId) {
|
||||
selectedCollections[response.Data[i].Id] = true;
|
||||
}
|
||||
else {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -55,6 +61,7 @@
|
|||
|
||||
$scope.loadingCollections = false;
|
||||
$scope.collections = collections;
|
||||
$scope.selectedCollections = selectedCollections;
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -54,10 +54,6 @@
|
|||
apiService.collections.listMe({ writeOnly: true }, function (response) {
|
||||
var collections = [];
|
||||
for (var i = 0; i < response.Data.length; i++) {
|
||||
if (response.Data[i].ReadOnly) {
|
||||
continue;
|
||||
}
|
||||
|
||||
var decCollection = cipherService.decryptCollection(response.Data[i]);
|
||||
decCollection.organizationId = response.Data[i].OrganizationId;
|
||||
collections.push(decCollection);
|
||||
|
@ -74,8 +70,7 @@
|
|||
var collections = {};
|
||||
if ($event.target.checked) {
|
||||
for (var i = 0; i < $scope.collections.length; i++) {
|
||||
if ($scope.model.organizationId && $scope.collections[i].organizationId === $scope.model.organizationId &&
|
||||
!$scope.collections[i].readOnly) {
|
||||
if ($scope.model.organizationId && $scope.collections[i].organizationId === $scope.model.organizationId) {
|
||||
collections[$scope.collections[i].id] = true;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue