Users list "Role" column shows an arbitrary role (e.g. Reader) when a user inherits several roles from groups (regression in v1.7.0)
Describe the bug
Since v1.7.0, the Role column in Settings → Users & Groups → Users shows a role inherited from a group, and when a user inherits several roles it picks one arbitrarily. Users who are in a group bound to Editor are shown as Reader because another of their groups is bound to Reader.
Clearing the role ("No Role") does not help: the direct roleMembership aspect is emptied correctly, but the column still shows Reader after refresh. From the admin's point of view the value "jumps back".
Cause, as far as I can tell:
EntityRelationshipsResultResolver.mapMembershipRelationshipsanswerscorpuser+IsMemberOfRole+OUTGOINGwithBoundMembershipAccess.effectiveRolesForUser(...). That returns an unorderedSet<Urn>of direct roles plus roles inherited from groups. This came in with the entity graph cache (#17886) and was backported to v1.7.0 in #19548. Before that, the same query returned only direct role edges.UserListV2.tsx(andUserListItem.tsx) showuser.roles.relationships[0], so the role shown is whichever comes first in that set.- The UI does not mark a role as inherited, so it looks like an explicit assignment that can't be removed.
Effective permissions look fine: the PolicyEngine grants the union of roles. Only the display is wrong.
To Reproduce
- Create group
Awith roleReaderand groupBwith roleEditor. - Add user
uto both groups. Do not giveua direct role. - Open Settings → Users & Groups → Users and search for
u. - The Role column shows
Reader. - Set
uto "No Role" and confirm. After refresh it showsReaderagain.
GraphQL on v1.7.0, for a user with no direct role in groups bound to Reader and Editor:
{ searchUsers(input: {query: "u", start: 0, count: 1}) {
searchResults { entity { ... on CorpUser {
roles: relationships(input: {types: ["IsMemberOfRole"], direction: OUTGOING, start: 0}) {
total relationships { entity { urn } } } } } } } }returns total: 2, [urn:li:dataHubRole:Reader, urn:li:dataHubRole:Editor]. Meanwhile GET /openapi/v3/entity/corpuser/<urn>?aspects=roleMembership returns {"roles": []}, and the /relationships endpoint returns no IsMemberOfRole edges.
Expected behavior
The Role column should show the user's effective role in a predictable way:
- When all the roles are built-in, show the highest one (
Admin>Editor>Reader), so the user above showsEditor. - Custom roles can't be ranked in general. For those, show all roles (e.g.
Editor +1, with the rest in a tooltip, like the Assigned Groups column) instead of picking one. - Mark inherited roles (e.g. "Editor (via group B)") separately from the direct assignment. Editing through the dropdown should only show and change the direct role, so "No Role" doesn't appear to be ignored.
Screenshots
Users list: several users who belong to both a Reader-bound and an Editor-bound group all show Reader.
Environment
- DataHub server v1.7.0 (commit
7f81ccbfe27b9acc947f5f600fcf9ddb72138a80) - Groups and memberships ingested from Azure AD (
origin.externalType: AZURE_AD); roles bound to groups viaroleMembershipon thecorpGroup
Additional context
- Related but different: #10667 (a stale role shown after search; that one goes away with a hard refresh).
- Code references (v1.7.0):
datahub-graphql-core/.../resolvers/load/EntityRelationshipsResultResolver.java:isMembershipQuery/mapMembershipRelationshipsdatahub-web-react/src/app/identity/user/UserListV2.tsx: Role column render (relationships[0])
Source: datahub-project/datahub