Make camera access authorization fully asynchronous when checking whether a user is an administrator, preserving existing authorization outcomes and honoring cancellation.
Pourquoi
The synchronous role lookup blocks a thread during async authorization and database access, reducing request throughput and surfacing a blocking-call warning.
État actuel et preuves
Implemented: CameraAccessService currently checks Identity UserRoles synchronously in IsAdmin.
Local evidence: GlitchTip HEIMDALL-D0 (#7447) reports the blocking call; no fix or validation has been recorded yet.
CI evidence: none for this issue yet.
Production/hardware evidence: the warning is application-side; no deployment validation is required.
Écart à résoudre
The private IsAdmin method calls synchronous EF Any over UserRoles, and callers execute it inside asynchronous camera/site access methods.
Analyse
Use an asynchronous EF Core existence query with the caller's CancellationToken. Keep the same user-id guard, role predicate, and authorization result. Verify translation and behavior with PostgreSQL-backed relational tests; no schema changes are expected.
Plan de travail
Search open and closed Gitea issues for this warning and reuse a matching ticket where present.
Update CameraAccessService and focused tests to propagate cancellation and preserve admin/non-admin behavior.
Run focused infrastructure tests, PostgreSQL relational validation, and persistence policy checks.
Run the mandatory disposable Compose acceptance against changed source with unique credentials, project resources, and image tags; record and verify cleanup.
Update this issue with evidence and link the pull request.
Critères d’acceptation
CameraAccessService performs admin role lookup asynchronously through EF Core and passes the operation CancellationToken.
Existing admin and non-admin camera/site authorization outcomes are unchanged.
PostgreSQL-backed test passed: CameraAccessAdminPostgresTests.Admin_role_lookup_and_camera_authorization_translate_and_preserve_results verifies admin and viewer camera/site outcomes through Npgsql.
Disposable Compose acceptance passed from changed source: project heimdall-7447-accept-20261107170319-23018, Central /healthz returned 200 and unauthenticated /api/events returned 401. Cleanup verified project containers, volumes, and network absent, and exact local image tag heimdall:heimdall-7447-accept-20261107170319-23018-central absent; shared base images retained.
Pull request links this issue; close only after all criteria are complete.
Hors périmètre / dépendances
No role model, schema, API contract, or deployment change. Requires local Docker and PostgreSQL test support; no production camera or customer data is needed.
Maquette
Aucune maquette requise : this is an infrastructure authorization fix.
The async role lookup and cancellation token are covered by the PostgreSQL test above. The source-based disposable Compose recipe used only synthetic generated credentials, isolated ports, project volumes/network and a unique image tag; teardown and exact-tag image removal were verified. Pull request: #286
Commit: d86171f
## Résumé
Make camera access authorization fully asynchronous when checking whether a user is an administrator, preserving existing authorization outcomes and honoring cancellation.
## Pourquoi
The synchronous role lookup blocks a thread during async authorization and database access, reducing request throughput and surfacing a blocking-call warning.
## État actuel et preuves
- Implemented: CameraAccessService currently checks Identity UserRoles synchronously in IsAdmin.
- Local evidence: GlitchTip HEIMDALL-D0 (#7447) reports the blocking call; no fix or validation has been recorded yet.
- CI evidence: none for this issue yet.
- Production/hardware evidence: the warning is application-side; no deployment validation is required.
## Écart à résoudre
The private IsAdmin method calls synchronous EF Any over UserRoles, and callers execute it inside asynchronous camera/site access methods.
## Analyse
Use an asynchronous EF Core existence query with the caller's CancellationToken. Keep the same user-id guard, role predicate, and authorization result. Verify translation and behavior with PostgreSQL-backed relational tests; no schema changes are expected.
## Plan de travail
1. Search open and closed Gitea issues for this warning and reuse a matching ticket where present.
2. Update CameraAccessService and focused tests to propagate cancellation and preserve admin/non-admin behavior.
3. Run focused infrastructure tests, PostgreSQL relational validation, and persistence policy checks.
4. Run the mandatory disposable Compose acceptance against changed source with unique credentials, project resources, and image tags; record and verify cleanup.
5. Update this issue with evidence and link the pull request.
## Critères d’acceptation
- [x] CameraAccessService performs admin role lookup asynchronously through EF Core and passes the operation CancellationToken.
- [x] Existing admin and non-admin camera/site authorization outcomes are unchanged.
- [x] PostgreSQL-backed test passed: `CameraAccessAdminPostgresTests.Admin_role_lookup_and_camera_authorization_translate_and_preserve_results` verifies admin and viewer camera/site outcomes through Npgsql.
- [x] Focused Infrastructure tests passed (26/26); Web `ResourceAccessTests` passed (14/14); `scripts/ci/check-efcore-usage.py` passed.
- [x] Disposable Compose acceptance passed from changed source: project `heimdall-7447-accept-20261107170319-23018`, Central `/healthz` returned 200 and unauthenticated `/api/events` returned 401. Cleanup verified project containers, volumes, and network absent, and exact local image tag `heimdall:heimdall-7447-accept-20261107170319-23018-central` absent; shared base images retained.
- [x] Pull request links this issue; close only after all criteria are complete.
## Hors périmètre / dépendances
No role model, schema, API contract, or deployment change. Requires local Docker and PostgreSQL test support; no production camera or customer data is needed.
## Maquette
Aucune maquette requise : this is an infrastructure authorization fix.
## Liens
- GlitchTip: HEIMDALL-D0 (#7447)
- Focused skill: skills/camera-access-async-admin-check/SKILL.md
## Validation evidence (2026-11-07)
The async role lookup and cancellation token are covered by the PostgreSQL test above. The source-based disposable Compose recipe used only synthetic generated credentials, isolated ports, project volumes/network and a unique image tag; teardown and exact-tag image removal were verified. Pull request: https://sources.tordais.cc/arnaud.dartois/Heimdall/pulls/286
Commit: `d86171f`
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Résumé
Make camera access authorization fully asynchronous when checking whether a user is an administrator, preserving existing authorization outcomes and honoring cancellation.
Pourquoi
The synchronous role lookup blocks a thread during async authorization and database access, reducing request throughput and surfacing a blocking-call warning.
État actuel et preuves
Écart à résoudre
The private IsAdmin method calls synchronous EF Any over UserRoles, and callers execute it inside asynchronous camera/site access methods.
Analyse
Use an asynchronous EF Core existence query with the caller's CancellationToken. Keep the same user-id guard, role predicate, and authorization result. Verify translation and behavior with PostgreSQL-backed relational tests; no schema changes are expected.
Plan de travail
Critères d’acceptation
CameraAccessAdminPostgresTests.Admin_role_lookup_and_camera_authorization_translate_and_preserve_resultsverifies admin and viewer camera/site outcomes through Npgsql.ResourceAccessTestspassed (14/14);scripts/ci/check-efcore-usage.pypassed.heimdall-7447-accept-20261107170319-23018, Central/healthzreturned 200 and unauthenticated/api/eventsreturned 401. Cleanup verified project containers, volumes, and network absent, and exact local image tagheimdall:heimdall-7447-accept-20261107170319-23018-centralabsent; shared base images retained.Hors périmètre / dépendances
No role model, schema, API contract, or deployment change. Requires local Docker and PostgreSQL test support; no production camera or customer data is needed.
Maquette
Aucune maquette requise : this is an infrastructure authorization fix.
Liens
Validation evidence (2026-11-07)
The async role lookup and cancellation token are covered by the PostgreSQL test above. The source-based disposable Compose recipe used only synthetic generated credentials, isolated ports, project volumes/network and a unique image tag; teardown and exact-tag image removal were verified. Pull request: #286
Commit:
d86171f