Skip to content

[Task] Users API: GET /v1/users/filter should be able to return each user's direct roles #37233

Description

@hassandotcms

Context

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)).

Requirements

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

  1. moved this from New to In Progress in dotCMS - Product Planningon Aug 26, 2026
  2. self-assigned this
    on Aug 26, 2026
  3. added a commit that references this issue on Aug 26, 2026
  4. github-actions commented on Aug 26, 2026

    @github-actions
    Contributor
  5. added a commit that references this issue on Aug 26, 2026
  6. moved this from In Progress to QA in dotCMS - Product Planningon Sep 4, 2026
  7. hmoreras commented on Sep 30, 2026

    @hmoreras
    Member

    QA — PR #37236 verified ✅

    Result: 41 requests, 85 assertions, 0 failures.

    Environment:

    • Build: dotcms/dotcms:nightly_c7cf0a9 (Docker) — includes merge commit cbc5e93540
    • Server: http://localhost:8081
    • Runner: newman 6.2.1
    • Date: 2026-09-30

    Endpoint exercised: GET /api/v1/users/filter

    • Opt-out: no flag and includeRoles=false return byte-identical bodies, no roles key, includeRoles not echoed in Link
    • includeRoles=true: direct roles listed as {id, name, roleKey} with no duplicates; item keys are the opt-out keys plus roles
    • Excluded: inherited child role, the user's personal role, CMS Anonymous
    • Role with no key → listed by id/name, roleKey: null; a root role named "User Managers…" is still listed
    • Combined with roleKey + per_page=1 paging → 1 item per page, totalEntries 2, no overlap between pages, roles correct for each user
    • Authorization: backend user without portlets → default call 200, includeRoles=true 403; non-admin with Roles+Users portlets → 200
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions