mirror of
https://github.com/bitwarden/browser
synced 2025-12-19 09:43:23 +00:00
[AC-1139] Deprecated Organization canEditAssignedCollections, canDeleteAssignedCollections, canViewAssignedCollections
This commit is contained in:
@@ -106,7 +106,7 @@ export class VaultItemsComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const organization = this.allOrganizations.find((o) => o.id === collection.organizationId);
|
const organization = this.allOrganizations.find((o) => o.id === collection.organizationId);
|
||||||
return collection.canEdit(organization);
|
return collection.canEdit(organization, this.flexibleCollectionsEnabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected canDeleteCollection(collection: CollectionView): boolean {
|
protected canDeleteCollection(collection: CollectionView): boolean {
|
||||||
|
|||||||
@@ -31,8 +31,12 @@ export class CollectionAdminView extends CollectionView {
|
|||||||
this.assigned = response.assigned;
|
this.assigned = response.assigned;
|
||||||
}
|
}
|
||||||
|
|
||||||
override canEdit(org: Organization): boolean {
|
override canEdit(org: Organization, flexibleCollectionsEnabled: boolean): boolean {
|
||||||
return org?.canEditAnyCollection || (org?.canEditAssignedCollections && this.assigned);
|
if (flexibleCollectionsEnabled) {
|
||||||
|
return org?.canEditAnyCollection;
|
||||||
|
} else {
|
||||||
|
return org?.canEditAnyCollection || (org?.canEditAssignedCollections && this.assigned);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override canDelete(org: Organization, flexibleCollectionsEnabled: boolean): boolean {
|
override canDelete(org: Organization, flexibleCollectionsEnabled: boolean): boolean {
|
||||||
|
|||||||
@@ -143,7 +143,7 @@ export class VaultHeaderComponent {
|
|||||||
const organization = this.organizations.find(
|
const organization = this.organizations.find(
|
||||||
(o) => o.id === this.collection?.node.organizationId
|
(o) => o.id === this.collection?.node.organizationId
|
||||||
);
|
);
|
||||||
return this.collection.node.canEdit(organization);
|
return this.collection.node.canEdit(organization, this.flexibleCollectionsEnabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
async editCollection(tab: CollectionDialogTabType): Promise<void> {
|
async editCollection(tab: CollectionDialogTabType): Promise<void> {
|
||||||
|
|||||||
@@ -152,7 +152,7 @@ export class VaultHeaderComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Otherwise, check if we can edit the specified collection
|
// Otherwise, check if we can edit the specified collection
|
||||||
return this.collection.node.canEdit(this.organization);
|
return this.collection.node.canEdit(this.organization, this.flexibleCollectionsEnabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
addCipher() {
|
addCipher() {
|
||||||
|
|||||||
@@ -184,14 +184,26 @@ export class Organization {
|
|||||||
return this.canEditAnyCollection || this.canDeleteAnyCollection;
|
return this.canEditAnyCollection || this.canDeleteAnyCollection;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated
|
||||||
|
* This is deprecated with the introduction of Flexible Collections.
|
||||||
|
*/
|
||||||
get canEditAssignedCollections() {
|
get canEditAssignedCollections() {
|
||||||
return this.isManager || this.permissions.editAssignedCollections;
|
return this.isManager || this.permissions.editAssignedCollections;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated
|
||||||
|
* This is deprecated with the introduction of Flexible Collections.
|
||||||
|
*/
|
||||||
get canDeleteAssignedCollections() {
|
get canDeleteAssignedCollections() {
|
||||||
return this.isManager || this.permissions.deleteAssignedCollections;
|
return this.isManager || this.permissions.deleteAssignedCollections;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated
|
||||||
|
* This is deprecated with the introduction of Flexible Collections.
|
||||||
|
*/
|
||||||
get canViewAssignedCollections() {
|
get canViewAssignedCollections() {
|
||||||
return this.canDeleteAssignedCollections || this.canEditAssignedCollections;
|
return this.canDeleteAssignedCollections || this.canEditAssignedCollections;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,13 +32,17 @@ export class CollectionView implements View, ITreeNodeObject {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// For editing collection details, not the items within it.
|
// For editing collection details, not the items within it.
|
||||||
canEdit(org: Organization): boolean {
|
canEdit(org: Organization, flexibleCollectionsEnabled: boolean): boolean {
|
||||||
if (org.id !== this.organizationId) {
|
if (org.id !== this.organizationId) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
"Id of the organization provided does not match the org id of the collection."
|
"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.
|
// For deleting a collection, not the items within it.
|
||||||
|
|||||||
Reference in New Issue
Block a user