mirror of
https://gitea.mueller.network/extern/django-helpdesk.git
synced 2024-11-22 07:53:19 +01:00
validate that HELPDESK_CUSTOM_STAFF_FILTER_CALLBACK is callable, if set
This commit is contained in:
parent
c0dd6ea075
commit
b7e8ae5ee5
@ -4,6 +4,7 @@ Default settings for django-helpdesk.
|
||||
"""
|
||||
import warnings
|
||||
from django.conf import settings
|
||||
from django.core.exceptions import ImproperlyConfigured
|
||||
|
||||
|
||||
try:
|
||||
@ -66,6 +67,8 @@ HELPDESK_ALLOW_NON_STAFF_TICKET_UPDATE = getattr(settings, 'HELPDESK_ALLOW_NON_S
|
||||
|
||||
# apply a custom authorisation logic when defining 'helpdesk_staff_member_required' in staff.py.
|
||||
HELPDESK_CUSTOM_STAFF_FILTER_CALLBACK = getattr(settings, 'HELPDESK_CUSTOM_STAFF_FILTER_CALLBACK', None)
|
||||
if not (HELPDESK_CUSTOM_STAFF_FILTER_CALLBACK is None or callable(HELPDESK_CUSTOM_STAFF_FILTER_CALLBACK)):
|
||||
raise ImproperlyConfigured("HELPDESK_CUSTOM_STAFF_FILTER_CALLBACK must be a callable or None")
|
||||
if HELPDESK_CUSTOM_STAFF_FILTER_CALLBACK and HELPDESK_ALLOW_NON_STAFF_TICKET_UPDATE:
|
||||
warnings.warn(
|
||||
"The HELPDESK_ALLOW_NON_STAFF_TICKET_UPDATE and HELPDESK_CUSTOM_STAFF_FILTER_CALLBACK settings cannot be both defined. "
|
||||
|
Loading…
Reference in New Issue
Block a user