mirror of
https://github.com/bitwarden/browser
synced 2025-12-06 00:13:28 +00:00
[PM-13177] Fix Unassigned cipher collection assignment in AC (#11419)
* [PM-13177] Add saveCollectionsWithServerAdmin to CipherService * [PM-13177] Introduce isSingleCipherAdmin flag to AssignCollections component
This commit is contained in:
@@ -64,6 +64,15 @@ export interface CollectionAssignmentParams {
|
||||
* removed from the ciphers upon submission.
|
||||
*/
|
||||
activeCollection?: CollectionView;
|
||||
|
||||
/**
|
||||
* Flag indicating if the user is performing the action as an admin on a SINGLE cipher. When true,
|
||||
* the `/admin` endpoint will be used to update the cipher's collections. Required when updating
|
||||
* ciphers an Admin does not normally have access to or for Unassigned ciphers.
|
||||
*
|
||||
* The bulk method already handles admin actions internally.
|
||||
*/
|
||||
isSingleCipherAdmin?: boolean;
|
||||
}
|
||||
|
||||
export enum CollectionAssignmentResult {
|
||||
@@ -463,6 +472,10 @@ export class AssignCollectionsComponent implements OnInit, OnDestroy, AfterViewI
|
||||
const { collections } = this.formGroup.getRawValue();
|
||||
cipherView.collectionIds = collections.map((i) => i.id as CollectionId);
|
||||
const cipher = await this.cipherService.encrypt(cipherView, this.activeUserId);
|
||||
await this.cipherService.saveCollectionsWithServer(cipher);
|
||||
if (this.params.isSingleCipherAdmin) {
|
||||
await this.cipherService.saveCollectionsWithServerAdmin(cipher);
|
||||
} else {
|
||||
await this.cipherService.saveCollectionsWithServer(cipher);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user