fix: include managed role assignments in direct roles query
All checks were successful
CI / cleanup-branch (push) Has been skipped
CI / build (push) Successful in 1m18s
CI / docker (push) Successful in 1m2s
CI / deploy-feature (push) Has been skipped
CI / deploy (push) Successful in 38s

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:
hsiegeln
2026-04-08 11:52:50 +02:00
parent 529e2c727c
commit a8b977a2db

View File

@@ -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) {