Merge pull request #6117 from jumpserver/dev

v2.10.0 rc2
pull/6160/head
Jiangjie.Bai 2021-05-14 19:20:40 +08:00 committed by GitHub
commit c42f69d1ba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 39 additions and 23 deletions

View File

@ -103,6 +103,12 @@ class SystemUserSerializer(AuthSerializerMixin, BulkOrgResourceModelSerializer):
raise serializers.ValidationError(msg)
return username
def validate_home(self, home):
username_same_with_user = self.initial_data.get("username_same_with_user")
if username_same_with_user:
return ''
return home
def validate_sftp_root(self, value):
if value in ['home', 'tmp']:
return value

View File

@ -132,7 +132,9 @@ AUTH_BACKEND_WECOM = 'authentication.backends.api.WeComAuthentication'
AUTH_BACKEND_DINGTALK = 'authentication.backends.api.DingTalkAuthentication'
AUTHENTICATION_BACKENDS = [AUTH_BACKEND_MODEL, AUTH_BACKEND_PUBKEY]
AUTHENTICATION_BACKENDS = [
AUTH_BACKEND_MODEL, AUTH_BACKEND_PUBKEY, AUTH_BACKEND_WECOM, AUTH_BACKEND_DINGTALK
]
if AUTH_CAS:
AUTHENTICATION_BACKENDS.insert(0, AUTH_BACKEND_CAS)
@ -143,10 +145,6 @@ if AUTH_RADIUS:
AUTHENTICATION_BACKENDS.insert(0, AUTH_BACKEND_RADIUS)
if AUTH_SSO:
AUTHENTICATION_BACKENDS.append(AUTH_BACKEND_SSO)
if AUTH_WECOM:
AUTHENTICATION_BACKENDS.append(AUTH_BACKEND_WECOM)
if AUTH_DINGTALK:
AUTHENTICATION_BACKENDS.append(AUTH_BACKEND_DINGTALK)
ONLY_ALLOW_EXIST_USER_AUTH = CONFIG.ONLY_ALLOW_EXIST_USER_AUTH

Binary file not shown.

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: JumpServer 0.3.3\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-05-13 19:30+0800\n"
"POT-Creation-Date: 2021-05-14 16:12+0800\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: ibuler <ibuler@qq.com>\n"
"Language-Team: JumpServer team<ibuler@qq.com>\n"
@ -122,7 +122,7 @@ msgstr "系统用户"
#: assets/models/asset.py:355 assets/models/authbook.py:26
#: assets/models/gathered_user.py:14 assets/serializers/admin_user.py:34
#: assets/serializers/asset_user.py:48 assets/serializers/asset_user.py:89
#: assets/serializers/system_user.py:195 audits/models.py:38
#: assets/serializers/system_user.py:201 audits/models.py:38
#: perms/models/asset_permission.py:99 templates/index.html:82
#: terminal/backends/command/models.py:19
#: terminal/backends/command/serializers.py:13 terminal/models/session.py:40
@ -674,7 +674,7 @@ msgstr "全称"
msgid "Parent key"
msgstr "ssh私钥"
#: assets/models/node.py:559 assets/serializers/system_user.py:194
#: assets/models/node.py:559 assets/serializers/system_user.py:200
#: users/templates/users/user_asset_permission.html:41
#: users/templates/users/user_asset_permission.html:73
#: users/templates/users/user_asset_permission.html:158
@ -839,7 +839,7 @@ msgid "Gateways count"
msgstr "网关数量"
#: assets/serializers/label.py:13 assets/serializers/system_user.py:47
#: assets/serializers/system_user.py:169
#: assets/serializers/system_user.py:175
#: perms/serializers/asset/permission.py:74
msgid "Assets amount"
msgstr "资产数量"
@ -861,17 +861,17 @@ msgstr "不能包含: /"
msgid "The same level node name cannot be the same"
msgstr "同级别节点名字不能重复"
#: assets/serializers/system_user.py:46 assets/serializers/system_user.py:168
#: assets/serializers/system_user.py:46 assets/serializers/system_user.py:174
#: perms/serializers/asset/permission.py:75
msgid "Nodes amount"
msgstr "节点数量"
#: assets/serializers/system_user.py:48 assets/serializers/system_user.py:170
#: assets/serializers/system_user.py:196
#: assets/serializers/system_user.py:48 assets/serializers/system_user.py:176
#: assets/serializers/system_user.py:202
msgid "Login mode display"
msgstr "登录模式(显示名称)"
#: assets/serializers/system_user.py:50 assets/serializers/system_user.py:172
#: assets/serializers/system_user.py:50 assets/serializers/system_user.py:178
msgid "Ad domain"
msgstr "Ad 网域"
@ -883,11 +883,11 @@ msgstr "用户名和用户相同的一种协议只允许存在一个"
msgid "* Automatic login mode must fill in the username."
msgstr "自动登录模式,必须填写用户名"
#: assets/serializers/system_user.py:110
#: assets/serializers/system_user.py:116
msgid "Path should starts with /"
msgstr "路径应该以 / 开头"
#: assets/serializers/system_user.py:121
#: assets/serializers/system_user.py:127
msgid "Password or private key required"
msgstr "密码或密钥密码需要一个"
@ -3519,11 +3519,15 @@ msgstr "工单处理人"
msgid "Ticket basic info"
msgstr "工单基本信息"
#: tickets/handler/base.py:114
#: tickets/handler/base.py:114 tickets/handler/base.py:121
msgid "No content"
msgstr "无内容"
#: tickets/handler/base.py:116
msgid "Ticket applied info"
msgstr "工单申请信息"
#: tickets/handler/base.py:119
#: tickets/handler/base.py:123
msgid "Ticket approved info"
msgstr "工单批准信息"
@ -4949,7 +4953,7 @@ msgstr "实例个数"
msgid "Periodic display"
msgstr "定时执行"
#: xpack/plugins/cloud/utils.py:64
#: xpack/plugins/cloud/utils.py:65
msgid "Account unavailable"
msgstr "账户无效"
@ -5037,3 +5041,5 @@ msgstr "旗舰版"
msgid "Community edition"
msgstr "社区版"
#~ msgid "No"
#~ msgstr "无"

View File

@ -84,11 +84,13 @@ class AssetPermissionSerializer(BulkOrgResourceModelSerializer):
def to_internal_value(self, data):
# 系统用户是必填项
system_users = data.get('system_users', [])
system_users_display = data.pop('system_users_display', '')
for i in range(len(system_users_display)):
system_user = SystemUser.objects.filter(name=system_users_display[i]).first()
if system_user and system_user.id not in data['system_users']:
data['system_users'].append(system_user.id)
if system_user and system_user.id not in system_users:
system_users.append(system_user.id)
data['system_users'] = system_users
return super().to_internal_value(data)
def perform_display_create(self, instance, **kwargs):

View File

@ -93,7 +93,7 @@ class BaseHandler(object):
_('Ticket status'), self.ticket.get_status_display(),
_('Ticket action'), self.ticket.get_action_display(),
_('Ticket applicant'), self.ticket.applicant_display,
_('Ticket assignees'), self.ticket.assignees_display,
_('Ticket assignees'), ', '.join(self.ticket.assignees_display),
)
if self.ticket.status_closed:
basic_body += '''{}: {}'''.format(_('Ticket processor'), self.ticket.processor_display)
@ -110,11 +110,15 @@ class BaseHandler(object):
return body
def _base_construct_meta_body_of_open(self):
meta_body_of_open = getattr(self, '_construct_meta_body_of_open', lambda: 'No')()
meta_body_of_open = getattr(
self, '_construct_meta_body_of_open', lambda: _('No content')
)()
body = self.body_html_format.format(_('Ticket applied info'), meta_body_of_open)
return body
def _base_construct_meta_body_of_approve(self):
meta_body_of_approve = getattr(self, '_construct_meta_body_of_approve', lambda: 'No')()
meta_body_of_approve = getattr(
self, '_construct_meta_body_of_approve', lambda: _('No content')
)()
body = self.body_html_format.format(_('Ticket approved info'), meta_body_of_approve)
return body