pub struct AuthzSet { /* private fields */ }Expand description
The resolved rights of one session: a principal plus the grants that
cover it. Every dispatch layer asks the same question:
AuthzSet::check.
Implementations§
Source§impl AuthzSet
impl AuthzSet
Sourcepub fn owner(principal: impl Into<String>) -> Self
pub fn owner(principal: impl Into<String>) -> Self
The implicit-superuser session: a local open with no principal
asserted (root@localhost). Every verb on every namespace.
Sourcepub fn restricted(principal: impl Into<String>, grants: Vec<Grant>) -> Self
pub fn restricted(principal: impl Into<String>, grants: Vec<Grant>) -> Self
A restricted session: only what the grants cover. Zero grants = nothing (fail closed).
pub fn principal(&self) -> &str
pub fn is_owner(&self) -> bool
pub fn allows(&self, verb: Verb, ns: &str) -> bool
Sourcepub fn check(&self, verb: Verb, ns: &str) -> Result<()>
pub fn check(&self, verb: Verb, ns: &str) -> Result<()>
The one enforcement question. The refusal names the verb, the
resource, and the principal — the pieces a granting admin needs.
(Once GRANT parses, the message will also spell the statement that
fixes it — not before, to avoid pointing at unshipped syntax.)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for AuthzSet
impl RefUnwindSafe for AuthzSet
impl Send for AuthzSet
impl Sync for AuthzSet
impl Unpin for AuthzSet
impl UnsafeUnpin for AuthzSet
impl UnwindSafe for AuthzSet
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