pub struct Role { /* private fields */ }Expand description
A named scope-set with transitive inheritance.
A Role carries a name, a list of granted scopes, an inherits list of
upstream roles whose scopes are unioned transitively at
ScopeRegistry::expand_role time, and a free-text description.
Construction performs no validation beyond the field types themselves
(per AUTHZ-CORE-4 “no validation beyond field-level”); referential
integrity of inherits and cycle-freedom are enforced when the role is
installed into a registry via ScopeRegistryBuilder::build.
Role is intentionally NOT sealed — the registry’s contents are
deployment-controlled; only the types are framework-owned (AUTHZ-0
§“Crate-level isolation amplifies the seal”).
Implementations§
Source§impl Role
impl Role
Sourcepub fn new(
name: RoleName,
scopes: Vec<Scope>,
inherits: Vec<RoleName>,
description: impl Into<String>,
) -> Self
pub fn new( name: RoleName, scopes: Vec<Scope>, inherits: Vec<RoleName>, description: impl Into<String>, ) -> Self
Construct a Role from already-typed fields.
Sourcepub fn scopes(&self) -> &[Scope]
pub fn scopes(&self) -> &[Scope]
The scopes granted directly by this role (excluding inherited).
Sourcepub fn inherits(&self) -> &[RoleName]
pub fn inherits(&self) -> &[RoleName]
The upstream roles whose scopes this role unions transitively.
Sourcepub fn description(&self) -> &str
pub fn description(&self) -> &str
Free-text description of the role.