未验证 提交 ece9b163 编写于 作者: B BaiJiangJie 提交者: GitHub

Merge pull request #3651 from jumpserver/dev

Dev
......@@ -98,4 +98,5 @@ class TreeNodeSerializer(serializers.Serializer):
isParent = serializers.BooleanField(default=False)
open = serializers.BooleanField(default=False)
iconSkin = serializers.CharField(max_length=128, allow_blank=True)
nocheck = serializers.BooleanField(default=False)
meta = serializers.JSONField()
......@@ -15,7 +15,7 @@ def jumpserver_processor(request):
'FAVICON_URL': static('img/facio.ico'),
'JMS_TITLE': 'Jumpserver',
'VERSION': settings.VERSION,
'COPYRIGHT': 'FIT2CLOUD 飞致云' + ' © 2014-2019',
'COPYRIGHT': 'FIT2CLOUD 飞致云' + ' © 2014-2020',
'SECURITY_COMMAND_EXECUTION': settings.SECURITY_COMMAND_EXECUTION,
'SECURITY_MFA_VERIFY_TTL': settings.SECURITY_MFA_VERIFY_TTL,
'FORCE_SCRIPT_NAME': settings.FORCE_SCRIPT_NAME,
......
......@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Jumpserver 0.3.3\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-01-14 16:52+0800\n"
"POT-Creation-Date: 2020-01-15 12:40+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"
......@@ -3222,33 +3222,37 @@ msgstr "任务列表"
msgid "Go"
msgstr ""
#: ops/templates/ops/command_execution_create.html:179
#: ops/templates/ops/command_execution_create.html:159
msgid "Asset configuration does not include the SSH protocol"
msgstr "资产配置不包含 SSH 协议"
#: ops/templates/ops/command_execution_create.html:183
msgid "Selected assets"
msgstr "已选择资产"
#: ops/templates/ops/command_execution_create.html:182
#: ops/templates/ops/command_execution_create.html:186
msgid "In total"
msgstr "总共"
#: ops/templates/ops/command_execution_create.html:219
#: ops/templates/ops/command_execution_create.html:223
msgid ""
"Select the left asset, select the running system user, execute command in "
"batch"
msgstr "选择左侧资产, 选择运行的系统用户,批量执行命令"
#: ops/templates/ops/command_execution_create.html:263
#: ops/templates/ops/command_execution_create.html:267
msgid "Unselected assets"
msgstr "没有选中资产"
#: ops/templates/ops/command_execution_create.html:267
#: ops/templates/ops/command_execution_create.html:271
msgid "No input command"
msgstr "没有输入命令"
#: ops/templates/ops/command_execution_create.html:271
#: ops/templates/ops/command_execution_create.html:275
msgid "No system user was selected"
msgstr "没有选择系统用户"
#: ops/templates/ops/command_execution_create.html:281
#: ops/templates/ops/command_execution_create.html:285
msgid "Pending"
msgstr "等待"
......
......@@ -86,7 +86,7 @@
<div class="col-sm-2">
<select class="select2 form-control" id="system-users-select">
{% for s in system_users %}
<option value="{{ s.id }}" {% if s.protocol != 'ssh' or s.login_mode != 'auto' %}disabled{% endif %}>{{ s }}</option>
<option value="{{ s.id }}" {% if s.login_mode == 'manual' or s.protocol in 'mysql|telnet|vnc'%}disabled{% endif %}>{{ s }}</option>
{% endfor %}
</select>
<button type="button" class="btn btn-primary btn-execute" style="margin-top: 30px; width: 100%">
......@@ -138,11 +138,11 @@
}
},
callback: {
onCheck: onCheck
onCheck: onCheck,
onClick: onClick,
}
};
$.get(url, function (data, status) {
$.fn.zTree.init($("#assetTree"), setting, data);
zTree = $.fn.zTree.getZTreeObj("assetTree");
......@@ -152,25 +152,29 @@
});
});
}
function onClick(event, treeId, treeNode, clickFlag){
if (treeNode.meta.type === 'asset'){
let protocolsStr = treeNode.meta.asset.protocols + '';
if (protocolsStr.indexOf('ssh/') === -1){
toastr.warning("{% trans "Asset configuration does not include the SSH protocol" %}");
}
}
}
function getSelectedAssetsNode() {
var nodes = zTree.getCheckedNodes(true);
var assetsNodeId = [];
var assetsNode = [];
nodes.forEach(function (node) {
if (node.meta.type === 'asset' && !node.isHidden) {
var protocols = node.meta.asset.protocols;
protocols.forEach(function (val) {
if (assetsNodeId.indexOf(node.id) === -1 && val.indexOf("ssh") > -1) {
assetsNodeId.push(node.id);
assetsNode.push(node)
}
});
var protocolsStr = node.meta.asset.protocols + '';
if (assetsNodeId.indexOf(node.id) === -1 && protocolsStr.indexOf('ssh') > -1){
assetsNodeId.push(node.id);
assetsNode.push(node)
}
}
});
return assetsNode;
}
function onCheck(e, treeId, treeNode) {
var nodes = getSelectedAssetsNode();
var nodes_names = nodes.map(function (node) {
......
......@@ -481,6 +481,7 @@ class ParserNode:
'isParent': False,
'open': False,
'iconSkin': icon_skin,
'nocheck': not asset.has_protocol('ssh'),
'meta': {
'type': 'asset',
'asset': {
......
......@@ -2,6 +2,7 @@
#
from django.db.models import Q
from django.utils.translation import ugettext as _
from orgs.utils import set_to_root_org
from ..models import DatabaseAppPermission
......@@ -16,7 +17,6 @@ __all__ = [
'parse_database_app_to_tree_node'
]
def get_user_database_app_permissions(user, include_group=True):
if include_group:
groups = user.groups.all()
......@@ -73,7 +73,7 @@ class DatabaseAppPermissionUtil:
def construct_database_apps_tree_root():
tree_root = {
'id': 'ID_DATABASE_APP_ROOT',
'name': 'DatabaseApp',
'name': _('DatabaseApp'),
'title': 'DatabaseApp',
'pId': '',
'open': False,
......
......@@ -2,6 +2,7 @@
#
from django.db.models import Q
from django.utils.translation import ugettext as _
from common.tree import TreeNode
from orgs.utils import set_to_root_org
......@@ -72,7 +73,7 @@ class RemoteAppPermissionUtil:
def construct_remote_apps_tree_root():
tree_root = {
'id': 'ID_REMOTE_APP_ROOT',
'name': 'RemoteApp',
'name': _('RemoteApp'),
'title': 'RemoteApp',
'pId': '',
'open': False,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册