From e7e27aa038e2642a298515c8b98e41f62b114ebe Mon Sep 17 00:00:00 2001 From: dzhuang Date: Wed, 31 May 2017 23:55:48 +0800 Subject: [PATCH] Return False for anonymous users if only if_has_participation_tags_any or if_has_participation_tags_all is not empty. --- course/utils.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/course/utils.py b/course/utils.py index 0349d806..336e980c 100644 --- a/course/utils.py +++ b/course/utils.py @@ -209,15 +209,17 @@ def _eval_participation_tags_conditions( ): # type: (...) -> bool - if not participation: - return False - participation_tags_any_set = ( set(getattr(rule, "if_has_participation_tags_any", []))) participation_tags_all_set = ( set(getattr(rule, "if_has_participation_tags_all", []))) if participation_tags_any_set or participation_tags_all_set: + if not participation: + # Return False for anonymous users if only + # if_has_participation_tags_any or if_has_participation_tags_all + # is not empty. + return False ptag_set = set(participation.tags.all().values_list("name", flat=True)) if not ptag_set: return False -- GitLab