diff --git a/apps/web/src/app/vault/org-vault/add-edit.component.ts b/apps/web/src/app/vault/org-vault/add-edit.component.ts index cb879dfcc75..ba0c65b1070 100644 --- a/apps/web/src/app/vault/org-vault/add-edit.component.ts +++ b/apps/web/src/app/vault/org-vault/add-edit.component.ts @@ -105,8 +105,14 @@ export class AddEditComponent extends BaseAddEditComponent { } protected async loadCipher() { - if (!this.organization.canEditAllCiphers(this.flexibleCollectionsV1Enabled)) { - return await super.loadCipher(); + // Calling loadCipher first to assess if the cipher is unassigned. If null use apiService getCipherAdmin + const firstCipherCheck = await super.loadCipher(); + + if ( + !this.organization.canEditAllCiphers(this.flexibleCollectionsV1Enabled) && + firstCipherCheck != null + ) { + return firstCipherCheck; } const response = await this.apiService.getCipherAdmin(this.cipherId); const data = new CipherData(response); diff --git a/libs/angular/src/vault/components/add-edit.component.ts b/libs/angular/src/vault/components/add-edit.component.ts index 680672514a8..83131f8fc5b 100644 --- a/libs/angular/src/vault/components/add-edit.component.ts +++ b/libs/angular/src/vault/components/add-edit.component.ts @@ -650,11 +650,11 @@ export class AddEditComponent implements OnInit, OnDestroy { protected saveCipher(cipher: Cipher) { const isNotClone = this.editMode && !this.cloneMode; - let orgAdmin = this.organization?.isAdmin; + let orgAdmin = this.organization?.canEditAllCiphers(this.flexibleCollectionsV1Enabled); - if (this.flexibleCollectionsV1Enabled) { - // Flexible Collections V1 restricts admins, check the organization setting via canEditAllCiphers - orgAdmin = this.organization?.canEditAllCiphers(true); + // if a cipher is unassigned we want to check if they are an admin or have permission to edit any collection + if (!cipher.collectionIds) { + orgAdmin = this.organization?.canEditAnyCollection; } return this.cipher.id == null diff --git a/libs/common/src/vault/services/cipher.service.ts b/libs/common/src/vault/services/cipher.service.ts index 4293e56728c..829ee5ed4ee 100644 --- a/libs/common/src/vault/services/cipher.service.ts +++ b/libs/common/src/vault/services/cipher.service.ts @@ -1387,7 +1387,6 @@ export class CipherService implements CipherServiceAbstraction { cipher.attachments = attachments; }), ]); - return cipher; }