perf: remove ticket model

pull/13145/head
feng 2024-04-28 17:43:26 +08:00 committed by Bryan
parent 8aa707427f
commit 94567b86f0
6 changed files with 19 additions and 3 deletions

View File

@ -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)

View File

@ -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

View File

@ -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

View File

@ -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")

View File

@ -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/<uuid:pk>/status/', api.SuperTicketStatusAPI.as_view(), name='super-ticket-status'),
]
urlpatterns += router.urls
if not settings.TICKETS_ENABLED:
urlpatterns = []

View File

@ -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/<str:token>/', views.TicketDirectApproveView.as_view(), name='direct-approve'),
]
if not settings.TICKETS_ENABLED:
urlpatterns = []