Do not use the builtin staff_member_required decorator.

Before 1.7, this decorator always redirects to the admin login page so the LOGIN_URL
setting is useless.
This commit is contained in:
Antoine Nguyen 2014-09-19 15:15:42 +02:00
parent 5e30c86561
commit 91628ab788

View File

@ -45,10 +45,7 @@ if helpdesk_settings.HELPDESK_ALLOW_NON_STAFF_TICKET_UPDATE:
# treat 'normal' users like 'staff' # treat 'normal' users like 'staff'
staff_member_required = user_passes_test(lambda u: u.is_authenticated() and u.is_active) staff_member_required = user_passes_test(lambda u: u.is_authenticated() and u.is_active)
else: else:
try: staff_member_required = user_passes_test(lambda u: u.is_authenticated() and u.is_active and u.is_staff)
from django.contrib.admin.views.decorators import staff_member_required
except:
staff_member_required = user_passes_test(lambda u: u.is_authenticated() and u.is_active and u.is_staff)
superuser_required = user_passes_test(lambda u: u.is_authenticated() and u.is_active and u.is_superuser) superuser_required = user_passes_test(lambda u: u.is_authenticated() and u.is_active and u.is_superuser)