Skip to main content

AclAuthorizer

Struct AclAuthorizer 

Source
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>

Source

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.

Source

pub fn options(self, options: Options) -> Self

The options checks run with.

Source

pub fn owner_rights(self, rights: Rights) -> Self

Rights an item’s owner holds unless an entry names Owner (Context::owner_rights).

Source

pub fn conditions(self, conditions: impl Conditions + 'static) -> Self

The consumer’s conditions.

Source

pub fn store(&self) -> &S

The store.

Source

pub fn schema(&self) -> &RightsSchema

The schema.

Source

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.

Trait Implementations§

Source§

impl<S: AclStore + Send + Sync> Authorizer for AclAuthorizer<S>

Source§

fn authorize( &self, request: AuthorizationRequest, ) -> Result<AuthorizationDecision, ProviderError>

Evaluates the request using the supplied authoritative person record.
Source§

impl<S> Debug for AclAuthorizer<S>

Source§

fn fmt(&self, formatter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<S> !RefUnwindSafe for AclAuthorizer<S>

§

impl<S> !UnwindSafe for AclAuthorizer<S>

§

impl<S> Freeze for AclAuthorizer<S>
where S: Freeze,

§

impl<S> Send for AclAuthorizer<S>
where S: Send,

§

impl<S> Sync for AclAuthorizer<S>
where S: Sync,

§

impl<S> Unpin for AclAuthorizer<S>
where S: Unpin,

§

impl<S> UnsafeUnpin for AclAuthorizer<S>
where S: UnsafeUnpin,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.