1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-22 11:13:46 +00:00

[AC-1139] Deprecated Organization canEditAssignedCollections, canDeleteAssignedCollections, canViewAssignedCollections

This commit is contained in:
Rui Tome
2023-11-16 14:48:30 +00:00
parent ca1ef99054
commit 7ce712aa7c
6 changed files with 27 additions and 7 deletions

View File

@@ -184,14 +184,26 @@ export class Organization {
return this.canEditAnyCollection || this.canDeleteAnyCollection;
}
/**
* @deprecated
* This is deprecated with the introduction of Flexible Collections.
*/
get canEditAssignedCollections() {
return this.isManager || this.permissions.editAssignedCollections;
}
/**
* @deprecated
* This is deprecated with the introduction of Flexible Collections.
*/
get canDeleteAssignedCollections() {
return this.isManager || this.permissions.deleteAssignedCollections;
}
/**
* @deprecated
* This is deprecated with the introduction of Flexible Collections.
*/
get canViewAssignedCollections() {
return this.canDeleteAssignedCollections || this.canEditAssignedCollections;
}

View File

@@ -32,13 +32,17 @@ export class CollectionView implements View, ITreeNodeObject {
}
// For editing collection details, not the items within it.
canEdit(org: Organization): boolean {
canEdit(org: Organization, flexibleCollectionsEnabled: boolean): boolean {
if (org.id !== this.organizationId) {
throw new Error(
"Id of the organization provided does not match the org id of the collection."
);
}
return org?.canEditAnyCollection || org?.canEditAssignedCollections;
if (flexibleCollectionsEnabled) {
return org?.canEditAnyCollection || this.manage;
} else {
return org?.canEditAnyCollection || org?.canEditAssignedCollections;
}
}
// For deleting a collection, not the items within it.