mirror of
https://github.com/bitwarden/browser.git
synced 2024-12-21 16:18:28 +01:00
[AC-2610] [AC-2613] Fix copy in members and groups dialogs (#9200)
* Add missing copy to member dialog * [AC-2613] Fix copy for providers in Collections tabs
This commit is contained in:
parent
aa0627fa38
commit
121494fb2e
@ -33,7 +33,7 @@
|
||||
<bit-tab label="{{ 'members' | i18n }}">
|
||||
<p>
|
||||
{{ "editGroupMembersDesc" | i18n }}
|
||||
<span *ngIf="restrictGroupAccess$ | async">
|
||||
<span *ngIf="cannotAddSelfToGroup$ | async">
|
||||
{{ "restrictedGroupAccessDesc" | i18n }}
|
||||
</span>
|
||||
</p>
|
||||
@ -52,8 +52,8 @@
|
||||
<bit-tab label="{{ 'collections' | i18n }}">
|
||||
<p>
|
||||
{{ "editGroupCollectionsDesc" | i18n }}
|
||||
<span *ngIf="!(allowAdminAccessToAllCollectionItems$ | async)">
|
||||
{{ "editGroupCollectionsRestrictionsDesc" | i18n }}
|
||||
<span *ngIf="!(canEditAnyCollection$ | async)">
|
||||
{{ "restrictedCollectionAssignmentDesc" | i18n }}
|
||||
</span>
|
||||
</p>
|
||||
<div *ngIf="!(flexibleCollectionsEnabled$ | async)" class="tw-my-3">
|
||||
|
@ -183,7 +183,7 @@ export class GroupAddEditComponent implements OnInit, OnDestroy {
|
||||
shareReplay({ refCount: true, bufferSize: 1 }),
|
||||
);
|
||||
|
||||
allowAdminAccessToAllCollectionItems$ = combineLatest([
|
||||
protected allowAdminAccessToAllCollectionItems$ = combineLatest([
|
||||
this.organization$,
|
||||
this.flexibleCollectionsV1Enabled$,
|
||||
]).pipe(
|
||||
@ -196,7 +196,16 @@ export class GroupAddEditComponent implements OnInit, OnDestroy {
|
||||
}),
|
||||
);
|
||||
|
||||
restrictGroupAccess$ = combineLatest([
|
||||
protected canEditAnyCollection$ = combineLatest([
|
||||
this.organization$,
|
||||
this.flexibleCollectionsV1Enabled$,
|
||||
]).pipe(
|
||||
map(([org, flexibleCollectionsV1Enabled]) =>
|
||||
org.canEditAnyCollection(flexibleCollectionsV1Enabled),
|
||||
),
|
||||
);
|
||||
|
||||
protected cannotAddSelfToGroup$ = combineLatest([
|
||||
this.allowAdminAccessToAllCollectionItems$,
|
||||
this.groupDetails$,
|
||||
]).pipe(map(([allowAdminAccess, groupDetails]) => !allowAdminAccess && groupDetails != null));
|
||||
@ -229,7 +238,7 @@ export class GroupAddEditComponent implements OnInit, OnDestroy {
|
||||
this.orgCollections$,
|
||||
this.orgMembers$,
|
||||
this.groupDetails$,
|
||||
this.restrictGroupAccess$,
|
||||
this.cannotAddSelfToGroup$,
|
||||
this.accountService.activeAccount$,
|
||||
this.organization$,
|
||||
this.flexibleCollectionsV1Enabled$,
|
||||
|
@ -405,7 +405,7 @@
|
||||
<bit-tab *ngIf="organization.useGroups" [label]="'groups' | i18n">
|
||||
<div class="tw-mb-6">
|
||||
{{
|
||||
(restrictedAccess$ | async)
|
||||
(restrictEditingSelf$ | async)
|
||||
? ("restrictedGroupAccess" | i18n)
|
||||
: ("groupAccessUserDesc" | i18n)
|
||||
}}
|
||||
@ -417,15 +417,18 @@
|
||||
[selectorLabelText]="'selectGroups' | i18n"
|
||||
[emptySelectionText]="'noGroupsAdded' | i18n"
|
||||
[flexibleCollectionsEnabled]="organization.flexibleCollections"
|
||||
[hideMultiSelect]="restrictedAccess$ | async"
|
||||
[hideMultiSelect]="restrictEditingSelf$ | async"
|
||||
></bit-access-selector>
|
||||
</bit-tab>
|
||||
<bit-tab [label]="'collections' | i18n">
|
||||
<div class="tw-mb-6" *ngIf="restrictedAccess$ | async">
|
||||
{{ "restrictedCollectionAccess" | i18n }}
|
||||
<div class="tw-mb-6" *ngIf="restrictEditingSelf$ | async">
|
||||
{{ "cannotAddYourselfToCollections" | i18n }}
|
||||
</div>
|
||||
<div *ngIf="organization.useGroups && !(restrictedAccess$ | async)" class="tw-mb-6">
|
||||
{{ "userPermissionOverrideHelper" | i18n }}
|
||||
<div *ngIf="organization.useGroups && !(restrictEditingSelf$ | async)" class="tw-mb-6">
|
||||
{{ "userPermissionOverrideHelperDesc" | i18n }}
|
||||
<span *ngIf="!(canEditAnyCollection$ | async)">
|
||||
{{ "restrictedCollectionAssignmentDesc" | i18n }}
|
||||
</span>
|
||||
</div>
|
||||
<div *ngIf="!organization.flexibleCollections" class="tw-mb-6">
|
||||
<bit-form-control>
|
||||
@ -454,7 +457,7 @@
|
||||
[selectorLabelText]="'selectCollections' | i18n"
|
||||
[emptySelectionText]="'noCollectionsAdded' | i18n"
|
||||
[flexibleCollectionsEnabled]="organization.flexibleCollections"
|
||||
[hideMultiSelect]="restrictedAccess$ | async"
|
||||
[hideMultiSelect]="restrictEditingSelf$ | async"
|
||||
></bit-access-selector
|
||||
></bit-tab>
|
||||
</bit-tab-group>
|
||||
|
@ -105,7 +105,9 @@ export class MemberDialogComponent implements OnDestroy {
|
||||
groups: [[] as AccessItemValue[]],
|
||||
});
|
||||
|
||||
protected restrictedAccess$: Observable<boolean>;
|
||||
protected allowAdminAccessToAllCollectionItems$: Observable<boolean>;
|
||||
protected restrictEditingSelf$: Observable<boolean>;
|
||||
protected canEditAnyCollection$: Observable<boolean>;
|
||||
|
||||
protected permissionsGroup = this.formBuilder.group({
|
||||
manageAssignedCollectionsGroup: this.formBuilder.group<Record<string, boolean>>({
|
||||
@ -182,43 +184,59 @@ export class MemberDialogComponent implements OnDestroy {
|
||||
? this.userService.get(this.params.organizationId, this.params.organizationUserId)
|
||||
: of(null);
|
||||
|
||||
// The orgUser cannot manage their own Group assignments if collection access is restricted
|
||||
// TODO: fix disabled state of access-selector rows so that any controls are hidden
|
||||
this.restrictedAccess$ = combineLatest([
|
||||
this.allowAdminAccessToAllCollectionItems$ = combineLatest([
|
||||
this.organization$,
|
||||
userDetails$,
|
||||
this.accountService.activeAccount$,
|
||||
this.configService.getFeatureFlag$(FeatureFlag.FlexibleCollectionsV1),
|
||||
]).pipe(
|
||||
map(([organization, flexibleCollectionsV1Enabled]) => {
|
||||
if (!flexibleCollectionsV1Enabled || !organization.flexibleCollections) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return organization.allowAdminAccessToAllCollectionItems;
|
||||
}),
|
||||
);
|
||||
|
||||
// The orgUser cannot manage their own Group assignments if collection access is restricted
|
||||
this.restrictEditingSelf$ = combineLatest([
|
||||
this.allowAdminAccessToAllCollectionItems$,
|
||||
userDetails$,
|
||||
this.accountService.activeAccount$,
|
||||
]).pipe(
|
||||
map(
|
||||
([organization, userDetails, activeAccount, flexibleCollectionsV1Enabled]) =>
|
||||
// Feature flag conditionals
|
||||
flexibleCollectionsV1Enabled &&
|
||||
organization.flexibleCollections &&
|
||||
// Business logic conditionals
|
||||
userDetails != null &&
|
||||
userDetails.userId == activeAccount.id &&
|
||||
!organization.allowAdminAccessToAllCollectionItems,
|
||||
([allowAdminAccess, userDetails, activeAccount]) =>
|
||||
!allowAdminAccess && userDetails != null && userDetails.userId == activeAccount.id,
|
||||
),
|
||||
shareReplay({ refCount: true, bufferSize: 1 }),
|
||||
);
|
||||
|
||||
this.restrictedAccess$.pipe(takeUntil(this.destroy$)).subscribe((restrictedAccess) => {
|
||||
if (restrictedAccess) {
|
||||
this.restrictEditingSelf$.pipe(takeUntil(this.destroy$)).subscribe((restrictEditingSelf) => {
|
||||
if (restrictEditingSelf) {
|
||||
this.formGroup.controls.groups.disable();
|
||||
} else {
|
||||
this.formGroup.controls.groups.enable();
|
||||
}
|
||||
});
|
||||
|
||||
const flexibleCollectionsV1Enabled$ = this.configService.getFeatureFlag$(
|
||||
FeatureFlag.FlexibleCollectionsV1,
|
||||
);
|
||||
|
||||
this.canEditAnyCollection$ = combineLatest([
|
||||
this.organization$,
|
||||
flexibleCollectionsV1Enabled$,
|
||||
]).pipe(
|
||||
map(([org, flexibleCollectionsV1Enabled]) =>
|
||||
org.canEditAnyCollection(flexibleCollectionsV1Enabled),
|
||||
),
|
||||
);
|
||||
|
||||
combineLatest({
|
||||
organization: this.organization$,
|
||||
collections: this.collectionAdminService.getAll(this.params.organizationId),
|
||||
userDetails: userDetails$,
|
||||
groups: groups$,
|
||||
flexibleCollectionsV1Enabled: this.configService.getFeatureFlag$(
|
||||
FeatureFlag.FlexibleCollectionsV1,
|
||||
),
|
||||
flexibleCollectionsV1Enabled: flexibleCollectionsV1Enabled$,
|
||||
})
|
||||
.pipe(takeUntil(this.destroy$))
|
||||
.subscribe(
|
||||
@ -454,7 +472,7 @@ export class MemberDialogComponent implements OnDestroy {
|
||||
.filter((v) => v.type === AccessItemType.Collection)
|
||||
.map(convertToSelectionView);
|
||||
|
||||
userView.groups = (await firstValueFrom(this.restrictedAccess$))
|
||||
userView.groups = (await firstValueFrom(this.restrictEditingSelf$))
|
||||
? null
|
||||
: this.formGroup.value.groups.map((m) => m.id);
|
||||
|
||||
|
@ -105,7 +105,7 @@
|
||||
[items]="accessItems"
|
||||
[columnHeader]="'groupSlashMemberColumnHeader' | i18n"
|
||||
[selectorLabelText]="'selectGroupsAndMembers' | i18n"
|
||||
[selectorHelpText]="'userPermissionOverrideHelper' | i18n"
|
||||
[selectorHelpText]="'userPermissionOverrideHelperDesc' | i18n"
|
||||
[emptySelectionText]="'noMembersOrGroupsAdded' | i18n"
|
||||
[flexibleCollectionsEnabled]="organization.flexibleCollections"
|
||||
></bit-access-selector>
|
||||
|
@ -15,7 +15,7 @@
|
||||
[items]="accessItems"
|
||||
[columnHeader]="'groupSlashMemberColumnHeader' | i18n"
|
||||
[selectorLabelText]="'selectGroupsAndMembers' | i18n"
|
||||
[selectorHelpText]="'userPermissionOverrideHelper' | i18n"
|
||||
[selectorHelpText]="'userPermissionOverrideHelperDesc' | i18n"
|
||||
[emptySelectionText]="'noMembersOrGroupsAdded' | i18n"
|
||||
[flexibleCollectionsEnabled]="flexibleCollectionsEnabled$ | async"
|
||||
></bit-access-selector>
|
||||
|
@ -6588,7 +6588,7 @@
|
||||
"editGroupCollectionsDesc": {
|
||||
"message": "Grant access to collections by adding them to this group."
|
||||
},
|
||||
"editGroupCollectionsRestrictionsDesc": {
|
||||
"restrictedCollectionAssignmentDesc": {
|
||||
"message": "You can only assign collections you manage."
|
||||
},
|
||||
"accessAllCollectionsDesc": {
|
||||
@ -6822,8 +6822,8 @@
|
||||
"selectGroups": {
|
||||
"message": "Select groups"
|
||||
},
|
||||
"userPermissionOverrideHelper": {
|
||||
"message": "Permissions set for a member will replace permissions set by that member's group"
|
||||
"userPermissionOverrideHelperDesc": {
|
||||
"message": "Permissions set for a member will replace permissions set by that member's group."
|
||||
},
|
||||
"noMembersOrGroupsAdded": {
|
||||
"message": "No members or groups added"
|
||||
@ -7749,7 +7749,7 @@
|
||||
"restrictedGroupAccess": {
|
||||
"message": "You cannot add yourself to groups."
|
||||
},
|
||||
"restrictedCollectionAccess": {
|
||||
"cannotAddYourselfToCollections": {
|
||||
"message": "You cannot add yourself to collections."
|
||||
},
|
||||
"assign": {
|
||||
|
Loading…
Reference in New Issue
Block a user