Skip to content

Commit

Permalink
update checklist_filter logic
Browse files Browse the repository at this point in the history
  • Loading branch information
HadronCollider committed Aug 26, 2024
1 parent 95a1726 commit 45a3e4f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions app/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -489,8 +489,8 @@ def check_list_data():


def get_query(req):
# query for download csv/zip
filter_query = checklist_filter(req.args)
# query for download csv/zip (only for admins)
filter_query = checklist_filter(req.args, is_admin=True)
limit = False
offset = False
sort = req.args.get("sort", "")
Expand Down
4 changes: 2 additions & 2 deletions app/utils/checklist_filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
logger = logging.getLogger('root_logger')
FILTER_PREFIX = 'filter_'

def checklist_filter(data):
def checklist_filter(data, is_admin=False):
from utils import timezone_offset

filters = {key[len(FILTER_PREFIX):]: data[key] for key in data if key.startswith(FILTER_PREFIX)}
Expand Down Expand Up @@ -80,7 +80,7 @@ def checklist_filter(data):
logger.warning(repr(e))

# set user filter for current non-admin user
if not current_user.is_admin:
if not (is_admin or current_user.is_admin):
filter_query["user"] = current_user.username

return filter_query

0 comments on commit 45a3e4f

Please sign in to comment.