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
|
# Insert pending immediatement (route, pas thread) pour eviter race condition
|
||||||
run_id = db.execute(text("""INSERT INTO qualys_vuln_snapshot_run (status, triggered_by)
|
run_id = db.execute(text("""INSERT INTO qualys_vuln_snapshot_run (status, triggered_by)
|
||||||
VALUES ('pending', :tb) RETURNING id"""),
|
VALUES ('pending', :tb) RETURNING id"""),
|
||||||
{"tb": f"manual:{user.username}"}).scalar()
|
{"tb": f"manual:{user.get('sub','?')}"}).scalar()
|
||||||
db.commit()
|
db.commit()
|
||||||
import threading
|
import threading
|
||||||
def _runner(rid):
|
def _runner(rid):
|
||||||
from app.database import SessionLocal
|
from app.database import SessionLocal
|
||||||
s = SessionLocal()
|
s = SessionLocal()
|
||||||
try:
|
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:
|
finally:
|
||||||
s.close()
|
s.close()
|
||||||
threading.Thread(target=_runner, args=(run_id,), daemon=True).start()
|
threading.Thread(target=_runner, args=(run_id,), daemon=True).start()
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user