Reject invalid optional access callbacks

This commit is contained in:
Angel Capetillo Zavala
2026-11-13 18:19:39 -06:00
parent 1d8cd264b8
commit 10f0c59975
2 changed files with 3 additions and 1 deletions
+2
View File
@@ -47,6 +47,8 @@ def test_regular_followup_checks_access_and_suppression(client):
assert client.get('/cama/seguimiento?corte=2026-10-20&birads=BIRADS_4', headers=headers).status_code == 403
assert client.get('/cama/seguimiento?corte=2026-10-20&estatus=BENIGNO', headers=headers).status_code == 400
assert client.get('/cama/seguimiento?revision=' + '0' * 64, headers=headers).status_code == 400
client.application.config['CAMA_COHORT_ACCESS'] = 'invalid'
assert client.get('/cama/seguimiento', headers=headers).status_code == 403
def test_disabled_provider_and_empty_window(client):
+1 -1
View File
@@ -45,7 +45,7 @@ def cutoff_arg(args):
def patient_access():
check = current_app.config.get('CAMA_COHORT_ACCESS')
if callable(check) and not check(request):
if check is not None and (not callable(check) or not check(request)):
raise SelectionError('Acceso no autorizado', 403)