From 8dfae58663d9ff9828c0bf9bfa7de8468f467a26 Mon Sep 17 00:00:00 2001 From: David Whittaker <84562015+whitdog47@users.noreply.github.com> Date: Fri, 29 Sep 2023 15:28:27 -0700 Subject: [PATCH] Fixing restricted query statement (#3822) --- src/dispatch/database/service.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/dispatch/database/service.py b/src/dispatch/database/service.py index a7f6d297d640..e404b96a7d7b 100644 --- a/src/dispatch/database/service.py +++ b/src/dispatch/database/service.py @@ -504,12 +504,13 @@ def search_filter_sort_paginate( sort = False if sort_by else True query = search(query_str=query_str, query=query, model=model, sort=sort) + query_restricted = apply_model_specific_filters(model_cls, query, current_user, role) + if filter_spec: query = apply_filter_specific_joins(model_cls, filter_spec, query) query = apply_filters(query, filter_spec, model_cls) if model == "Incident": - query_restricted = apply_model_specific_filters(model_cls, query, current_user, role) query = query.intersect(query_restricted) if sort_by: