pub struct StandardPrincipal { /* private fields */ }Expand description
Basic principal implementation suitable for role/permission services.
Implementations§
Source§impl StandardPrincipal
impl StandardPrincipal
Sourcepub fn new(id: impl Into<String>) -> SoapResult<Self>
pub fn new(id: impl Into<String>) -> SoapResult<Self>
Creates a principal without roles or permissions.
Sourcepub fn role(self, role: impl Into<String>) -> SoapResult<Self>
pub fn role(self, role: impl Into<String>) -> SoapResult<Self>
Adds a role once.
Sourcepub fn permission(self, permission: impl Into<String>) -> SoapResult<Self>
pub fn permission(self, permission: impl Into<String>) -> SoapResult<Self>
Adds a permission once.
Sourcepub fn roles(&self) -> &BTreeSet<AuthorizationName>
pub fn roles(&self) -> &BTreeSet<AuthorizationName>
Returns roles in deterministic order.
Sourcepub fn permissions(&self) -> &BTreeSet<AuthorizationName>
pub fn permissions(&self) -> &BTreeSet<AuthorizationName>
Returns permissions in deterministic order.
Trait Implementations§
Source§impl Clone for StandardPrincipal
impl Clone for StandardPrincipal
Source§fn clone(&self) -> StandardPrincipal
fn clone(&self) -> StandardPrincipal
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 moreSource§impl Debug for StandardPrincipal
impl Debug for StandardPrincipal
impl Eq for StandardPrincipal
Source§impl PartialEq for StandardPrincipal
impl PartialEq for StandardPrincipal
Source§impl Principal for StandardPrincipal
impl Principal for StandardPrincipal
Source§fn principal_id(&self) -> &PrincipalId
fn principal_id(&self) -> &PrincipalId
Returns the stable subject identity.
Source§fn has_role(&self, role: &AuthorizationName) -> bool
fn has_role(&self, role: &AuthorizationName) -> bool
Reports whether the principal owns one role.
Source§fn has_permission(&self, permission: &AuthorizationName) -> bool
fn has_permission(&self, permission: &AuthorizationName) -> bool
Reports whether the principal owns one permission.
impl StructuralPartialEq for StandardPrincipal
Auto Trait Implementations§
impl Freeze for StandardPrincipal
impl RefUnwindSafe for StandardPrincipal
impl Send for StandardPrincipal
impl Sync for StandardPrincipal
impl Unpin for StandardPrincipal
impl UnsafeUnpin for StandardPrincipal
impl UnwindSafe for StandardPrincipal
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