Skip to content

Commit

Permalink
delete ciphers as an admin when they're unassigned
Browse files Browse the repository at this point in the history
  • Loading branch information
nick-livefront committed Nov 8, 2024
1 parent e91741b commit 4cf496e
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,14 @@ export class VaultItemDialogComponent implements OnInit, OnDestroy {
* Helper method to delete cipher.
*/
private async deleteCipher(): Promise<void> {
const asAdmin = this.organization?.canEditAllCiphers;
const cipherIsUnassigned =
!this.cipher.collectionIds || this.cipher.collectionIds?.length === 0;

// Delete the cipher as an admin when:
// - the organization allows for owners/admins to manage all collections/items
// - the cipher is unassigned
const asAdmin = this.organization?.canEditAllCiphers || cipherIsUnassigned;

if (this.cipher.isDeleted) {
await this.cipherService.deleteWithServer(this.cipher.id, asAdmin);
} else {
Expand Down

0 comments on commit 4cf496e

Please sign in to comment.