forked from extern/django-helpdesk
is_authenticated is a bool now not a function
This commit is contained in:
parent
54a6b1d21b
commit
c71355cfdc
@ -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):
|
||||
"""
|
||||
|
@ -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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user