From c71355cfdc7b4b51a5a882910d5a4350e4b83ef0 Mon Sep 17 00:00:00 2001 From: Garret Wassermann Date: Sun, 4 Mar 2018 04:24:30 -0500 Subject: [PATCH] is_authenticated is a bool now not a function --- helpdesk/decorators.py | 6 +++--- helpdesk/tests/test_navigation.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/helpdesk/decorators.py b/helpdesk/decorators.py index e448435e..6632d1c3 100644 --- a/helpdesk/decorators.py +++ b/helpdesk/decorators.py @@ -12,12 +12,12 @@ if callable(helpdesk_settings.HELPDESK_ALLOW_NON_STAFF_TICKET_UPDATE): is_helpdesk_staff = helpdesk_settings.HELPDESK_ALLOW_NON_STAFF_TICKET_UPDATE elif helpdesk_settings.HELPDESK_ALLOW_NON_STAFF_TICKET_UPDATE: # treat 'normal' users like 'staff' - is_helpdesk_staff = lambda u: u.is_authenticated() and u.is_active + is_helpdesk_staff = lambda u: u.is_authenticated and u.is_active else: - is_helpdesk_staff = lambda u: u.is_authenticated() and u.is_active and u.is_staff + is_helpdesk_staff = lambda u: u.is_authenticated and u.is_active and u.is_staff helpdesk_staff_member_required = user_passes_test(is_helpdesk_staff) -helpdesk_superuser_required = user_passes_test(lambda u: u.is_authenticated() and u.is_active and u.is_superuser) +helpdesk_superuser_required = user_passes_test(lambda u: u.is_authenticated and u.is_active and u.is_superuser) def protect_view(view_func): """ diff --git a/helpdesk/tests/test_navigation.py b/helpdesk/tests/test_navigation.py index 95d29655..a402950c 100644 --- a/helpdesk/tests/test_navigation.py +++ b/helpdesk/tests/test_navigation.py @@ -113,7 +113,7 @@ class CustomStaffUserTestCase(StaffUserTestCaseMixin, TestCase): @staticmethod def custom_staff_filter(user): """Arbitrary user validation function""" - return user.is_authenticated() and user.is_active and user.username.lower().endswith('wensleydale') + return user.is_authenticated and user.is_active and user.username.lower().endswith('wensleydale') HELPDESK_ALLOW_NON_STAFF_TICKET_UPDATE = custom_staff_filter