#37233: feat(users): return direct roles per user on GET /v1/users/filter - #37236
#37233: feat(users): return direct roles per user on GET /v1/users/filter#37236hassandotcms wants to merge 1 commit into
Conversation
3be0b4d to
c211f73
Compare
|
Claude finished @hassandotcms's task in 2m 32s —— View job Code Review — #37233 direct roles on
|
…lter (opt-in)
New `includeRoles` query param on GET /v1/users/filter. When true, each item
carries a `roles` array of the user's DIRECT memberships as {id, name, roleKey}
(SmallRoleView); inherited roles and the user's personal role are excluded,
matching the legacy Users portlet Roles tab (UserAjax#getUserRoles). Lets the
Angular Users list drop its per-row GET /v1/roles/users/{id} fan-out.
Default (flag absent) response is byte-identical: the flag is only added to the
paginator params when true, so neither the items nor the Link header change.
Requesting roles requires the same privilege as GET /v1/roles/users/{id}
(CMS Administrator, or Roles+Users portlet access), otherwise 403 -- the flag
must not widen who can read role membership.
Personal roles are recognized the legacy way -- ID-based DBFQN under the
cms_users root role -- not via Role#isUser(), whose name-based FQN check would
also drop any ordinary root role whose name starts with "User".
Roles are loaded outside UserPaginator#addRequestPasswordAttr so a lookup
failure surfaces as an error instead of silently emptying the item.
Tests: ITs for opt-out payload parity, direct roles, inherited-child exclusion,
keyless role, roleKey filter + paging, the 403 gate, and a "User Managers" root
role being kept; unit tests for the paginator and resource param plumbing.
UserPaginatorTest now extends UnitTestBase -- it only passed when another
UnitTestBase subclass ran first in the reused fork. openapi.yaml regenerated.
c211f73 to
2c6cf9e
Compare
|
Is there a way to get inherited roles with the API? |
wezell
left a comment
There was a problem hiding this comment.
Is there any way or flag to include inherited roles with this api?
currently no, in this api. if consumer need inherited roles per user as well, it can use |
Proposed Changes
Checklist
This PR fixes: #37233