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