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§
Sourcefn member(&self, email: &str) -> Result<Option<Who>>
fn member(&self, email: &str) -> Result<Option<Who>>
The member email; deployment admins are always present and admin.
fn members(&self) -> Result<Vec<Member>>
fn set_role(&self, by: &str, email: &str, role: Role) -> Result<()>
Sourcefn remove(&self, by: &str, email: &str) -> Result<()>
fn remove(&self, by: &str, email: &str) -> Result<()>
Remove a member with their sessions, tokens and invitations.
Sourcefn invite(
&self,
by: &str,
email: &str,
role: Role,
code: bool,
) -> Result<String>
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.
fn invites(&self) -> Result<Vec<Invite>>
fn revoke_invite(&self, by: &str, email: &str) -> Result<()>
Sourcefn sign_in_link(&self, email: &str) -> Result<Option<String>>
fn sign_in_link(&self, email: &str) -> Result<Option<String>>
A sign-in link token for a member; None for anyone else.
Sourcefn redeem(&self, token: &str, client: &str) -> Result<(String, Who)>
fn redeem(&self, token: &str, client: &str) -> Result<(String, Who)>
Exchange a link, an invitation or the admin token for a session.
Sourcefn sign_in_code(
&self,
email: &str,
code: &str,
client: &str,
) -> Result<(String, Who, Option<String>)>
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.
Sourcefn sign_in_verified(
&self,
email: &str,
how: &str,
join: bool,
) -> Result<(String, Who)>
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.
Sourcefn admit(&self, email: &str, join: bool) -> Result<Who>
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.
Sourcefn reset_code(
&self,
by: &str,
email: &str,
keep: Option<&str>,
) -> Result<String>
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.
fn sign_out(&self, session: &str, everywhere: bool) -> Result<()>
Sourcefn create_token(
&self,
who: &Who,
name: &str,
expires_in_days: Option<u32>,
) -> Result<String>
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.
fn tokens(&self, who: &Who) -> Result<Vec<AccessToken>>
fn revoke_token(&self, who: &Who, id: &str) -> Result<()>
Sourcefn revoke_own_token(&self, token: &str) -> Result<bool>
fn revoke_own_token(&self, token: &str) -> Result<bool>
Revoke the personal access token whose value is token; false when none matched.
Provided Methods§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".