pub trait RoleDelegationRepository: Send + Sync {
// Required methods
fn save<'life0, 'life1, 'async_trait>(
&'life0 self,
assignment: &'life1 UserRoleAssignment,
) -> Pin<Box<dyn Future<Output = Result<(), AppError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn find_by_id<'life0, 'async_trait>(
&'life0 self,
id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<Option<UserRoleAssignment>, AppError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn find_active_by_user_and_role<'life0, 'life1, 'async_trait>(
&'life0 self,
user_id: Uuid,
role: &'life1 UserRole,
organization_id: Option<Uuid>,
) -> Pin<Box<dyn Future<Output = Result<Vec<UserRoleAssignment>, AppError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn list_delegations_of<'life0, 'async_trait>(
&'life0 self,
user_id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<Vec<UserRoleAssignment>, AppError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn revoke<'life0, 'async_trait>(
&'life0 self,
id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<(), AppError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}Required Methods§
Sourcefn save<'life0, 'life1, 'async_trait>(
&'life0 self,
assignment: &'life1 UserRoleAssignment,
) -> Pin<Box<dyn Future<Output = Result<(), AppError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn save<'life0, 'life1, 'async_trait>(
&'life0 self,
assignment: &'life1 UserRoleAssignment,
) -> Pin<Box<dyn Future<Output = Result<(), AppError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Persist a freshly created delegation assignment.
Sourcefn find_by_id<'life0, 'async_trait>(
&'life0 self,
id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<Option<UserRoleAssignment>, AppError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn find_by_id<'life0, 'async_trait>(
&'life0 self,
id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<Option<UserRoleAssignment>, AppError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Look up a delegation row by id. Returns None if not found OR not a
delegation row (i.e. valid_until IS NULL).
Sourcefn find_active_by_user_and_role<'life0, 'life1, 'async_trait>(
&'life0 self,
user_id: Uuid,
role: &'life1 UserRole,
organization_id: Option<Uuid>,
) -> Pin<Box<dyn Future<Output = Result<Vec<UserRoleAssignment>, AppError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn find_active_by_user_and_role<'life0, 'life1, 'async_trait>(
&'life0 self,
user_id: Uuid,
role: &'life1 UserRole,
organization_id: Option<Uuid>,
) -> Pin<Box<dyn Future<Output = Result<Vec<UserRoleAssignment>, AppError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Look up the (active or expired) assignments currently held by user_id
with a given role. Used to enforce the @security non-transitive
invariant (the caller must have a native assignment for the role
they want to delegate) and the anti-double-grant 409.
Sourcefn list_delegations_of<'life0, 'async_trait>(
&'life0 self,
user_id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<Vec<UserRoleAssignment>, AppError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn list_delegations_of<'life0, 'async_trait>(
&'life0 self,
user_id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<Vec<UserRoleAssignment>, AppError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
List all active delegations involving user_id, either as target
(received) or as delegator (granted). Used by the audit list view.
Sourcefn revoke<'life0, 'async_trait>(
&'life0 self,
id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<(), AppError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn revoke<'life0, 'async_trait>(
&'life0 self,
id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<(), AppError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Revoke a delegation by its assignment id (best-effort delete).
Idempotent: revoking an already-removed row returns Ok(()).
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".