mirror of
https://gitea.mueller.network/extern/django-helpdesk.git
synced 2024-12-25 16:18:51 +01:00
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
|
is_helpdesk_staff = helpdesk_settings.HELPDESK_ALLOW_NON_STAFF_TICKET_UPDATE
|
||||||
elif helpdesk_settings.HELPDESK_ALLOW_NON_STAFF_TICKET_UPDATE:
|
elif helpdesk_settings.HELPDESK_ALLOW_NON_STAFF_TICKET_UPDATE:
|
||||||
# treat 'normal' users like 'staff'
|
# 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:
|
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_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):
|
def protect_view(view_func):
|
||||||
"""
|
"""
|
||||||
|
@ -113,7 +113,7 @@ class CustomStaffUserTestCase(StaffUserTestCaseMixin, TestCase):
|
|||||||
@staticmethod
|
@staticmethod
|
||||||
def custom_staff_filter(user):
|
def custom_staff_filter(user):
|
||||||
"""Arbitrary user validation function"""
|
"""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
|
HELPDESK_ALLOW_NON_STAFF_TICKET_UPDATE = custom_staff_filter
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user