pub struct Role { /* private fields */ }Expand description
Tenant-scoped role with an explicit permission set.
Implementations§
Source§impl Role
impl Role
pub fn new( id: RoleId, tenant_id: TenantId, name: impl AsRef<str>, permissions: impl IntoIterator<Item = Permission>, ) -> NythosResult<Self>
pub const fn id(&self) -> RoleId
pub const fn tenant_id(&self) -> TenantId
pub fn name(&self) -> &str
pub fn permissions(&self) -> &BTreeSet<Permission>
pub fn has_permission(&self, permission: &Permission) -> bool
pub fn add_permission(&mut self, permission: Permission)
pub fn remove_permission(&mut self, permission: &Permission)
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
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