Browse Source

Fixed customer entity groups missing from the "Assign entity groups to edge" dialog when a customer-owned edge is opened from Edge management (#16857)

* fix(ui): list edge owner's groups in "Assign entity groups to edge" dialog

The dialog listed groups of the current user's owner unless the route had a customerId, so a tenant admin opening a customer-owned edge from Edge management could not assign that customer's groups. Use the edge owner resolved with the edge instead.

Fixes #16853

* fix(ui): use the edge owner in "Assign entity groups to edge" only for tenant admins

For a customer user the edge owner can be outside their owner chain (an edge shared from the tenant or a parent customer). /entityGroupInfosHierarchy then returns 403 and the dialog shows an empty list. Customer users keep listing their own groups, as before.
pull/16870/head
Volodymyr Babak 2 days ago
committed by GitHub
parent
commit
244c3ab42e
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 1
      ui-ngx/src/app/modules/home/components/group/entity-groups-table-config.resolver.ts
  2. 10
      ui-ngx/src/app/modules/home/components/group/entity-groups-table-config.ts

1
ui-ngx/src/app/modules/home/components/group/entity-groups-table-config.resolver.ts

@ -114,6 +114,7 @@ export class EntityGroupsTableConfigResolver {
return this.edgeService.getEdge(config.edgeId).pipe(
map((info) => {
config.tableTitle = info.name + ': ' + this.translate.instant(entityGroupsTitle(config.groupType));
config.edgeOwnerId = info.ownerId;
return config;
})
);

10
ui-ngx/src/app/modules/home/components/group/entity-groups-table-config.ts

@ -30,10 +30,12 @@ import { EntityId } from '@shared/models/id/entity-id';
import { CustomTranslatePipe } from '@shared/pipe/custom-translate.pipe';
import { AuthUser } from '@shared/models/user.model';
import { edgeCreationAllowed } from '@shared/models/edge.models';
import { Authority } from '@shared/models/authority.enum';
export class EntityGroupsTableConfig extends EntityTableConfig<EntityGroupInfo> {
edgeId: string;
edgeOwnerId: EntityId;
groupType: EntityType;
shared: boolean;
@ -288,7 +290,13 @@ export class EntityGroupsTableConfig extends EntityTableConfig<EntityGroupInfo>
$event.stopPropagation();
}
let ownerId = this.userPermissionsService.getUserOwnerId();
if (this.params.customerId) {
if (this.edgeOwnerId && this.authUser.authority === Authority.TENANT_ADMIN) {
// List groups of the edge owner and its parent owners, so the groups of the customer that owns the edge are
// available no matter which page the edge was opened from (Edge management or Customers).
// Tenant admin only: for a customer user the edge owner may be outside their owner chain (an edge shared
// from the tenant or a parent customer), and the hierarchy request is then denied
ownerId = this.edgeOwnerId;
} else if (this.params.customerId) {
ownerId = {
id: this.params.customerId,
entityType: EntityType.CUSTOMER

Loading…
Cancel
Save