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