pub struct AuthorizeRule {
pub roles: &'static [&'static str],
pub permissions: &'static [&'static str],
}Expand description
One #[authorize] declaration on an endpoint.
Every rule on an endpoint must be satisfied (AND). Within a rule, a non-empty
roles list means “the user has any of these roles” and a non-empty
permissions list means “the user has any of these permissions”; the two
dimensions are ANDed. Empty lists leave a dimension unconstrained, so a rule
with both empty means “any authenticated user”.
Multiple values in one declaration
(#[authorize(roles = ["admin", "auditor"])]) express alternatives; multiple
#[authorize] attributes express requirements that all have to hold.
Fields§
§roles: &'static [&'static str]Any-of role names; empty = no role constraint.
permissions: &'static [&'static str]Any-of permission names; empty = no permission constraint.
Implementations§
Source§impl AuthorizeRule
impl AuthorizeRule
Sourcepub const fn authenticated() -> AuthorizeRule
pub const fn authenticated() -> AuthorizeRule
A rule that only requires a valid authenticated principal.
Trait Implementations§
Source§impl Clone for AuthorizeRule
impl Clone for AuthorizeRule
Source§fn clone(&self) -> AuthorizeRule
fn clone(&self) -> AuthorizeRule
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 moreimpl Copy for AuthorizeRule
Source§impl Debug for AuthorizeRule
impl Debug for AuthorizeRule
impl Eq for AuthorizeRule
Source§impl PartialEq for AuthorizeRule
impl PartialEq for AuthorizeRule
Source§impl Serialize for AuthorizeRule
impl Serialize for AuthorizeRule
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl StructuralPartialEq for AuthorizeRule
Auto Trait Implementations§
impl Freeze for AuthorizeRule
impl RefUnwindSafe for AuthorizeRule
impl Send for AuthorizeRule
impl Sync for AuthorizeRule
impl Unpin for AuthorizeRule
impl UnsafeUnpin for AuthorizeRule
impl UnwindSafe for AuthorizeRule
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.