mirror of
https://github.com/jhd3197/ServerKit.git
synced 2026-10-27 23:28:03 +09:00
16 lines
512 B
Python
16 lines
512 B
Python
"""Optional identity attribution for best-effort service audit records."""
|
|
|
|
|
|
def current_actor_id():
|
|
"""Return the JWT/API-key owner ID, or None if unavailable.
|
|
|
|
This helper is for attribution only, never for access control. Background
|
|
jobs and audit callers without a request keep their existing None actor.
|
|
"""
|
|
try:
|
|
from app.middleware.rbac import get_current_user
|
|
user = get_current_user()
|
|
return user.id if user else None
|
|
except Exception:
|
|
return None
|