Fix missing Submitter/Agency on Auditing Errors tab
The authenticated user's DB ID was fetched in main.py for a role check but never forwarded to handle_analyze_message, so Proof.created_by was always NULL. This caused submitter_name and submitter_agency to resolve to None on the Errors tab. Fix: capture current_user_id from the role-check session in main.py, pass it to handle_analyze_message, and forward it to add_version_with_review as created_by. Newly submitted proofs will now have their submitter recorded and visible in all three Auditing tabs. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
8f2f561c71
commit
138fa0fcdf
2 changed files with 5 additions and 0 deletions
|
|
@ -195,6 +195,7 @@ async def websocket_analyze(websocket: WebSocket):
|
|||
logger.info(f"[MAIN] Authenticated user: {user_claims.get('name', 'unknown')}")
|
||||
|
||||
# Check role: oversight_admin cannot upload/analyze proofs
|
||||
current_user_id: Optional[uuid.UUID] = None
|
||||
try:
|
||||
async with _session_factory() as ws_session:
|
||||
ws_user_repo = UserRepository(ws_session)
|
||||
|
|
@ -206,6 +207,7 @@ async def websocket_analyze(websocket: WebSocket):
|
|||
"message": "Oversight Admin has read-only access and cannot analyze proofs."
|
||||
})
|
||||
continue
|
||||
current_user_id = ws_user.id if ws_user else None
|
||||
except Exception as role_err:
|
||||
logger.warning(f"[MAIN] Role check failed for client {client_id}: {role_err}")
|
||||
|
||||
|
|
@ -224,6 +226,7 @@ async def websocket_analyze(websocket: WebSocket):
|
|||
data=data,
|
||||
manager=manager,
|
||||
analysis_service=analysis_service,
|
||||
current_user_id=current_user_id,
|
||||
)
|
||||
else:
|
||||
logger.warning(f"[MAIN] Unknown message type: {data.get('type')}")
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ async def handle_analyze_message(
|
|||
data: dict,
|
||||
manager: ConnectionManager,
|
||||
analysis_service: AnalysisService,
|
||||
current_user_id: Optional[uuid.UUID] = None,
|
||||
) -> None:
|
||||
"""
|
||||
Handle an 'analyze' message from the client.
|
||||
|
|
@ -229,6 +230,7 @@ async def handle_analyze_message(
|
|||
overall_status=result.overallStatus,
|
||||
file_hash=file_hash,
|
||||
is_identical_file=is_identical_file,
|
||||
created_by=current_user_id,
|
||||
)
|
||||
|
||||
# Auto-create ErrorItem when analysis results in an error
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue