Merge branch 'v4_bain' into v4

pull/13283/head
Bai 2024-05-27 11:35:16 +08:00
commit 8ebdd59e00
14 changed files with 32 additions and 19 deletions

View File

@ -12,6 +12,7 @@ def _find(attr):
def add_encrypted_field_set(label): def add_encrypted_field_set(label):
return
if label: if label:
with translation.override('en'): with translation.override('en'):
encrypted_field_set.add(str(label)) encrypted_field_set.add(str(label))

View File

@ -3941,7 +3941,7 @@ msgstr ""
#: jumpserver/context_processor.py:14 #: jumpserver/context_processor.py:14
msgid "JumpServer Open Source Bastion Host" msgid "JumpServer Open Source Bastion Host"
msgstr "" msgstr "JumpServer"
#: jumpserver/views/celery_flower.py:22 #: jumpserver/views/celery_flower.py:22
msgid "<h1>Flower service unavailable, check it</h1>" msgid "<h1>Flower service unavailable, check it</h1>"
@ -5734,10 +5734,6 @@ msgstr ""
msgid "Virtual App" msgid "Virtual App"
msgstr "" msgstr ""
#: settings/serializers/feature.py:148
msgid "vApp"
msgstr ""
#: settings/serializers/feature.py:150 #: settings/serializers/feature.py:150
msgid "" msgid ""
"Virtual applications, you can use the Linux operating system as an " "Virtual applications, you can use the Linux operating system as an "
@ -6385,7 +6381,7 @@ msgstr ""
#: templates/_without_nav_base.html:26 #: templates/_without_nav_base.html:26
msgid "Home page" msgid "Home page"
msgstr "" msgstr "Home"
#: templates/resource_download.html:18 templates/resource_download.html:33 #: templates/resource_download.html:18 templates/resource_download.html:33
#: users/const.py:65 #: users/const.py:65

View File

@ -5954,10 +5954,6 @@ msgstr "コマンドフィルタリング"
msgid "Virtual App" msgid "Virtual App"
msgstr "仮想アプリケーション" msgstr "仮想アプリケーション"
#: settings/serializers/feature.py:148
msgid "vApp"
msgstr ""
#: settings/serializers/feature.py:150 #: settings/serializers/feature.py:150
msgid "" msgid ""
"Virtual applications, you can use the Linux operating system as an " "Virtual applications, you can use the Linux operating system as an "

View File

@ -5824,10 +5824,6 @@ msgstr "作业中心命令黑名单"
msgid "Virtual App" msgid "Virtual App"
msgstr "虚拟应用" msgstr "虚拟应用"
#: settings/serializers/feature.py:148
msgid "vApp"
msgstr ""
#: settings/serializers/feature.py:150 #: settings/serializers/feature.py:150
msgid "" msgid ""
"Virtual applications, you can use the Linux operating system as an " "Virtual applications, you can use the Linux operating system as an "

View File

@ -406,7 +406,7 @@
"DisplayName": "Name", "DisplayName": "Name",
"Docs": "Document", "Docs": "Document",
"Download": "Download", "Download": "Download",
"DownloadCenter": "Download center", "DownloadCenter": "Download",
"DownloadFTPFileTip": "The current action does not record files, or the file size exceeds the threshold (default 100m), or it has not yet been saved to the corresponding storage", "DownloadFTPFileTip": "The current action does not record files, or the file size exceeds the threshold (default 100m), or it has not yet been saved to the corresponding storage",
"DownloadImportTemplateMsg": "Download creation template", "DownloadImportTemplateMsg": "Download creation template",
"DownloadReplay": "Download recording", "DownloadReplay": "Download recording",

View File

@ -624,6 +624,7 @@ class Config(dict):
'LOKI_LOG_ENABLED': False, 'LOKI_LOG_ENABLED': False,
'LOKI_BASE_URL': 'http://loki:3100', 'LOKI_BASE_URL': 'http://loki:3100',
'TOOL_USER_ENABLED': False,
} }
old_config_map = { old_config_map = {

View File

@ -238,3 +238,5 @@ ANSIBLE_RECEPTOR_TCP_LISTEN_ADDRESS = CONFIG.ANSIBLE_RECEPTOR_TCP_LISTEN_ADDRESS
LOKI_LOG_ENABLED = CONFIG.LOKI_LOG_ENABLED LOKI_LOG_ENABLED = CONFIG.LOKI_LOG_ENABLED
LOKI_BASE_URL = CONFIG.LOKI_BASE_URL LOKI_BASE_URL = CONFIG.LOKI_BASE_URL
TOOL_USER_ENABLED = CONFIG.TOOL_USER_ENABLED

View File

@ -63,6 +63,7 @@ class SettingsApi(generics.RetrieveUpdateAPIView):
'ticket': serializers.TicketSettingSerializer, 'ticket': serializers.TicketSettingSerializer,
'ops': serializers.OpsSettingSerializer, 'ops': serializers.OpsSettingSerializer,
'virtualapp': serializers.VirtualAppSerializer, 'virtualapp': serializers.VirtualAppSerializer,
'tool': serializers.ToolSerializer,
} }
rbac_category_permissions = { rbac_category_permissions = {

View File

@ -13,3 +13,4 @@ from .public import *
from .security import * from .security import *
from .settings import * from .settings import *
from .terminal import * from .terminal import *
from .tool import *

View File

@ -145,7 +145,7 @@ class VirtualAppSerializer(serializers.Serializer):
PREFIX_TITLE = _('Virtual app') PREFIX_TITLE = _('Virtual app')
VIRTUAL_APP_ENABLED = serializers.BooleanField( VIRTUAL_APP_ENABLED = serializers.BooleanField(
required=False, label=_('vApp'), required=False, label=_('Virtual App'),
help_text=_( help_text=_(
'Virtual applications, you can use the Linux operating system as an application server ' 'Virtual applications, you can use the Linux operating system as an application server '
'in remote applications.' 'in remote applications.'

View File

@ -63,6 +63,7 @@ class PrivateSettingSerializer(PublicSettingSerializer):
GPT_MODEL = serializers.CharField() GPT_MODEL = serializers.CharField()
FILE_UPLOAD_SIZE_LIMIT_MB = serializers.IntegerField() FILE_UPLOAD_SIZE_LIMIT_MB = serializers.IntegerField()
LOKI_LOG_ENABLED = serializers.BooleanField() LOKI_LOG_ENABLED = serializers.BooleanField()
TOOL_USER_ENABLED = serializers.BooleanField()
class ServerInfoSerializer(serializers.Serializer): class ServerInfoSerializer(serializers.Serializer):

View File

@ -0,0 +1,18 @@
from django.utils.translation import gettext_lazy as _
from rest_framework import serializers
__all__ = [
'ToolSerializer'
]
class ToolSerializer(serializers.Serializer):
PREFIX_TITLE = _('Tool')
TOOL_USER_ENABLED = serializers.BooleanField(
label=_('Tools in the Workbench'), default=True,
help_text=_(
"*! If enabled, users with RBAC permissions will be able to utilize all "
"tools in the workbench"
)
)

View File

@ -176,7 +176,7 @@ class Applet(JMSBaseModel):
label_value = spec_label.label.value label_value = spec_label.label.value
matched = [host for host in hosts if host.name == label_value] matched = [host for host in hosts if host.name == label_value]
if matched: if matched:
return matched[0] return random.choice(matched)
hosts = [h for h in hosts if h.auto_create_accounts] hosts = [h for h in hosts if h.auto_create_accounts]
prefer_key = self.host_prefer_key_tpl.format(user.id) prefer_key = self.host_prefer_key_tpl.format(user.id)

View File

@ -8,7 +8,7 @@ from ...models import Preference
class BasicSerializer(serializers.Serializer): class BasicSerializer(serializers.Serializer):
has_secret_key = serializers.SerializerMethodField( has_secret_key = serializers.SerializerMethodField(
help_text=_( help_text=_(
'The password for file encryption, ' '*! The password for file encryption, '
'used for decryption when the system sends emails containing file attachments. ' 'used for decryption when the system sends emails containing file attachments. '
'<br>' '<br>'
'Such as: account backup files, account password change results files' 'Such as: account backup files, account password change results files'
@ -43,4 +43,4 @@ class BasicSerializer(serializers.Serializer):
class LinaSerializer(serializers.Serializer): class LinaSerializer(serializers.Serializer):
basic = BasicSerializer(required=False, label=_('Basic')) basic = BasicSerializer(required=False, label=_('File Encryption'))