[AC-1340] Fixed cipher restore for provider users by using the restore-admin endpoints (#5255)
This commit is contained in:
parent
315c4ffc76
commit
89c8c48cd4
|
@ -674,7 +674,8 @@ export class VaultComponent implements OnInit, OnDestroy {
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await this.cipherService.restoreWithServer(c.id);
|
const asAdmin = this.organization?.canEditAnyCollection;
|
||||||
|
await this.cipherService.restoreWithServer(c.id, asAdmin);
|
||||||
this.platformUtilsService.showToast("success", null, this.i18nService.t("restoredItem"));
|
this.platformUtilsService.showToast("success", null, this.i18nService.t("restoredItem"));
|
||||||
this.refresh();
|
this.refresh();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|
|
@ -610,7 +610,8 @@ export class AddEditComponent implements OnInit, OnDestroy {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected restoreCipher() {
|
protected restoreCipher() {
|
||||||
return this.cipherService.restoreWithServer(this.cipher.id);
|
const asAdmin = this.organization?.canEditAnyCollection;
|
||||||
|
return this.cipherService.restoreWithServer(this.cipher.id, asAdmin);
|
||||||
}
|
}
|
||||||
|
|
||||||
get defaultOwnerId(): string | null {
|
get defaultOwnerId(): string | null {
|
||||||
|
|
|
@ -75,6 +75,6 @@ export abstract class CipherService {
|
||||||
restore: (
|
restore: (
|
||||||
cipher: { id: string; revisionDate: string } | { id: string; revisionDate: string }[]
|
cipher: { id: string; revisionDate: string } | { id: string; revisionDate: string }[]
|
||||||
) => Promise<any>;
|
) => Promise<any>;
|
||||||
restoreWithServer: (id: string) => Promise<any>;
|
restoreWithServer: (id: string, asAdmin?: boolean) => Promise<any>;
|
||||||
restoreManyWithServer: (ids: string[]) => Promise<any>;
|
restoreManyWithServer: (ids: string[]) => Promise<any>;
|
||||||
}
|
}
|
||||||
|
|
|
@ -914,8 +914,10 @@ export class CipherService implements CipherServiceAbstraction {
|
||||||
await this.stateService.setEncryptedCiphers(ciphers);
|
await this.stateService.setEncryptedCiphers(ciphers);
|
||||||
}
|
}
|
||||||
|
|
||||||
async restoreWithServer(id: string): Promise<any> {
|
async restoreWithServer(id: string, asAdmin = false): Promise<any> {
|
||||||
const response = await this.apiService.putRestoreCipher(id);
|
const response = asAdmin
|
||||||
|
? await this.apiService.putRestoreCipherAdmin(id)
|
||||||
|
: await this.apiService.putRestoreCipher(id);
|
||||||
await this.restore({ id: id, revisionDate: response.revisionDate });
|
await this.restore({ id: id, revisionDate: response.revisionDate });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue