mirror of
https://github.com/bitwarden/browser
synced 2025-12-18 09:13:33 +00:00
add edit variable to AC ciphers when the user has permissions
This commit is contained in:
@@ -26,6 +26,8 @@ describe("AdminConsoleCipherFormConfigService", () => {
|
||||
beforeEach(async () => {
|
||||
getCipherAdmin.mockClear();
|
||||
getCipher.mockClear();
|
||||
getCipher.mockResolvedValue({ id: cipherId, name: "Test Cipher - (non-admin)" });
|
||||
getCipherAdmin.mockResolvedValue({ id: cipherId, name: "Test Cipher - (admin)" });
|
||||
|
||||
await TestBed.configureTestingModule({
|
||||
providers: [
|
||||
@@ -101,7 +103,6 @@ describe("AdminConsoleCipherFormConfigService", () => {
|
||||
|
||||
describe("getCipher", () => {
|
||||
it("retrieves the cipher from the cipher service", async () => {
|
||||
getCipher.mockResolvedValueOnce({ id: cipherId, name: "Test Cipher - (non-admin)" });
|
||||
testOrg.canEditAllCiphers = false;
|
||||
|
||||
adminConsoleConfigService = TestBed.inject(AdminConsoleCipherFormConfigService);
|
||||
@@ -116,6 +117,7 @@ describe("AdminConsoleCipherFormConfigService", () => {
|
||||
});
|
||||
|
||||
it("retrieves the cipher from the admin service", async () => {
|
||||
getCipher.mockResolvedValueOnce(null);
|
||||
getCipherAdmin.mockResolvedValue({ id: cipherId, name: "Test Cipher - (admin)" });
|
||||
|
||||
adminConsoleConfigService = TestBed.inject(AdminConsoleCipherFormConfigService);
|
||||
|
||||
@@ -98,8 +98,9 @@ export class AdminConsoleCipherFormConfigService implements CipherFormConfigServ
|
||||
|
||||
// Retrieve the cipher through the means of an admin
|
||||
const cipherResponse = await this.apiService.getCipherAdmin(id);
|
||||
const cipherData = new CipherData(cipherResponse);
|
||||
cipherResponse.edit = true;
|
||||
|
||||
const cipherData = new CipherData(cipherResponse);
|
||||
return new Cipher(cipherData);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user