1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-18 17:23:37 +00:00

add edit variable to AC ciphers when the user has permissions

This commit is contained in:
Nick Krantz
2024-10-04 09:37:18 -05:00
parent e4b3f28165
commit 09d7fe2c75
2 changed files with 5 additions and 2 deletions

View File

@@ -26,6 +26,8 @@ describe("AdminConsoleCipherFormConfigService", () => {
beforeEach(async () => { beforeEach(async () => {
getCipherAdmin.mockClear(); getCipherAdmin.mockClear();
getCipher.mockClear(); getCipher.mockClear();
getCipher.mockResolvedValue({ id: cipherId, name: "Test Cipher - (non-admin)" });
getCipherAdmin.mockResolvedValue({ id: cipherId, name: "Test Cipher - (admin)" });
await TestBed.configureTestingModule({ await TestBed.configureTestingModule({
providers: [ providers: [
@@ -101,7 +103,6 @@ describe("AdminConsoleCipherFormConfigService", () => {
describe("getCipher", () => { describe("getCipher", () => {
it("retrieves the cipher from the cipher service", async () => { it("retrieves the cipher from the cipher service", async () => {
getCipher.mockResolvedValueOnce({ id: cipherId, name: "Test Cipher - (non-admin)" });
testOrg.canEditAllCiphers = false; testOrg.canEditAllCiphers = false;
adminConsoleConfigService = TestBed.inject(AdminConsoleCipherFormConfigService); adminConsoleConfigService = TestBed.inject(AdminConsoleCipherFormConfigService);
@@ -116,6 +117,7 @@ describe("AdminConsoleCipherFormConfigService", () => {
}); });
it("retrieves the cipher from the admin service", async () => { it("retrieves the cipher from the admin service", async () => {
getCipher.mockResolvedValueOnce(null);
getCipherAdmin.mockResolvedValue({ id: cipherId, name: "Test Cipher - (admin)" }); getCipherAdmin.mockResolvedValue({ id: cipherId, name: "Test Cipher - (admin)" });
adminConsoleConfigService = TestBed.inject(AdminConsoleCipherFormConfigService); adminConsoleConfigService = TestBed.inject(AdminConsoleCipherFormConfigService);

View File

@@ -98,8 +98,9 @@ export class AdminConsoleCipherFormConfigService implements CipherFormConfigServ
// Retrieve the cipher through the means of an admin // Retrieve the cipher through the means of an admin
const cipherResponse = await this.apiService.getCipherAdmin(id); const cipherResponse = await this.apiService.getCipherAdmin(id);
const cipherData = new CipherData(cipherResponse); cipherResponse.edit = true;
const cipherData = new CipherData(cipherResponse);
return new Cipher(cipherData); return new Cipher(cipherData);
} }
} }