pub trait AuthorizationServiceTrait: Send + Sync {
// Required methods
fn check_authorization<'life0, 'async_trait>(
&'life0 self,
request: AuthorizationRequest,
) -> Pin<Box<dyn Future<Output = Result<AuthorizationResponse, AuthorizationError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn grant_permission_to_role<'life0, 'life1, 'async_trait>(
&'life0 self,
role: &'life1 str,
permission: Permission,
) -> Pin<Box<dyn Future<Output = Result<(), AuthorizationError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn revoke_permission_from_role<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
role: &'life1 str,
permission: &'life2 Permission,
) -> Pin<Box<dyn Future<Output = Result<(), AuthorizationError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn assign_role_to_user<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
user_id: &'life1 str,
role: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<(), AuthorizationError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn remove_role_from_user<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
user_id: &'life1 str,
role: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<(), AuthorizationError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn get_user_permissions<'life0, 'life1, 'async_trait>(
&'life0 self,
user_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<Permission>, AuthorizationError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn user_has_permission<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
user_id: &'life1 str,
permission: &'life2 Permission,
) -> Pin<Box<dyn Future<Output = Result<bool, AuthorizationError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
}Expand description
Authorization service trait
Required Methods§
Check if a user is authorized to perform an action on a resource
Sourcefn grant_permission_to_role<'life0, 'life1, 'async_trait>(
&'life0 self,
role: &'life1 str,
permission: Permission,
) -> Pin<Box<dyn Future<Output = Result<(), AuthorizationError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn grant_permission_to_role<'life0, 'life1, 'async_trait>(
&'life0 self,
role: &'life1 str,
permission: Permission,
) -> Pin<Box<dyn Future<Output = Result<(), AuthorizationError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Grant a permission to a role
Sourcefn revoke_permission_from_role<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
role: &'life1 str,
permission: &'life2 Permission,
) -> Pin<Box<dyn Future<Output = Result<(), AuthorizationError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn revoke_permission_from_role<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
role: &'life1 str,
permission: &'life2 Permission,
) -> Pin<Box<dyn Future<Output = Result<(), AuthorizationError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Revoke a permission from a role
Sourcefn assign_role_to_user<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
user_id: &'life1 str,
role: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<(), AuthorizationError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn assign_role_to_user<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
user_id: &'life1 str,
role: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<(), AuthorizationError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Assign a role to a user
Sourcefn remove_role_from_user<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
user_id: &'life1 str,
role: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<(), AuthorizationError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn remove_role_from_user<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
user_id: &'life1 str,
role: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<(), AuthorizationError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Remove a role from a user
Sourcefn get_user_permissions<'life0, 'life1, 'async_trait>(
&'life0 self,
user_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<Permission>, AuthorizationError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_user_permissions<'life0, 'life1, 'async_trait>(
&'life0 self,
user_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<Permission>, AuthorizationError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Get all permissions for a user
Sourcefn user_has_permission<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
user_id: &'life1 str,
permission: &'life2 Permission,
) -> Pin<Box<dyn Future<Output = Result<bool, AuthorizationError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn user_has_permission<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
user_id: &'life1 str,
permission: &'life2 Permission,
) -> Pin<Box<dyn Future<Output = Result<bool, AuthorizationError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Check if user has a specific permission
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".