You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Task] Users API: GET /v1/users/filter should be able to return each user's direct roles #37233
The Angular Users portlet list (#36930 arc) shows each user's roles beyond the default access roles in a column. GET /api/v1/users/filter returns no role data — items are user.toMap() plus an optional requestPassword flag (UserPaginator#addRequestPasswordAttr).
The FE therefore fans out one GET /api/v1/roles/users/{userId} per row after every list load (dot-users-list.store.ts:107-124): 40 extra requests per page at the default per_page=40, each paying REST auth init. That endpoint also returns explicit and implicit roles (loadRolesForUser(userId) defaults includeImplicitRoles=true), so the FE filters access roles and the personal role out client-side.
Legacy reference: the Dojo Users portlet list grid had no roles column; its Roles tab listed direct memberships only (UserAjax#getUserRoles → loadRolesForUser(userId, false)).
The behavior is opt-in: callers that do not ask for roles get a byte-identical response to today. UserPaginator is shared; no extra payload or DB work for callers that don't need roles
All existing filter parameters (query, roleKey, paging, sorting, includeAnonymous, includeDefault, assetInode/permission) keep working unchanged in combination
No change to authorization of the endpoint
OpenAPI documents the new option and the per-item role shape; regenerated openapi.yaml committed
Acceptance Criteria
Roles returned per user when requested; absent when not requested (existing payload unchanged)
Only direct memberships are listed; a role held via inheritance (child of a held role, or the implicit CMS Anonymous role) is not
Keyless roles appear with id and name, roleKey null/absent
Integration tests: opt-in on/off, direct-vs-inherited, keyless role, combined with roleKey filter and paging
Existing UserResourceIntegrationTest and Postman UserResource collection still green
OpenAPI updated and regenerated
Out of scope
Changing GET /v1/roles/users/{userIdOrEmail}
Inherited/implicit role expansion in the list (could be a later opt-in if a use case appears)
Activity
#37233: feat(users): return direct roles per user on GET /v1/users/fi…
github-actions commentedon Aug 26, 2026
PRs linked to this issue
#37233: feat(users): return direct roles per user on GET /v1/users/fi…
hmoreras commentedon Sep 30, 2026
QA — PR #37236 verified ✅
Result: 41 requests, 85 assertions, 0 failures.
Environment:
dotcms/dotcms:nightly_c7cf0a9(Docker) — includes merge commitcbc5e93540http://localhost:8081Endpoint exercised:
GET /api/v1/users/filterincludeRoles=falsereturn byte-identical bodies, noroleskey,includeRolesnot echoed inLinkincludeRoles=true: direct roles listed as{id, name, roleKey}with no duplicates; item keys are the opt-out keys plusrolesid/name,roleKey: null; a root role named "User Managers…" is still listedroleKey+per_page=1paging → 1 item per page,totalEntries 2, no overlap between pages, roles correct for each userincludeRoles=true403; non-admin with Roles+Users portlets → 200