Jul 9 - Update Inspector can't see QR codes at all

This commit is contained in:
2026-07-09 11:30:25 -04:00
parent 5689957682
commit 40ac335f5a
2 changed files with 10 additions and 7 deletions
+8 -7
View File
@@ -191,16 +191,17 @@ def facility_qr_regenerate(facility_id):
def facility_qr_print_all():
"""Printable sheet of QR codes for all facilities the user can see.
Optional ?contract_id=<id> limits the sheet to one contract. Inspectors are
scoped to their contracted facilities; customers to their assigned
facilities; managers see all active facilities.
Optional ?contract_id=<id> limits the sheet to one contract. Inspectors have
no QR management (403); customers are scoped to their assigned facilities;
managers see all active facilities.
"""
# QR management is not an inspector task.
if current_user.role == 'inspector':
abort(403)
contract_id = request.args.get('contract_id', type=int)
if current_user.role == 'inspector':
fids = get_inspector_scope(current_user) or []
query = Facility.query.filter(Facility.id.in_(fids), Facility.active == True)
elif current_user.role == 'customer':
if current_user.role == 'customer':
fids = get_customer_scope(current_user) or []
query = Facility.query.filter(Facility.id.in_(fids), Facility.active == True)
else:
+2
View File
@@ -8,10 +8,12 @@
<h2><i class="bi bi-building"></i> Facilities</h2>
</div>
<div class="col-md-6 text-end">
{% if current_user.role != 'inspector' %}
<a href="{{ url_for('facilities.facility_qr_print_all') }}"
class="btn btn-outline-dark" title="Printable sheet of your facilities' QR codes">
<i class="bi bi-qr-code"></i> Print All QR Codes
</a>
{% endif %}
{% if current_user.role in ['admin', 'director'] %}
<a href="{{ url_for('facilities.create_facility') }}" class="btn btn-primary">
<i class="bi bi-plus-circle"></i> Add Facility