Browse Source

feat:支持配置全局组织的显示名称 (#5919)

Co-authored-by: liubo <liubo@fit2cloud.com>
pull/5953/head^2
liuboF2c 4 years ago committed by xinwen
parent
commit
1ac8537a34
  1. 1
      apps/jumpserver/conf.py
  2. 3
      apps/jumpserver/settings/custom.py
  3. BIN
      apps/locale/zh/LC_MESSAGES/django.mo
  4. 8
      apps/locale/zh/LC_MESSAGES/django.po
  5. 4
      apps/orgs/models.py
  6. 4
      apps/settings/serializers/settings.py

1
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,

3
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

BIN
apps/locale/zh/LC_MESSAGES/django.mo

Binary file not shown.

8
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 "

4
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

4
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):

Loading…
Cancel
Save