mirror of
https://github.com/bitwarden/browser
synced 2025-12-12 22:33:35 +00:00
[AC-2285] Edit Unassigned Ciphers in AC Bug (#8410)
* check if cipher is unassigned and call the proper service between cipherService get and apiService get. also check for custom user permissions
This commit is contained in:
@@ -105,8 +105,14 @@ export class AddEditComponent extends BaseAddEditComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected async loadCipher() {
|
protected async loadCipher() {
|
||||||
if (!this.organization.canEditAllCiphers(this.flexibleCollectionsV1Enabled)) {
|
// Calling loadCipher first to assess if the cipher is unassigned. If null use apiService getCipherAdmin
|
||||||
return await super.loadCipher();
|
const firstCipherCheck = await super.loadCipher();
|
||||||
|
|
||||||
|
if (
|
||||||
|
!this.organization.canEditAllCiphers(this.flexibleCollectionsV1Enabled) &&
|
||||||
|
firstCipherCheck != null
|
||||||
|
) {
|
||||||
|
return firstCipherCheck;
|
||||||
}
|
}
|
||||||
const response = await this.apiService.getCipherAdmin(this.cipherId);
|
const response = await this.apiService.getCipherAdmin(this.cipherId);
|
||||||
const data = new CipherData(response);
|
const data = new CipherData(response);
|
||||||
|
|||||||
@@ -650,11 +650,11 @@ export class AddEditComponent implements OnInit, OnDestroy {
|
|||||||
|
|
||||||
protected saveCipher(cipher: Cipher) {
|
protected saveCipher(cipher: Cipher) {
|
||||||
const isNotClone = this.editMode && !this.cloneMode;
|
const isNotClone = this.editMode && !this.cloneMode;
|
||||||
let orgAdmin = this.organization?.isAdmin;
|
let orgAdmin = this.organization?.canEditAllCiphers(this.flexibleCollectionsV1Enabled);
|
||||||
|
|
||||||
if (this.flexibleCollectionsV1Enabled) {
|
// if a cipher is unassigned we want to check if they are an admin or have permission to edit any collection
|
||||||
// Flexible Collections V1 restricts admins, check the organization setting via canEditAllCiphers
|
if (!cipher.collectionIds) {
|
||||||
orgAdmin = this.organization?.canEditAllCiphers(true);
|
orgAdmin = this.organization?.canEditAnyCollection;
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.cipher.id == null
|
return this.cipher.id == null
|
||||||
|
|||||||
@@ -1387,7 +1387,6 @@ export class CipherService implements CipherServiceAbstraction {
|
|||||||
cipher.attachments = attachments;
|
cipher.attachments = attachments;
|
||||||
}),
|
}),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return cipher;
|
return cipher;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user