pub enum Role {
User,
Reporter,
Moderator,
Admin,
}Expand description
Built-in roles ordered from least privileged to most privileged.
These roles give you a ready-to-use hierarchy for common applications.
When used with crate::authz::access_policy::AccessPolicy::<Role, crate::groups::Group>::require_role_or_supervisor,
a higher-privileged role can satisfy lower-role requirements.
§Example
use webgates_core::authz::access_policy::AccessPolicy;
use webgates_core::groups::Group;
use webgates_core::roles::Role;
let moderator_or_higher =
AccessPolicy::<Role, Group>::require_role_or_supervisor(Role::Moderator);
let admin_or_moderator = AccessPolicy::<Role, Group>::require_role(Role::Admin)
.or_require_role(Role::Moderator);
assert!(!moderator_or_higher.denies_all());
assert!(!admin_or_moderator.denies_all());Variants§
User
Baseline role for regular users.
This is the default role assigned by Account::new(...) when you use the
built-in Role type.
Reporter
Role for users who primarily need read-heavy or reporting access.
Moderator
Elevated role for moderation or operational workflows.
Admin
Highest built-in role.
Administrators typically have full access to protected operations.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Role
impl<'de> Deserialize<'de> for Role
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Ord for Role
impl Ord for Role
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialOrd for Role
impl PartialOrd for Role
impl AccessHierarchy for Role
impl Copy for Role
impl Eq for Role
impl StructuralPartialEq for Role
Auto Trait Implementations§
impl Freeze for Role
impl RefUnwindSafe for Role
impl Send for Role
impl Sync for Role
impl Unpin for Role
impl UnsafeUnpin for Role
impl UnwindSafe for Role
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