pub struct Authorizer { /* private fields */ }Expand description
A schema and a tuple store: writes checked against the schema, and
check.
Implementations§
Source§impl Authorizer
impl Authorizer
Sourcepub fn new(
schema: Schema,
store: impl TupleStore + 'static,
) -> Result<Authorizer, AuthzError>
pub fn new( schema: Schema, store: impl TupleStore + 'static, ) -> Result<Authorizer, AuthzError>
schema is validated (see Schema::validate).
pub fn with_store( schema: Schema, store: Arc<dyn TupleStore>, ) -> Result<Authorizer, AuthzError>
pub fn schema(&self) -> &Schema
pub fn store(&self) -> &Arc<dyn TupleStore> ⓘ
Sourcepub fn write(&self, tuple: &Tuple) -> Result<bool, AuthzError>
pub fn write(&self, tuple: &Tuple) -> Result<bool, AuthzError>
Store tuple if the schema allows it; true if it was new.
Sourcepub fn write_str(&self, tuple: &str) -> Result<bool, AuthzError>
pub fn write_str(&self, tuple: &str) -> Result<bool, AuthzError>
write from text (doc:42#editor@user:alice).
pub fn delete(&self, tuple: &Tuple) -> Result<bool, AuthzError>
Sourcepub fn check(
&self,
subject: &str,
relation: &str,
object: &str,
) -> Result<bool, AuthzError>
pub fn check( &self, subject: &str, relation: &str, object: &str, ) -> Result<bool, AuthzError>
Whether subject (user:alice) has relation on object
(doc:42).
Sourcepub fn explain(
&self,
subject: &str,
relation: &str,
object: &str,
) -> Result<Option<Vec<String>>, AuthzError>
pub fn explain( &self, subject: &str, relation: &str, object: &str, ) -> Result<Option<Vec<String>>, AuthzError>
Like check, with the path that granted it: each step
object#relation, ending with the tuple that named the subject.
Sourcepub fn check_subject(
&self,
subject: &Subject,
relation: &str,
object: &ObjectRef,
) -> Result<bool, AuthzError>
pub fn check_subject( &self, subject: &Subject, relation: &str, object: &ObjectRef, ) -> Result<bool, AuthzError>
check with a subject and object already parsed —
for a caller, so an id is never re-read as text.
Trait Implementations§
Source§impl Clone for Authorizer
impl Clone for Authorizer
Source§fn clone(&self) -> Authorizer
fn clone(&self) -> Authorizer
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for Authorizer
impl !UnwindSafe for Authorizer
impl Freeze for Authorizer
impl Send for Authorizer
impl Sync for Authorizer
impl Unpin for Authorizer
impl UnsafeUnpin for Authorizer
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<T> ServiceExt for T
impl<T> ServiceExt for T
Source§fn map_response_body<F>(self, f: F) -> MapResponseBody<Self, F>where
Self: Sized,
fn map_response_body<F>(self, f: F) -> MapResponseBody<Self, F>where
Self: Sized,
Available on crate feature
map-response-body only.Apply a transformation to the response body. Read more
Source§fn trace_for_http(self) -> Trace<Self, SharedClassifier<ServerErrorsAsFailures>>where
Self: Sized,
fn trace_for_http(self) -> Trace<Self, SharedClassifier<ServerErrorsAsFailures>>where
Self: Sized,
Available on crate feature
trace only.High level tracing that classifies responses using HTTP status codes. Read more
Source§fn trace_for_grpc(self) -> Trace<Self, SharedClassifier<GrpcErrorsAsFailures>>where
Self: Sized,
fn trace_for_grpc(self) -> Trace<Self, SharedClassifier<GrpcErrorsAsFailures>>where
Self: Sized,
Available on crate feature
trace only.High level tracing that classifies responses using gRPC headers. Read more