pub struct RoleDelegationUseCases { /* private fields */ }Implementations§
Source§impl RoleDelegationUseCases
impl RoleDelegationUseCases
pub fn new(repo: Arc<dyn RoleDelegationRepository>) -> Self
Sourcepub async fn delegate_role(
&self,
delegator_user_id: Uuid,
target_user_id: Uuid,
role: UserRole,
organization_id: Option<Uuid>,
valid_until: DateTime<Utc>,
) -> Result<UserRoleAssignment, AppError>
pub async fn delegate_role( &self, delegator_user_id: Uuid, target_user_id: Uuid, role: UserRole, organization_id: Option<Uuid>, valid_until: DateTime<Utc>, ) -> Result<UserRoleAssignment, AppError>
Delegate a role to another user.
The caller (handler) MUST have already verified that delegator_user_id
owns the role to be delegated (via JWT + native assignment lookup);
this use-case re-checks the non-transitive invariant by inspecting
the persisted assignment(s).
Sourcepub async fn revoke_delegation(
&self,
assignment_id: Uuid,
) -> Result<(), AppError>
pub async fn revoke_delegation( &self, assignment_id: Uuid, ) -> Result<(), AppError>
Manually revoke a delegation before its term. Idempotent.
Sourcepub async fn list_delegations_of(
&self,
user_id: Uuid,
) -> Result<Vec<UserRoleAssignment>, AppError>
pub async fn list_delegations_of( &self, user_id: Uuid, ) -> Result<Vec<UserRoleAssignment>, AppError>
List active delegations involving user_id (received OR granted).
Auto Trait Implementations§
impl !RefUnwindSafe for RoleDelegationUseCases
impl !UnwindSafe for RoleDelegationUseCases
impl Freeze for RoleDelegationUseCases
impl Send for RoleDelegationUseCases
impl Sync for RoleDelegationUseCases
impl Unpin for RoleDelegationUseCases
impl UnsafeUnpin for RoleDelegationUseCases
Blanket Implementations§
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T> Fake for T
impl<T> Fake for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreCreates a shared type from an unshared type.