Skip to main content

AccountStore

Trait AccountStore 

Source
pub trait AccountStore: Send + Sync {
Show 19 methods // Required methods fn member(&self, email: &str) -> Result<Option<Who>>; fn members(&self) -> Result<Vec<Member>>; fn set_role(&self, by: &str, email: &str, role: Role) -> Result<()>; fn remove(&self, by: &str, email: &str) -> Result<()>; fn invite( &self, by: &str, email: &str, role: Role, code: bool, ) -> Result<String>; fn invites(&self) -> Result<Vec<Invite>>; fn revoke_invite(&self, by: &str, email: &str) -> Result<()>; fn sign_in_link(&self, email: &str) -> Result<Option<String>>; fn redeem(&self, token: &str, client: &str) -> Result<(String, Who)>; fn sign_in_code( &self, email: &str, code: &str, client: &str, ) -> Result<(String, Who, Option<String>)>; fn sign_in_verified( &self, email: &str, how: &str, join: bool, ) -> Result<(String, Who)>; fn admit(&self, email: &str, join: bool) -> Result<Who>; fn reset_code( &self, by: &str, email: &str, keep: Option<&str>, ) -> Result<String>; fn sign_out(&self, session: &str, everywhere: bool) -> Result<()>; fn create_token( &self, who: &Who, name: &str, expires_in_days: Option<u32>, ) -> Result<String>; fn tokens(&self, who: &Who) -> Result<Vec<AccessToken>>; fn revoke_token(&self, who: &Who, id: &str) -> Result<()>; fn revoke_own_token(&self, token: &str) -> Result<bool>; // Provided method fn tidy(&self) { ... }
}
Expand description

Members, invitations, sign-in links and codes, sessions and personal access tokens.

Required Methods§

Source

fn member(&self, email: &str) -> Result<Option<Who>>

The member email; deployment admins are always present and admin.

Source

fn members(&self) -> Result<Vec<Member>>

Source

fn set_role(&self, by: &str, email: &str, role: Role) -> Result<()>

Source

fn remove(&self, by: &str, email: &str) -> Result<()>

Remove a member with their sessions, tokens and invitations.

Source

fn invite( &self, by: &str, email: &str, role: Role, code: bool, ) -> Result<String>

Invite email; returns the link token, or with code the invitation code.

Source

fn invites(&self) -> Result<Vec<Invite>>

Source

fn revoke_invite(&self, by: &str, email: &str) -> Result<()>

A sign-in link token for a member; None for anyone else.

Source

fn redeem(&self, token: &str, client: &str) -> Result<(String, Who)>

Exchange a link, an invitation or the admin token for a session.

Source

fn sign_in_code( &self, email: &str, code: &str, client: &str, ) -> Result<(String, Who, Option<String>)>

Sign in with an email and a code; an invitation code also returns the person’s own code.

Source

fn sign_in_verified( &self, email: &str, how: &str, join: bool, ) -> Result<(String, Who)>

Sign in someone an identity provider vouched for: a member, someone invited, or with join a newcomer as a viewer. how names the provider in the audit log.

Source

fn admit(&self, email: &str, join: bool) -> Result<Who>

The same check without a session: a member, or someone invited (or with join a newcomer) who joins now. For callers an identity provider vouched for, such as the gateway.

Source

fn reset_code( &self, by: &str, email: &str, keep: Option<&str>, ) -> Result<String>

A new sign-in code for email; their sessions end, except keep.

Source

fn sign_out(&self, session: &str, everywhere: bool) -> Result<()>

Source

fn create_token( &self, who: &Who, name: &str, expires_in_days: Option<u32>, ) -> Result<String>

A token that stops working after expires_in_days, or never with None.

Source

fn tokens(&self, who: &Who) -> Result<Vec<AccessToken>>

Source

fn revoke_token(&self, who: &Who, id: &str) -> Result<()>

Source

fn revoke_own_token(&self, token: &str) -> Result<bool>

Revoke the personal access token whose value is token; false when none matched.

Provided Methods§

Source

fn tidy(&self)

Drop what has expired (links, sessions, tokens); called now and then by a running server.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§