Skip to content

[5.x] Fix roles/groups select being empty for non-super users#14889

Open
mynetx wants to merge 1 commit into
statamic:5.xfrom
mynetx:fix/roles-groups-assign-permission-5x
Open

[5.x] Fix roles/groups select being empty for non-super users#14889
mynetx wants to merge 1 commit into
statamic:5.xfrom
mynetx:fix/roles-groups-assign-permission-5x

Conversation

@mynetx

@mynetx mynetx commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

The Roles (and User Groups) select on the user form comes back empty for a non-super user who has the assign roles / assign user groups permission — so they can't pick a role, even though that's exactly what the permission is for.

It's a regression from #14718. That PR scoped the relationship fieldtypes to the current user's permissions, but UserRoles and UserGroups got gated on edit roles / edit user groups — the permissions for editing the role/group definitions — instead of assign roles / assign user groups. Super users have everything, so it only bit non-super users.

These fieldtypes live on the user form, so they now authorize with assign roles / assign user groups, matching how the user form, UsersController, and the bulk assign actions already gate the same thing.

Fixes #14874.

The UserRoles and UserGroups fieldtypes sit on the user form, where the
relevant capability is assigning a role/group to a user. They were gated
on "edit roles" / "edit user groups" — the permissions for editing the
role/group definitions themselves — so a non-super user who only had
"assign roles" got an empty select and couldn't pick a role.

Gate them on "assign roles" / "assign user groups" instead, matching how
the user form, controller, and bulk actions already authorize this.

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant