fix(qualys/dashboard): user est un dict, utiliser user.get(sub) au lieu de .username
This commit is contained in:
parent
9a7f446637
commit
34cca6f77b
@ -1222,14 +1222,14 @@ async def qualys_dashboard_refresh(request: Request, db=Depends(get_db)):
|
||||
# Insert pending immediatement (route, pas thread) pour eviter race condition
|
||||
run_id = db.execute(text("""INSERT INTO qualys_vuln_snapshot_run (status, triggered_by)
|
||||
VALUES ('pending', :tb) RETURNING id"""),
|
||||
{"tb": f"manual:{user.username}"}).scalar()
|
||||
{"tb": f"manual:{user.get('sub','?')}"}).scalar()
|
||||
db.commit()
|
||||
import threading
|
||||
def _runner(rid):
|
||||
from app.database import SessionLocal
|
||||
s = SessionLocal()
|
||||
try:
|
||||
compute_vuln_dashboard(s, triggered_by=f"manual:{user.username}", run_id=rid)
|
||||
compute_vuln_dashboard(s, triggered_by=f"manual:{user.get('sub','?')}", run_id=rid)
|
||||
finally:
|
||||
s.close()
|
||||
threading.Thread(target=_runner, args=(run_id,), daemon=True).start()
|
||||
|
||||
Loading…
Reference in New Issue
Block a user