pub struct AclAuthorizer<S> { /* private fields */ }Expand description
Answers [Authorizer] from the ACLs in a store: the request’s resource is the item,
its action a right or alias of schema, its person the requester (signed in, so
Authenticated and Everyone entries match).
An action the schema does not define, or that names no right, is refused: nothing can
grant it. A store that cannot answer, or an ACL that cannot be used, is Err (“could
not find out”), never a denial. A superuser bypass is the caller’s check before asking.
Implementations§
Source§impl<S: AclStore> AclAuthorizer<S>
impl<S: AclStore> AclAuthorizer<S>
Sourcepub fn new(store: S, schema: RightsSchema) -> Self
pub fn new(store: S, schema: RightsSchema) -> Self
An authorizer over store, whose items’ rights schema names, with default
options, no owner rights and no conditions.
Sourcepub fn owner_rights(self, rights: Rights) -> Self
pub fn owner_rights(self, rights: Rights) -> Self
Rights an item’s owner holds unless an entry names Owner
(Context::owner_rights).
Sourcepub fn conditions(self, conditions: impl Conditions + 'static) -> Self
pub fn conditions(self, conditions: impl Conditions + 'static) -> Self
The consumer’s conditions.
Sourcepub fn schema(&self) -> &RightsSchema
pub fn schema(&self) -> &RightsSchema
The schema.
Sourcepub fn decide(
&self,
person: &Person,
action: &str,
item: &str,
) -> Result<Decision, AclError>
pub fn decide( &self, person: &Person, action: &str, item: &str, ) -> Result<Decision, AclError>
The whole decision for person doing action on item, for an audit record or to
intersect with a token’s.
§Errors
As AclStore::check; an action the schema does not define is
AclError::UnknownRight.