fix: include managed role assignments in direct roles query
getDirectRolesForUser filtered on origin='direct', which excluded roles assigned via claim mapping (origin='managed'). This caused OIDC users to appear roleless even when claim mappings matched. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -248,11 +248,11 @@ public class RbacServiceImpl implements RbacService {
|
|||||||
@Override
|
@Override
|
||||||
public List<RoleSummary> getDirectRolesForUser(String userId) {
|
public List<RoleSummary> getDirectRolesForUser(String userId) {
|
||||||
return jdbc.query("""
|
return jdbc.query("""
|
||||||
SELECT r.id, r.name, r.system FROM user_roles ur
|
SELECT r.id, r.name, r.system, ur.origin FROM user_roles ur
|
||||||
JOIN roles r ON r.id = ur.role_id
|
JOIN roles r ON r.id = ur.role_id
|
||||||
WHERE ur.user_id = ? AND ur.origin = 'direct'
|
WHERE ur.user_id = ?
|
||||||
""", (rs, rowNum) -> new RoleSummary(rs.getObject("id", UUID.class),
|
""", (rs, rowNum) -> new RoleSummary(rs.getObject("id", UUID.class),
|
||||||
rs.getString("name"), rs.getBoolean("system"), "direct"), userId);
|
rs.getString("name"), rs.getBoolean("system"), rs.getString("origin")), userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<GroupSummary> getDirectGroupsForUser(String userId) {
|
private List<GroupSummary> getDirectGroupsForUser(String userId) {
|
||||||
|
|||||||
Reference in New Issue
Block a user