1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-06-26 10:35:48 +02:00

[AC-2483] Added new Add Access UI to the collection dialog for AC (#9090)

* added new Add Access UI to the collection dialog for AC
This commit is contained in:
Jason Ng 2024-05-15 14:27:15 -04:00 committed by GitHub
parent 25f55e1368
commit db2f60b684
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 33 additions and 1 deletions

View File

@ -69,6 +69,13 @@
<span>{{ "readOnlyCollectionAccess" | i18n }}</span> <span>{{ "readOnlyCollectionAccess" | i18n }}</span>
</ng-container> </ng-container>
<ng-container *ngIf="!dialogReadonly"> <ng-container *ngIf="!dialogReadonly">
<bit-callout
title="{{ 'grantAddAccessCollectionWarningTitle' | i18n }}"
type="warning"
*ngIf="showAddAccessWarning"
>
{{ "grantAddAccessCollectionWarning" | i18n }}
</bit-callout>
<span *ngIf="organization.useGroups">{{ "grantCollectionAccess" | i18n }}</span> <span *ngIf="organization.useGroups">{{ "grantCollectionAccess" | i18n }}</span>
<span *ngIf="!organization.useGroups">{{ <span *ngIf="!organization.useGroups">{{
"grantCollectionAccessMembersOnly" | i18n "grantCollectionAccessMembersOnly" | i18n
@ -84,7 +91,10 @@
</div> </div>
<div <div
class="tw-mb-3 tw-text-danger" class="tw-mb-3 tw-text-danger"
*ngIf="formGroup.controls.access.hasError('managePermissionRequired')" *ngIf="
formGroup.controls.access.hasError('managePermissionRequired') &&
!showAddAccessWarning
"
> >
<i class="bwi bwi-error"></i> {{ "managePermissionRequired" | i18n }} <i class="bwi bwi-error"></i> {{ "managePermissionRequired" | i18n }}
</div> </div>

View File

@ -59,6 +59,7 @@ export interface CollectionDialogParams {
*/ */
limitNestedCollections?: boolean; limitNestedCollections?: boolean;
readonly?: boolean; readonly?: boolean;
isAddAccessCollection?: boolean;
} }
export interface CollectionDialogResult { export interface CollectionDialogResult {
@ -100,6 +101,7 @@ export class CollectionDialogComponent implements OnInit, OnDestroy {
}); });
protected PermissionMode = PermissionMode; protected PermissionMode = PermissionMode;
protected showDeleteButton = false; protected showDeleteButton = false;
protected showAddAccessWarning = false;
constructor( constructor(
@Inject(DIALOG_DATA) private params: CollectionDialogParams, @Inject(DIALOG_DATA) private params: CollectionDialogParams,
@ -251,6 +253,7 @@ export class CollectionDialogComponent implements OnInit, OnDestroy {
this.handleFormGroupReadonly(this.dialogReadonly); this.handleFormGroupReadonly(this.dialogReadonly);
this.loading = false; this.loading = false;
this.showAddAccessWarning = this.handleAddAccessWarning(flexibleCollectionsV1);
}, },
); );
} }
@ -362,6 +365,18 @@ export class CollectionDialogComponent implements OnInit, OnDestroy {
this.destroy$.complete(); this.destroy$.complete();
} }
private handleAddAccessWarning(flexibleCollectionsV1: boolean): boolean {
if (
flexibleCollectionsV1 &&
!this.organization?.allowAdminAccessToAllCollectionItems &&
this.params.isAddAccessCollection
) {
return true;
}
return false;
}
private handleFormGroupReadonly(readonly: boolean) { private handleFormGroupReadonly(readonly: boolean) {
if (readonly) { if (readonly) {
this.formGroup.controls.name.disable(); this.formGroup.controls.name.disable();

View File

@ -1222,6 +1222,7 @@ export class VaultComponent implements OnInit, OnDestroy {
organizationId: this.organization?.id, organizationId: this.organization?.id,
initialTab: tab, initialTab: tab,
readonly: readonly, readonly: readonly,
isAddAccessCollection: c.addAccess,
limitNestedCollections: !this.organization.canEditAnyCollection( limitNestedCollections: !this.organization.canEditAnyCollection(
this.flexibleCollectionsV1Enabled, this.flexibleCollectionsV1Enabled,
), ),

View File

@ -7635,6 +7635,12 @@
"readOnlyCollectionAccess": { "readOnlyCollectionAccess": {
"message": "You do not have access to manage this collection." "message": "You do not have access to manage this collection."
}, },
"grantAddAccessCollectionWarningTitle": {
"message": "Missing Can Manage Permissions"
},
"grantAddAccessCollectionWarning": {
"message": "Grant Can manage permissions to allow full collection management including deletion of collection."
},
"grantCollectionAccess": { "grantCollectionAccess": {
"message": "Grant groups or members access to this collection." "message": "Grant groups or members access to this collection."
}, },