[AC-1389] update collection dialog copy based on admin access setting (#7137)
* update collection dialog access copy based on allowAdminAccessToAllCollectionItems setting * remove requirement to have a Can Manage user if v1 flag is off or admins have access to all collections --------- Co-authored-by: Thomas Rittson <trittson@bitwarden.com>
This commit is contained in:
parent
92f593df08
commit
1a38bec901
|
@ -64,6 +64,12 @@
|
||||||
</bit-form-field>
|
</bit-form-field>
|
||||||
</bit-tab>
|
</bit-tab>
|
||||||
<bit-tab label="{{ 'access' | i18n }}">
|
<bit-tab label="{{ 'access' | i18n }}">
|
||||||
|
<div class="tw-mb-3" *ngIf="flexibleCollectionsV1Enabled$ | async">
|
||||||
|
{{ "grantCollectionAccess" | i18n }}
|
||||||
|
<span *ngIf="organization.allowAdminAccessToAllCollectionItems">{{
|
||||||
|
" " + ("adminCollectionAccess" | i18n)
|
||||||
|
}}</span>
|
||||||
|
</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')"
|
||||||
|
|
|
@ -3,7 +3,6 @@ import { ChangeDetectorRef, Component, Inject, OnDestroy, OnInit } from "@angula
|
||||||
import { AbstractControl, FormBuilder, Validators } from "@angular/forms";
|
import { AbstractControl, FormBuilder, Validators } from "@angular/forms";
|
||||||
import {
|
import {
|
||||||
combineLatest,
|
combineLatest,
|
||||||
firstValueFrom,
|
|
||||||
from,
|
from,
|
||||||
map,
|
map,
|
||||||
Observable,
|
Observable,
|
||||||
|
@ -75,6 +74,11 @@ export class CollectionDialogComponent implements OnInit, OnDestroy {
|
||||||
false,
|
false,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
protected flexibleCollectionsV1Enabled$ = this.configService.getFeatureFlag$(
|
||||||
|
FeatureFlag.FlexibleCollectionsV1,
|
||||||
|
false,
|
||||||
|
);
|
||||||
|
|
||||||
private destroy$ = new Subject<void>();
|
private destroy$ = new Subject<void>();
|
||||||
protected organizations$: Observable<Organization[]>;
|
protected organizations$: Observable<Organization[]>;
|
||||||
|
|
||||||
|
@ -134,10 +138,6 @@ export class CollectionDialogComponent implements OnInit, OnDestroy {
|
||||||
this.formGroup.patchValue({ selectedOrg: this.params.organizationId });
|
this.formGroup.patchValue({ selectedOrg: this.params.organizationId });
|
||||||
await this.loadOrg(this.params.organizationId, this.params.collectionIds);
|
await this.loadOrg(this.params.organizationId, this.params.collectionIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (await firstValueFrom(this.flexibleCollectionsEnabled$)) {
|
|
||||||
this.formGroup.controls.access.addValidators(validateCanManagePermission);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async loadOrg(orgId: string, collectionIds: string[]) {
|
async loadOrg(orgId: string, collectionIds: string[]) {
|
||||||
|
@ -162,10 +162,19 @@ export class CollectionDialogComponent implements OnInit, OnDestroy {
|
||||||
groups: groups$,
|
groups: groups$,
|
||||||
users: this.organizationUserService.getAllUsers(orgId),
|
users: this.organizationUserService.getAllUsers(orgId),
|
||||||
flexibleCollections: this.flexibleCollectionsEnabled$,
|
flexibleCollections: this.flexibleCollectionsEnabled$,
|
||||||
|
flexibleCollectionsV1: this.flexibleCollectionsV1Enabled$,
|
||||||
})
|
})
|
||||||
.pipe(takeUntil(this.formGroup.controls.selectedOrg.valueChanges), takeUntil(this.destroy$))
|
.pipe(takeUntil(this.formGroup.controls.selectedOrg.valueChanges), takeUntil(this.destroy$))
|
||||||
.subscribe(
|
.subscribe(
|
||||||
({ organization, collections, collectionDetails, groups, users, flexibleCollections }) => {
|
({
|
||||||
|
organization,
|
||||||
|
collections,
|
||||||
|
collectionDetails,
|
||||||
|
groups,
|
||||||
|
users,
|
||||||
|
flexibleCollections,
|
||||||
|
flexibleCollectionsV1,
|
||||||
|
}) => {
|
||||||
this.organization = organization;
|
this.organization = organization;
|
||||||
this.accessItems = [].concat(
|
this.accessItems = [].concat(
|
||||||
groups.map(mapGroupToAccessItemView),
|
groups.map(mapGroupToAccessItemView),
|
||||||
|
@ -223,6 +232,13 @@ export class CollectionDialogComponent implements OnInit, OnDestroy {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (flexibleCollectionsV1 && !organization.allowAdminAccessToAllCollectionItems) {
|
||||||
|
this.formGroup.controls.access.addValidators(validateCanManagePermission);
|
||||||
|
} else {
|
||||||
|
this.formGroup.controls.access.removeValidators(validateCanManagePermission);
|
||||||
|
}
|
||||||
|
this.formGroup.controls.access.updateValueAndValidity();
|
||||||
|
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
|
@ -7447,6 +7447,12 @@
|
||||||
"collectionAccessRestricted": {
|
"collectionAccessRestricted": {
|
||||||
"message": "Collection access is restricted"
|
"message": "Collection access is restricted"
|
||||||
},
|
},
|
||||||
|
"grantCollectionAccess": {
|
||||||
|
"message": "Grant groups or members access to this collection."
|
||||||
|
},
|
||||||
|
"adminCollectionAccess": {
|
||||||
|
"message": "Administrators can access and manage collections."
|
||||||
|
},
|
||||||
"serviceAccountAccessUpdated": {
|
"serviceAccountAccessUpdated": {
|
||||||
"message": "Service account access updated"
|
"message": "Service account access updated"
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue