pub struct OrganizationPlugin { /* private fields */ }Expand description
Organization plugin for multi-tenancy support
Implementations§
Source§impl OrganizationPlugin
impl OrganizationPlugin
Sourcepub fn callbacks<S: AuthSchema>(
self,
callbacks: OrganizationCallbacks<S>,
) -> impl AuthPlugin<S>
pub fn callbacks<S: AuthSchema>( self, callbacks: OrganizationCallbacks<S>, ) -> impl AuthPlugin<S>
Attach typed notification callbacks after configuring the organization options.
Source§impl OrganizationPlugin
impl OrganizationPlugin
Sourcepub async fn add_member<S: AuthSchema>(
&self,
input: AddMemberInput,
request: Option<&AuthRequest>,
ctx: &AuthContext<S>,
) -> AuthResult<Member>
pub async fn add_member<S: AuthSchema>( &self, input: AddMemberInput, request: Option<&AuthRequest>, ctx: &AuthContext<S>, ) -> AuthResult<Member>
Add a member from a trusted server context, optionally using an authenticated request.
Source§impl OrganizationPlugin
impl OrganizationPlugin
pub fn new() -> Self
pub fn with_config(config: OrganizationConfig) -> Self
pub fn dynamic_access_control(self, val: bool) -> Self
pub fn maximum_roles_per_organization(self, val: usize) -> Self
pub fn allow_user_to_create_organization(self, val: bool) -> Self
pub fn organization_limit(self, val: usize) -> Self
pub fn membership_limit(self, val: usize) -> Self
pub fn creator_role(self, val: impl Into<String>) -> Self
pub fn invitation_expires_in(self, val: f64) -> Self
pub fn invitation_limit(self, val: usize) -> Self
pub fn cancel_pending_invitations_on_re_invite(self, val: bool) -> Self
pub fn require_email_verification_on_invitation(self, val: bool) -> Self
pub fn disable_organization_deletion(self, val: bool) -> Self
Source§impl OrganizationPlugin
impl OrganizationPlugin
Sourcepub fn membership_limit_callback(
self,
callback: Arc<dyn MembershipLimitPolicy>,
) -> Self
pub fn membership_limit_callback( self, callback: Arc<dyn MembershipLimitPolicy>, ) -> Self
Configure dynamic organization capacity. Listing retains the upstream default page size.
Sourcepub fn hooks(self, hooks: Arc<dyn OrganizationHooks>) -> Self
pub fn hooks(self, hooks: Arc<dyn OrganizationHooks>) -> Self
Configure application lifecycle hooks.
Sourcepub fn policy(self, policy: Arc<dyn OrganizationPolicy>) -> Self
pub fn policy(self, policy: Arc<dyn OrganizationPolicy>) -> Self
Configure asynchronous organization options.
Sourcepub fn teams(self, teams: OrganizationTeamsConfig) -> Self
pub fn teams(self, teams: OrganizationTeamsConfig) -> Self
Configure organization teams.
Sourcepub fn access_control(self, ac: HashMap<String, Vec<String>>) -> Self
pub fn access_control(self, ac: HashMap<String, Vec<String>>) -> Self
Configure access-control resource statements.
Sourcepub fn custom_send_invitation_email(
self,
sender: Arc<dyn SendInvitationEmail>,
) -> Self
pub fn custom_send_invitation_email( self, sender: Arc<dyn SendInvitationEmail>, ) -> Self
Configure delivery for new and resent invitations.
Trait Implementations§
Source§impl<S: AuthSchema> AuthPlugin<S> for OrganizationPlugin
impl<S: AuthSchema> AuthPlugin<S> for OrganizationPlugin
Source§fn openapi(&self) -> AuthResult<OpenApiPluginMetadata>
fn openapi(&self) -> AuthResult<OpenApiPluginMetadata>
Document this configured plugin without invoking application field policies.
Source§fn on_init<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: &'life1 mut AuthInitContext<S>,
) -> Pin<Box<dyn Future<Output = AuthResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn on_init<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: &'life1 mut AuthInitContext<S>,
) -> Pin<Box<dyn Future<Output = AuthResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Called when the plugin is initialized
Source§fn after_request<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
req: &'life1 AuthRequest,
response: &'life2 mut AuthResponse,
_ctx: &'life3 AuthContext<S>,
) -> Pin<Box<dyn Future<Output = AuthResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn after_request<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
req: &'life1 AuthRequest,
response: &'life2 mut AuthResponse,
_ctx: &'life3 AuthContext<S>,
) -> Pin<Box<dyn Future<Output = AuthResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Inspect or extend the final route response after session cookies are applied.
Source§fn on_request<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
req: &'life1 AuthRequest,
ctx: &'life2 AuthContext<S>,
) -> Pin<Box<dyn Future<Output = AuthResult<Option<AuthResponse>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn on_request<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
req: &'life1 AuthRequest,
ctx: &'life2 AuthContext<S>,
) -> Pin<Box<dyn Future<Output = AuthResult<Option<AuthResponse>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Called for each request - return Some(response) to handle, None to pass through
Source§fn telemetry_plugin_id(&self) -> Option<&'static str>
fn telemetry_plugin_id(&self) -> Option<&'static str>
Return the upstream plugin ID; core option wrappers have no plugin ID.
Source§fn password_hasher(&self) -> Option<Arc<dyn PasswordHasher>>
fn password_hasher(&self) -> Option<Arc<dyn PasswordHasher>>
Select the base password hasher before plugin initialization wraps it.
Source§fn telemetry(&self, _options: &mut PluginTelemetry)
fn telemetry(&self, _options: &mut PluginTelemetry)
Report configured options without invoking callbacks or initializing the plugin.
Source§fn rate_limits(&self) -> Result<Vec<PluginRateLimit>, AuthError>
fn rate_limits(&self) -> Result<Vec<PluginRateLimit>, AuthError>
Default endpoint limits, overridden by explicit application limits.
Source§fn on_http_request<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_req: &'life1 AuthRequest,
_ctx: &'life2 AuthContext<S>,
) -> Pin<Box<dyn Future<Output = Result<Option<AuthResponse>, AuthError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
fn on_http_request<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_req: &'life1 AuthRequest,
_ctx: &'life2 AuthContext<S>,
) -> Pin<Box<dyn Future<Output = Result<Option<AuthResponse>, AuthError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
Inspect an HTTP request after rate limiting and before endpoint middleware.
Native API calls do not run this hook. A response skips endpoint hooks.
Source§fn on_http_response<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
_req: &'life1 AuthRequest,
_response: &'life2 mut AuthResponse,
_ctx: &'life3 AuthContext<S>,
) -> Pin<Box<dyn Future<Output = Result<Option<AuthResponse>, AuthError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Self: 'async_trait,
fn on_http_response<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
_req: &'life1 AuthRequest,
_response: &'life2 mut AuthResponse,
_ctx: &'life3 AuthContext<S>,
) -> Pin<Box<dyn Future<Output = Result<Option<AuthResponse>, AuthError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Self: 'async_trait,
Inspect the HTTP router response, including route misses and body errors.
Early HTTP request responses and native endpoint calls skip this hook.
A replacement response stops the remaining HTTP response hooks.
Source§fn before_request<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_req: &'life1 AuthRequest,
_ctx: &'life2 AuthContext<S>,
) -> Pin<Box<dyn Future<Output = Result<Option<BeforeRequestAction>, AuthError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
fn before_request<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_req: &'life1 AuthRequest,
_ctx: &'life2 AuthContext<S>,
) -> Pin<Box<dyn Future<Output = Result<Option<BeforeRequestAction>, AuthError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
Called for a registered endpoint after HTTP body decoding and origin checks. Read more
Source§impl Clone for OrganizationPlugin
impl Clone for OrganizationPlugin
Auto Trait Implementations§
impl !RefUnwindSafe for OrganizationPlugin
impl !UnwindSafe for OrganizationPlugin
impl Freeze for OrganizationPlugin
impl Send for OrganizationPlugin
impl Sync for OrganizationPlugin
impl Unpin for OrganizationPlugin
impl UnsafeUnpin for OrganizationPlugin
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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