flask_more_smorest.perms.user_context
User context helpers for flask-more-smorest.
This module exposes runtime user lookup helpers and role checks.
All configuration is driven through init_fms in user_registry.
Functions
|
|
Get the current authenticated user's ID. |
|
Check if the current user is an admin. |
|
Check if the current user is a superadmin. |
- flask_more_smorest.perms.user_context.get_current_user(user_type=None)[source]
- Overloads:
→ AbstractUser | None
user_type (type[UserT]) → UserT | None
Get the current authenticated user.
Resolution order: 1. Registered custom getter (via init_fms) 2. Default: JWT-based authentication (built-in)
- Parameters:
user_type (
type[TypeVar(UserT, bound= AbstractUser)] |None) – Optional user class for typed return. If None, returns AbstractUser | None.- Returns:
Current user instance if authenticated, None otherwise
- Return type:
UserT | AbstractUser | None
- flask_more_smorest.perms.user_context.get_current_user_id()[source]
Get the current authenticated user’s ID.