utils.roles.rbac packageยถ
Submodulesยถ
utils.roles.rbac.scoped moduleยถ
Which role names a user holds on one application.
Most role names are global: roles: [administrator] means administrator
everywhere it is declared. APPLICATION_SCOPED_ROLES are the exception.
Those carry a distinct grant per application, so reading them from the
unscoped list would hand a user every deployed applicationโs copy at once.
They come only from application_roles:
users:
alice:
application_roles:
web-app-baserow: [mcp]
This module is the single source of truth for that rule. The Keycloak realm group builder, the LDAP role entry builder and the Open WebUI group reconciler all resolve membership through it, so the three paths cannot drift.
- utils.roles.rbac.scoped.expand_mcp_role(role_name: str) strยถ
Return the role a grant confers, resolving the pre-split name.
- Parameters:
role_name โ a role as written in a userโs grants.
- utils.roles.rbac.scoped.granted_roles(user_config: Mapping[str, object], application_id: str) set[str]ยถ
Return the role names this user holds on one application.
- Parameters:
user_config โ the userโs merged configuration.
application_id โ the application whose grants are being resolved.
- utils.roles.rbac.scoped.members_with_role(users: Mapping[str, Mapping[str, object]] | None, application_id: str, role_name: str) list[str]ยถ
Return the usernames holding
role_nameonapplication_id.- Parameters:
users โ the merged users mapping.
application_id โ the application whose grants are being resolved.
role_name โ the role to filter by.