[AC-2703] Fix copy in members and groups modals for custom users (#9408)

* Fix copy in members and groups modals for custom users

* Fix nesting in member dialog template
This commit is contained in:
Thomas Rittson 2024-05-30 10:49:32 +10:00 committed by GitHub
parent df193dd869
commit fb7273beb8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 29 additions and 11 deletions

View File

@ -52,7 +52,7 @@
<bit-tab label="{{ 'collections' | i18n }}">
<p>
{{ "editGroupCollectionsDesc" | i18n }}
<span *ngIf="!(canEditAnyCollection$ | async)">
<span *ngIf="!(canAssignAccessToAnyCollection$ | async)">
{{ "restrictedCollectionAssignmentDesc" | i18n }}
</span>
</p>

View File

@ -196,12 +196,17 @@ export class GroupAddEditComponent implements OnInit, OnDestroy {
}),
);
protected canEditAnyCollection$ = combineLatest([
protected canAssignAccessToAnyCollection$ = combineLatest([
this.organization$,
this.flexibleCollectionsV1Enabled$,
this.allowAdminAccessToAllCollectionItems$,
]).pipe(
map(([org, flexibleCollectionsV1Enabled]) =>
org.canEditAnyCollection(flexibleCollectionsV1Enabled),
map(
([org, flexibleCollectionsV1Enabled, allowAdminAccessToAllCollectionItems]) =>
org.canEditAnyCollection(flexibleCollectionsV1Enabled) ||
// Manage Groups custom permission cannot edit any collection but they can assign access from this dialog
// if permitted by collection management settings
(org.permissions.manageGroups && allowAdminAccessToAllCollectionItems),
),
);

View File

@ -278,9 +278,17 @@
<div class="tw-mb-6" *ngIf="restrictEditingSelf$ | async">
{{ "cannotAddYourselfToCollections" | i18n }}
</div>
<div *ngIf="organization.useGroups && !(restrictEditingSelf$ | async)" class="tw-mb-6">
{{ "userPermissionOverrideHelperDesc" | i18n }}
<span *ngIf="!(canEditAnyCollection$ | async)">
<div
*ngIf="
!(restrictEditingSelf$ | async) &&
(organization.useGroups || !(canAssignAccessToAnyCollection$ | async))
"
class="tw-mb-6"
>
<span *ngIf="organization.useGroups">
{{ "userPermissionOverrideHelperDesc" | i18n }}
</span>
<span *ngIf="!(canAssignAccessToAnyCollection$ | async)">
{{ "restrictedCollectionAssignmentDesc" | i18n }}
</span>
</div>

View File

@ -107,7 +107,7 @@ export class MemberDialogComponent implements OnDestroy {
protected allowAdminAccessToAllCollectionItems$: Observable<boolean>;
protected restrictEditingSelf$: Observable<boolean>;
protected canEditAnyCollection$: Observable<boolean>;
protected canAssignAccessToAnyCollection$: Observable<boolean>;
protected permissionsGroup = this.formBuilder.group({
manageAssignedCollectionsGroup: this.formBuilder.group<Record<string, boolean>>({
@ -222,12 +222,17 @@ export class MemberDialogComponent implements OnDestroy {
FeatureFlag.FlexibleCollectionsV1,
);
this.canEditAnyCollection$ = combineLatest([
this.canAssignAccessToAnyCollection$ = combineLatest([
this.organization$,
flexibleCollectionsV1Enabled$,
this.allowAdminAccessToAllCollectionItems$,
]).pipe(
map(([org, flexibleCollectionsV1Enabled]) =>
org.canEditAnyCollection(flexibleCollectionsV1Enabled),
map(
([org, flexibleCollectionsV1Enabled, allowAdminAccessToAllCollectionItems]) =>
org.canEditAnyCollection(flexibleCollectionsV1Enabled) ||
// Manage Users custom permission cannot edit any collection but they can assign access from this dialog
// if permitted by collection management settings
(org.permissions.manageUsers && allowAdminAccessToAllCollectionItems),
),
);