mirror of
https://github.com/bitwarden/browser
synced 2025-12-15 07:43:35 +00:00
[AC- 2493] Restore and Delete Unassigned Items (#8983)
* updates added for single and bulk delete and restore items including unassigned and permissions for owners and custom users
This commit is contained in:
@@ -132,11 +132,7 @@ export abstract class CipherService {
|
||||
cipher: { id: string; revisionDate: string } | { id: string; revisionDate: string }[],
|
||||
) => Promise<any>;
|
||||
restoreWithServer: (id: string, asAdmin?: boolean) => Promise<any>;
|
||||
restoreManyWithServer: (
|
||||
ids: string[],
|
||||
organizationId?: string,
|
||||
asAdmin?: boolean,
|
||||
) => Promise<void>;
|
||||
restoreManyWithServer: (ids: string[], orgId?: string) => Promise<void>;
|
||||
getKeyForCipherKeyDecryption: (cipher: Cipher) => Promise<any>;
|
||||
setAddEditCipherInfo: (value: AddEditCipherInfo) => Promise<void>;
|
||||
}
|
||||
|
||||
@@ -126,6 +126,12 @@ export class CipherView implements View, InitializerMetadata {
|
||||
return this.item?.linkedFieldOptions;
|
||||
}
|
||||
|
||||
get isUnassigned(): boolean {
|
||||
return (
|
||||
this.organizationId != null && (this.collectionIds == null || this.collectionIds.length === 0)
|
||||
);
|
||||
}
|
||||
|
||||
linkedFieldValue(id: LinkedIdType) {
|
||||
const linkedFieldOption = this.linkedFieldOptions?.get(id);
|
||||
if (linkedFieldOption == null) {
|
||||
|
||||
@@ -1117,14 +1117,15 @@ export class CipherService implements CipherServiceAbstraction {
|
||||
await this.restore({ id: id, revisionDate: response.revisionDate });
|
||||
}
|
||||
|
||||
async restoreManyWithServer(
|
||||
ids: string[],
|
||||
organizationId: string = null,
|
||||
asAdmin = false,
|
||||
): Promise<void> {
|
||||
/**
|
||||
* No longer using an asAdmin Param. Org Vault bulkRestore will assess if an item is unassigned or editable
|
||||
* The Org Vault will pass those ids an array as well as the orgId when calling bulkRestore
|
||||
*/
|
||||
async restoreManyWithServer(ids: string[], orgId: string = null): Promise<void> {
|
||||
let response;
|
||||
if (asAdmin) {
|
||||
const request = new CipherBulkRestoreRequest(ids, organizationId);
|
||||
|
||||
if (orgId) {
|
||||
const request = new CipherBulkRestoreRequest(ids, orgId);
|
||||
response = await this.apiService.putRestoreManyCiphersAdmin(request);
|
||||
} else {
|
||||
const request = new CipherBulkRestoreRequest(ids);
|
||||
|
||||
Reference in New Issue
Block a user