diff --git a/apps/acls/serializers/base.py b/apps/acls/serializers/base.py index 09f75bf42..8fc335496 100644 --- a/apps/acls/serializers/base.py +++ b/apps/acls/serializers/base.py @@ -68,7 +68,7 @@ class ActionAclSerializer(serializers.Serializer): field_action = self.fields.get("action") if not field_action: return - if not settings.XPACK_LICENSE_IS_VALID: + if not (settings.XPACK_LICENSE_IS_VALID and settings.TICKETS_ENABLED): field_action._choices.pop(ActionChoices.review, None) for choice in self.Meta.action_choices_exclude: field_action._choices.pop(choice, None) diff --git a/apps/authentication/urls/api_urls.py b/apps/authentication/urls/api_urls.py index 3bb7898df..70306718b 100644 --- a/apps/authentication/urls/api_urls.py +++ b/apps/authentication/urls/api_urls.py @@ -1,5 +1,6 @@ # coding:utf-8 # +from django.conf import settings from django.urls import path from rest_framework.routers import DefaultRouter @@ -31,7 +32,13 @@ urlpatterns = [ path('mfa/send-code/', api.MFASendCodeApi.as_view(), name='mfa-send-code'), path('password/reset-code/', api.UserResetPasswordSendCodeApi.as_view(), name='reset-password-code'), path('password/verify/', api.UserPasswordVerifyApi.as_view(), name='user-password-verify'), +] + +ticket_urlpatterns = [ path('login-confirm-ticket/status/', api.TicketStatusApi.as_view(), name='login-confirm-ticket-status'), ] +if settings.TICKETS_ENABLED: + urlpatterns.extend(ticket_urlpatterns) + urlpatterns += router.urls + passkey_urlpatterns diff --git a/apps/jumpserver/settings/custom.py b/apps/jumpserver/settings/custom.py index ed5cc61a9..ab11dae12 100644 --- a/apps/jumpserver/settings/custom.py +++ b/apps/jumpserver/settings/custom.py @@ -135,8 +135,9 @@ AUTH_EXPIRED_SECONDS = 60 * 10 CHANGE_AUTH_PLAN_SECURE_MODE_ENABLED = CONFIG.CHANGE_AUTH_PLAN_SECURE_MODE_ENABLED DATETIME_DISPLAY_FORMAT = '%Y-%m-%d %H:%M:%S' +# TICKETS_ENABLED always disabled +TICKETS_ENABLED = False -TICKETS_ENABLED = CONFIG.TICKETS_ENABLED REFERER_CHECK_ENABLED = CONFIG.REFERER_CHECK_ENABLED CONNECTION_TOKEN_ENABLED = CONFIG.CONNECTION_TOKEN_ENABLED diff --git a/apps/settings/serializers/feature.py b/apps/settings/serializers/feature.py index 79b8943a8..9d750ddcf 100644 --- a/apps/settings/serializers/feature.py +++ b/apps/settings/serializers/feature.py @@ -108,7 +108,7 @@ class ChatAISettingSerializer(serializers.Serializer): class TicketSettingSerializer(serializers.Serializer): PREFIX_TITLE = _('Ticket') - TICKETS_ENABLED = serializers.BooleanField(required=False, default=True, label=_("Ticket")) + # TICKETS_ENABLED = serializers.BooleanField(required=False, default=True, label=_("Ticket")) TICKET_AUTHORIZE_DEFAULT_TIME = serializers.IntegerField( min_value=1, max_value=999999, required=False, label=_("Default period") diff --git a/apps/tickets/urls/api_urls.py b/apps/tickets/urls/api_urls.py index 88b203d84..28b3a2fa4 100644 --- a/apps/tickets/urls/api_urls.py +++ b/apps/tickets/urls/api_urls.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- # +from django.conf import settings from django.urls import path from rest_framework_bulk.routes import BulkRouter @@ -24,3 +25,6 @@ urlpatterns = [ path('super-tickets//status/', api.SuperTicketStatusAPI.as_view(), name='super-ticket-status'), ] urlpatterns += router.urls + +if not settings.TICKETS_ENABLED: + urlpatterns = [] diff --git a/apps/tickets/urls/view_urls.py b/apps/tickets/urls/view_urls.py index f9fcaab84..8f478f613 100644 --- a/apps/tickets/urls/view_urls.py +++ b/apps/tickets/urls/view_urls.py @@ -1,6 +1,7 @@ # coding:utf-8 # +from django.conf import settings from django.urls import path from .. import views @@ -10,3 +11,6 @@ app_name = 'tickets' urlpatterns = [ path('direct-approve//', views.TicketDirectApproveView.as_view(), name='direct-approve'), ] + +if not settings.TICKETS_ENABLED: + urlpatterns = []