User Utilities and Helpers¶
- check_critical_action_forbidden(target_user: UserModel, calling_superuser_id: UUID) None[source]¶
Disallow destructive action on self or system admin.
- Parameters:
target_user (
User) – The user object targeted for action.calling_superuser_id (UUID) – UUID of the superuser calling the action.
- Raises:
PermissionDeniedException – If target is the system admin or the caller themselves.
- async perform_logout_cleanup(refresh_jti: str, ttl: int, user_id: UUID) None[source]¶
Perform asynchronous cleanup tasks upon user logout.
This function is intended to be executed as a FastAPI background task to non-blocking revoke the refresh token in cache with a specified TTL and immediately invalidate cached user data.