1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-21 02:33:46 +00:00

[PM-27083] Prevent collection nesting on import into a MyItems-collection (#16937)

* Prevent collection nesting on import into a my items collection

My Items collections do not support nested collections. The import source hierarchy needs to be flattened into the My Items collection

* Introduce new types for folder and collection relationship
Makes it easier to identify which position is for the cipherIndex and which is for the folder-/collection-index

* Fix assignment of ciphers to My items collection

* Remove unneeded type cast or assertions

* Add clarifying comment

---------

Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com>
This commit is contained in:
Daniel James Smith
2025-10-30 22:10:01 +01:00
committed by GitHub
parent 326cd40628
commit 2dd314e992
3 changed files with 69 additions and 17 deletions

View File

@@ -6,12 +6,15 @@ import { CollectionView } from "@bitwarden/admin-console/common";
import { CipherView } from "@bitwarden/common/vault/models/view/cipher.view";
import { FolderView } from "@bitwarden/common/vault/models/view/folder.view";
export type FolderRelationship = [cipherIndex: number, folderIndex: number];
export type CollectionRelationship = [cipherIndex: number, collectionIndex: number];
export class ImportResult {
success = false;
errorMessage: string;
ciphers: CipherView[] = [];
folders: FolderView[] = [];
folderRelationships: [number, number][] = [];
folderRelationships: FolderRelationship[] = [];
collections: CollectionView[] = [];
collectionRelationships: [number, number][] = [];
collectionRelationships: CollectionRelationship[] = [];
}