pub struct SecurityContext { /* private fields */ }Expand description
Who is signed in and what the security system needs to answer for them. One per signed-in person, shared by their units of work.
Implementations§
Source§impl SecurityContext
impl SecurityContext
Sourcepub fn new(
identity: Identity,
directory: UserDirectory,
entities: Vec<EntityInfo>,
merge: RoleMerge,
) -> Self
pub fn new( identity: Identity, directory: UserDirectory, entities: Vec<EntityInfo>, merge: RoleMerge, ) -> Self
For this person, over these entities.
Sourcepub fn with_audit_trail(self, trail: Rc<AuditTrail>) -> Self
pub fn with_audit_trail(self, trail: Rc<AuditTrail>) -> Self
Writes what the security system does itself there.
Sourcepub fn with_denied_message(self, message: impl Into<String>) -> Self
pub fn with_denied_message(self, message: impl Into<String>) -> Self
What people are told when something is refused.
Sourcepub fn with<T>(&self, ask: impl FnOnce(&Permissions) -> T) -> T
pub fn with<T>(&self, ask: impl FnOnce(&Permissions) -> T) -> T
Asks what this person can do.
Sourcepub fn reload(&self) -> Result<(), SpaceError>
pub fn reload(&self) -> Result<(), SpaceError>
Reads who they are again, after their records may have changed: losing a role, or being turned off, takes effect now. Someone no longer active keeps no permission at all.
Sourcepub fn change_own_password(
&self,
current: &str,
new: &str,
) -> Result<(), PasswordError>
pub fn change_own_password( &self, current: &str, new: &str, ) -> Result<(), PasswordError>
Changes this person’s own password, which takes the current one.
Sourcepub fn set_password_of(
&self,
user: &Value,
password: &str,
) -> Result<(), PasswordError>
pub fn set_password_of( &self, user: &Value, password: &str, ) -> Result<(), PasswordError>
An administrator gives someone a password, which they have to change when they sign in.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for SecurityContext
impl !RefUnwindSafe for SecurityContext
impl !Send for SecurityContext
impl !Sync for SecurityContext
impl !UnwindSafe for SecurityContext
impl Unpin for SecurityContext
impl UnsafeUnpin for SecurityContext
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