diff --git a/apps/jumpserver/conf.py b/apps/jumpserver/conf.py index f4a1c6641..d09a81bd2 100644 --- a/apps/jumpserver/conf.py +++ b/apps/jumpserver/conf.py @@ -143,6 +143,7 @@ class Config(dict): 'REDIS_DB_SESSION': 5, 'REDIS_DB_WS': 6, + 'GLOBAL_ORG_DISPLAY_NAME': '', 'SITE_URL': 'http://localhost:8080', 'CAPTCHA_TEST_MODE': None, 'TOKEN_EXPIRATION': 3600 * 24, diff --git a/apps/jumpserver/settings/custom.py b/apps/jumpserver/settings/custom.py index 394c8707a..89b8d6d53 100644 --- a/apps/jumpserver/settings/custom.py +++ b/apps/jumpserver/settings/custom.py @@ -120,3 +120,6 @@ CONNECTION_TOKEN_ENABLED = CONFIG.CONNECTION_TOKEN_ENABLED DISK_CHECK_ENABLED = CONFIG.DISK_CHECK_ENABLED FORGOT_PASSWORD_URL = CONFIG.FORGOT_PASSWORD_URL + +# 自定义默认组织名 +GLOBAL_ORG_DISPLAY_NAME = CONFIG.GLOBAL_ORG_DISPLAY_NAME diff --git a/apps/locale/zh/LC_MESSAGES/django.mo b/apps/locale/zh/LC_MESSAGES/django.mo index b8d77bd57..2864b472f 100644 Binary files a/apps/locale/zh/LC_MESSAGES/django.mo and b/apps/locale/zh/LC_MESSAGES/django.mo differ diff --git a/apps/locale/zh/LC_MESSAGES/django.po b/apps/locale/zh/LC_MESSAGES/django.po index 152475b14..763d9d2e5 100644 --- a/apps/locale/zh/LC_MESSAGES/django.po +++ b/apps/locale/zh/LC_MESSAGES/django.po @@ -2077,6 +2077,14 @@ msgstr "用户第一次登录,修改profile后重定向到地址, 可以是 wi msgid "Forgot password url" msgstr "忘记密码URL" +#: settings/serializers/settings.py:23 +msgid "Global organization name" +msgstr "全局组织名" + +#: settings/serializers/settings.py:23 +msgid "The name of global organization to display" +msgstr "全局组织的显示名称,默认为 全局组织" + #: settings/serializers/settings.py:24 msgid "" "The forgot password url on login page, If you use ldap or cas external " diff --git a/apps/orgs/models.py b/apps/orgs/models.py index 26f39c231..310bc709a 100644 --- a/apps/orgs/models.py +++ b/apps/orgs/models.py @@ -7,7 +7,7 @@ from django.db.models import signals from django.db.models import Q from django.utils.translation import ugettext_lazy as _ -from common.utils import is_uuid, lazyproperty +from common.utils import lazyproperty, settings from common.const import choices from common.db.models import ChoiceSet @@ -193,7 +193,7 @@ class Organization(models.Model): @classmethod def root(cls): - return cls(id=cls.ROOT_ID, name=cls.ROOT_NAME) + return cls(id=cls.ROOT_ID, name=settings.GLOBAL_ORG_DISPLAY_NAME if settings.GLOBAL_ORG_DISPLAY_NAME else cls.ROOT_NAME) def is_root(self): return self.id == self.ROOT_ID diff --git a/apps/settings/serializers/settings.py b/apps/settings/serializers/settings.py index b2b4d7707..c6a3c32ac 100644 --- a/apps/settings/serializers/settings.py +++ b/apps/settings/serializers/settings.py @@ -24,6 +24,10 @@ class BasicSettingSerializer(serializers.Serializer): help_text=_('The forgot password url on login page, If you use ' 'ldap or cas external authentication, you can set it') ) + GLOBAL_ORG_DISPLAY_NAME = serializers.CharField( + required=False, max_length=1024, allow_blank=True, allow_null=True, label=_("Global organization name"), + help_text=_('The name of global organization to display') + ) class EmailSettingSerializer(serializers.Serializer):