app.auth.rbac¶
Authorization rules: role permissions and reviewer eligibility.
Permissions (read, operate) come from the rbac section of
catalog.yaml (RbacConfig). A missing or
invalid rbac section grants nothing (deny by default); the loader
reports it as a configuration problem (check-config) and
/healthz reports rbac: empty.
Reviewing is not a permission: eligibility comes from the approval
policy (app.domain.approval.is_eligible()). Read permission never
implies review. reviewer_eligibility() phrases the result for
GET /api/v1/me and for the decision endpoint (phase 07).
Public API: Permission and RbacConfig (re-exported
from app.catalog_config), ReviewerEligibility,
permissions_for(), reviewer_eligibility().
- class app.auth.rbac.Permission(*values)¶
Bases:
StrEnumPermissions an IdP role can grant (review comes from the policy).
- READ = 'read'¶
- OPERATE = 'operate'¶
- class app.auth.rbac.RbacConfig(roles=dict())¶
Bases:
objectIdP role -> permissions mapping.
- Parameters:
roles (
Mapping[str,frozenset[Permission]]) – Permissions granted per role name.
- roles: Mapping[str, frozenset[Permission]]¶
- permissions_for(roles)¶
Collect the permissions granted by a caller’s roles.
- Parameters:
- Return type:
- Returns:
The union of granted permissions.
- class app.auth.rbac.ReviewerEligibility(eligible, reason)¶
Bases:
objectWhether a caller may record approval decisions, and why.
- Parameters:
- app.auth.rbac.permissions_for(rbac, roles)¶
Collect the permissions a caller’s roles grant.
- Parameters:
rbac (
RbacConfig|None) – The role mapping, orNonewhen no configuration was loaded (grants nothing).
- Return type:
- Returns:
The granted permissions.
- app.auth.rbac.reviewer_eligibility(policy, *, issuer, subject, roles)¶
Evaluate reviewer eligibility under the configured approval policy.
- Parameters:
- Return type:
- Returns:
Eligibility with a reason.