1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-23 19:53:43 +00:00

[PM-2383] Bulk collection assignment (#8429)

* [PM-2383] Add bulkUpdateCollectionsWithServer method to CipherService

* [PM-2383] Introduce bulk-collection-assignment-dialog.component

* [PM-2383] Add bulk assign collections option to org vault
This commit is contained in:
Shane Melton
2024-03-22 13:16:29 -07:00
committed by GitHub
parent 905d177873
commit bac0874dc0
13 changed files with 443 additions and 2 deletions

View File

@@ -15,4 +15,5 @@ export type VaultItemEvent =
| { type: "delete"; items: VaultItem[] }
| { type: "copyField"; item: CipherView; field: "username" | "password" | "totp" }
| { type: "moveToFolder"; items: CipherView[] }
| { type: "moveToOrganization"; items: CipherView[] };
| { type: "moveToOrganization"; items: CipherView[] }
| { type: "assignToCollections"; items: CipherView[] };

View File

@@ -46,6 +46,15 @@
<i class="bwi bwi-fw bwi-users" aria-hidden="true"></i>
{{ "access" | i18n }}
</button>
<button
*ngIf="showAdminActions && bulkAssignToCollectionsAllowed"
type="button"
bitMenuItem
(click)="assignToCollections()"
>
<i class="bwi bwi-fw bwi-collection" aria-hidden="true"></i>
{{ "assignToCollections" | i18n }}
</button>
<button
*ngIf="bulkMoveAllowed"
type="button"

View File

@@ -42,6 +42,7 @@ export class VaultItemsComponent {
@Input() allCollections: CollectionView[] = [];
@Input() allGroups: GroupView[] = [];
@Input() showBulkEditCollectionAccess = false;
@Input() showBulkAddToCollections = false;
@Input() showPermissionsColumn = false;
@Input() viewingOrgVault: boolean;
@@ -89,6 +90,10 @@ export class VaultItemsComponent {
);
}
get bulkAssignToCollectionsAllowed() {
return this.ciphers.length > 0;
}
protected canEditCollection(collection: CollectionView): boolean {
// Only allow allow deletion if collection editing is enabled and not deleting "Unassigned"
if (collection.id === Unassigned) {
@@ -182,4 +187,13 @@ export class VaultItemsComponent {
.map((item) => item.collection),
});
}
protected assignToCollections() {
this.event({
type: "assignToCollections",
items: this.selection.selected
.filter((item) => item.cipher !== undefined)
.map((item) => item.cipher),
});
}
}