Revert "[PM-11200] Move delete item permission to Can Manage (#10890)" (#11155)

* Revert "[PM-11200] Move delete item permission to Can Manage (#10890)"

This reverts commit 8921230b4f.

* Removed provider access
This commit is contained in:
SmithThe4th 2024-09-19 13:27:08 -04:00 committed by GitHub
parent 01e530d02b
commit 7ae427e713
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 8 additions and 38 deletions

View File

@ -157,7 +157,7 @@
</button> </button>
<button <button
bitMenuItem bitMenuItem
*ngIf="canManageCollection || !vaultBulkManagementActionEnabled" *ngIf="canEditCipher || !vaultBulkManagementActionEnabled"
(click)="deleteCipher()" (click)="deleteCipher()"
type="button" type="button"
> >

View File

@ -36,7 +36,6 @@ export class VaultCipherRowComponent implements OnInit {
@Input() viewingOrgVault: boolean; @Input() viewingOrgVault: boolean;
@Input() canEditCipher: boolean; @Input() canEditCipher: boolean;
@Input() vaultBulkManagementActionEnabled: boolean; @Input() vaultBulkManagementActionEnabled: boolean;
@Input() canManageCollection: boolean;
@Output() onEvent = new EventEmitter<VaultItemEvent>(); @Output() onEvent = new EventEmitter<VaultItemEvent>();

View File

@ -132,9 +132,6 @@
[collections]="allCollections" [collections]="allCollections"
[checked]="selection.isSelected(item)" [checked]="selection.isSelected(item)"
[canEditCipher]="canEditCipher(item.cipher) && vaultBulkManagementActionEnabled" [canEditCipher]="canEditCipher(item.cipher) && vaultBulkManagementActionEnabled"
[canManageCollection]="
canManageCollection(item.cipher) && vaultBulkManagementActionEnabled
"
[vaultBulkManagementActionEnabled]="vaultBulkManagementActionEnabled" [vaultBulkManagementActionEnabled]="vaultBulkManagementActionEnabled"
(checkedToggled)="selection.toggle(item)" (checkedToggled)="selection.toggle(item)"
(onEvent)="event($event)" (onEvent)="event($event)"

View File

@ -47,7 +47,6 @@ export class VaultItemsComponent {
@Input() addAccessStatus: number; @Input() addAccessStatus: number;
@Input() addAccessToggle: boolean; @Input() addAccessToggle: boolean;
@Input() vaultBulkManagementActionEnabled = false; @Input() vaultBulkManagementActionEnabled = false;
@Input() activeCollection: CollectionView | undefined;
private _ciphers?: CipherView[] = []; private _ciphers?: CipherView[] = [];
@Input() get ciphers(): CipherView[] { @Input() get ciphers(): CipherView[] {
@ -215,33 +214,6 @@ export class VaultItemsComponent {
return (organization.canEditAllCiphers && this.viewingOrgVault) || cipher.edit; return (organization.canEditAllCiphers && this.viewingOrgVault) || cipher.edit;
} }
protected canManageCollection(cipher: CipherView) {
if (cipher.organizationId == null) {
return true;
}
// Check for admin access in AC vault
if (this.showAdminActions) {
const organization = this.allOrganizations.find((o) => o.id === cipher.organizationId);
if (organization?.permissions.editAnyCollection) {
return true;
}
if (organization?.allowAdminAccessToAllCollectionItems && organization.isAdmin) {
return true;
}
}
if (this.activeCollection) {
return this.activeCollection.manage;
}
return this.allCollections
.filter((c) => cipher.collectionIds.includes(c.id))
.some((collection) => collection.manage);
}
private refreshItems() { private refreshItems() {
const collections: VaultItem[] = this.collections.map((collection) => ({ collection })); const collections: VaultItem[] = this.collections.map((collection) => ({ collection }));
const ciphers: VaultItem[] = this.ciphers.map((cipher) => ({ cipher })); const ciphers: VaultItem[] = this.ciphers.map((cipher) => ({ cipher }));
@ -317,16 +289,19 @@ export class VaultItemsComponent {
const hasPersonalItems = this.hasPersonalItems(); const hasPersonalItems = this.hasPersonalItems();
const uniqueCipherOrgIds = this.getUniqueOrganizationIds(); const uniqueCipherOrgIds = this.getUniqueOrganizationIds();
const organizations = Array.from(uniqueCipherOrgIds, (orgId) =>
this.allOrganizations.find((o) => o.id === orgId),
);
const canManageCollectionCiphers = this.selection.selected const canEditOrManageAllCiphers =
.filter((item) => item.cipher) organizations.length > 0 && organizations.every((org) => org?.canEditAllCiphers);
.every(({ cipher }) => this.canManageCollection(cipher));
const canDeleteCollections = this.selection.selected const canDeleteCollections = this.selection.selected
.filter((item) => item.collection) .filter((item) => item.collection)
.every((item) => item.collection && this.canDeleteCollection(item.collection)); .every((item) => item.collection && this.canDeleteCollection(item.collection));
const userCanDeleteAccess = canManageCollectionCiphers && canDeleteCollections; const userCanDeleteAccess =
(canEditOrManageAllCiphers || this.allCiphersHaveEditAccess()) && canDeleteCollections;
if ( if (
userCanDeleteAccess || userCanDeleteAccess ||

View File

@ -57,7 +57,6 @@
[showBulkAddToCollections]="vaultBulkManagementActionEnabled$ | async" [showBulkAddToCollections]="vaultBulkManagementActionEnabled$ | async"
(onEvent)="onVaultItemsEvent($event)" (onEvent)="onVaultItemsEvent($event)"
[vaultBulkManagementActionEnabled]="vaultBulkManagementActionEnabled$ | async" [vaultBulkManagementActionEnabled]="vaultBulkManagementActionEnabled$ | async"
[activeCollection]="selectedCollection?.node"
> >
</app-vault-items> </app-vault-items>
<div <div