Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
J
jumpserver
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ops
jumpserver
Commits
e66cfc2e
Unverified
Commit
e66cfc2e
authored
May 16, 2018
by
老广
Committed by
GitHub
May 16, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1333 from jumpserver/update_rdp
[Update] 去掉windows相关无用配置,修复资产树节点移动等问题
parents
ed18cb31
ac67c231
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
95 additions
and
48 deletions
+95
-48
node.py
apps/assets/api/node.py
+3
-2
node.py
apps/assets/models/node.py
+11
-1
_system_user.html
apps/assets/templates/assets/_system_user.html
+35
-27
domain_gateway_list.html
apps/assets/templates/assets/domain_gateway_list.html
+4
-2
gateway_create_update.html
apps/assets/templates/assets/gateway_create_update.html
+26
-0
system_user_detail.html
apps/assets/templates/assets/system_user_detail.html
+7
-4
system_user_update.html
apps/assets/templates/assets/system_user_update.html
+0
-8
asset_permission_list.html
apps/perms/templates/perms/asset_permission_list.html
+4
-3
views.py
apps/perms/views.py
+1
-1
session_list.html
apps/terminal/templates/terminal/session_list.html
+4
-0
No files found.
apps/assets/api/node.py
View file @
e66cfc2e
...
...
@@ -184,8 +184,9 @@ class NodeAddChildrenApi(generics.UpdateAPIView):
for
node
in
children
:
if
not
node
:
continue
node
.
parent
=
instance
node
.
save
()
# node.parent = instance
# node.save()
node
.
set_parent
(
instance
)
return
Response
(
"OK"
)
...
...
apps/assets/models/node.py
View file @
e66cfc2e
...
...
@@ -2,7 +2,7 @@
#
import
uuid
from
django.db
import
models
from
django.db
import
models
,
transaction
from
django.utils.translation
import
ugettext_lazy
as
_
...
...
@@ -39,6 +39,16 @@ class Node(models.Model):
def
level
(
self
):
return
len
(
self
.
key
.
split
(
':'
))
def
set_parent
(
self
,
instance
):
children
=
self
.
get_all_children
()
old_key
=
self
.
key
with
transaction
.
atomic
():
self
.
parent
=
instance
for
child
in
children
:
child
.
key
=
child
.
key
.
replace
(
old_key
,
self
.
key
,
1
)
child
.
save
()
self
.
save
()
def
get_next_child_key
(
self
):
mark
=
self
.
child_mark
self
.
child_mark
+=
1
...
...
apps/assets/templates/assets/_system_user.html
View file @
e66cfc2e
...
...
@@ -55,7 +55,7 @@
{% bootstrap_field form.private_key_file layout="horizontal" %}
</div>
<div
class=
"form-group"
>
<label
for=
"{{ form.a
s
_push.id_for_label }}"
class=
"col-sm-2 control-label"
>
{% trans 'Auto push' %}
</label>
<label
for=
"{{ form.a
uto
_push.id_for_label }}"
class=
"col-sm-2 control-label"
>
{% trans 'Auto push' %}
</label>
<div
class=
"col-sm-8"
>
{{ form.auto_push}}
</div>
...
...
@@ -79,43 +79,50 @@
</div>
{% endblock %}
{% block custom_foot_js %}
<script>
var
auto_generate_key
=
'#'
+
'{{ form.auto_generate_key.id_for_label }}'
;
var
protocol_id
=
'#'
+
'{{ form.protocol.id_for_label }}'
;
var
password_id
=
'#'
+
'{{ form.password.id_for_label }}'
;
var
private_key_id
=
'#'
+
'{{ form.private_key_file.id_for_label }}'
;
var
sudo_id
=
'#'
+
'{{ form.sudo.id_for_label }}'
;
var
shell_id
=
'#'
+
'{{ form.shell.id_for_label }}'
;
<script>
var
auto_generate_key
=
'#'
+
'{{ form.auto_generate_key.id_for_label }}'
;
var
protocol_id
=
'#'
+
'{{ form.protocol.id_for_label }}'
;
var
private_key_id
=
'#'
+
'{{ form.private_key_file.id_for_label }}'
;
var
auto_push_id
=
'#'
+
'{{ form.auto_push.id_for_label }}'
;
var
sudo_id
=
'#'
+
'{{ form.sudo.id_for_label }}'
;
var
shell_id
=
'#'
+
'{{ form.shell.id_for_label }}'
;
var
need_change_field
=
[
auto_generate_key
,
private_key_id
,
auto_push_id
,
sudo_id
,
shell_id
];
var
need_change_field
=
[
auto_generate_key
,
private_key_id
,
sudo_id
,
shell_id
]
;
function
authFieldsDisplay
()
{
if
(
$
(
auto_generate_key
).
prop
(
'checked'
))
{
$
(
'.auth-fields'
).
addClass
(
'hidden'
);
}
else
{
function
protocolChange
()
{
if
(
$
(
protocol_id
+
" option:selected"
).
text
()
===
'rdp'
)
{
$
(
'.auth-fields'
).
removeClass
(
'hidden'
);
}
}
function
protocolChange
()
{
if
(
$
(
protocol_id
).
attr
(
'value'
)
===
'rdp'
)
{
$
.
each
(
need_change_field
,
function
(
index
,
value
)
{
$
(
value
).
addClass
(
'hidden'
)
$
(
value
).
closest
(
'.form-group'
).
addClass
(
'hidden'
)
});
$
(
password_id
).
removeClass
(
'hidden'
)
}
else
{
authFieldsDisplay
();
$
.
each
(
need_change_field
,
function
(
index
,
value
)
{
$
(
value
).
removeClass
(
'hidden'
)
$
(
value
).
closest
(
'.form-group'
).
removeClass
(
'hidden'
)
});
}
}
function
authFieldsDisplay
()
{
if
(
$
(
auto_generate_key
).
prop
(
'checked'
))
{
$
(
'.auth-fields'
).
addClass
(
'hidden'
);
}
else
{
$
(
'.auth-fields'
).
removeClass
(
'hidden'
);
}
$
(
document
).
ready
(
function
()
{
}
$
(
document
).
ready
(
function
()
{
$
(
'.select2'
).
select2
();
authFieldsDisplay
();
protocolChange
();
$
(
auto_generate_key
).
change
(
function
()
{
})
.
on
(
'change'
,
protocol_id
,
function
(){
protocolChange
();
})
.
on
(
'change'
,
auto_generate_key
,
function
(){
authFieldsDisplay
();
});
})
</script>
});
</script>
{% endblock %}
\ No newline at end of file
apps/assets/templates/assets/domain_gateway_list.html
View file @
e66cfc2e
...
...
@@ -85,6 +85,9 @@ function initTable() {
var
update_btn
=
'<a href="{% url "assets:domain-gateway-update" pk=DEFAULT_PK %}" class="btn btn-xs btn-info">{% trans "Update" %}</a>'
.
replace
(
'{{ DEFAULT_PK }}'
,
cellData
);
var
del_btn
=
'<a class="btn btn-xs btn-danger m-l-xs btn-delete" data-uid="{{ DEFAULT_PK }}">{% trans "Delete" %}</a>'
.
replace
(
'{{ DEFAULT_PK }}'
,
cellData
);
var
test_btn
=
'<a class="btn btn-xs btn-warning m-l-xs btn-test" data-uid="{{ DEFAULT_PK }}">{% trans "Test connection" %}</a>'
.
replace
(
'{{ DEFAULT_PK }}'
,
cellData
);
if
(
rowData
.
protocol
===
'rdp'
){
test_btn
=
'<a class="btn btn-xs btn-warning m-l-xs btn-test" disabled data-uid="{{ DEFAULT_PK }}">{% trans "Test connection" %}</a>'
.
replace
(
'{{ DEFAULT_PK }}'
,
cellData
);
}
$
(
td
).
html
(
update_btn
+
test_btn
+
del_btn
)
}}
],
...
...
@@ -120,7 +123,6 @@ $(document).ready(function(){
success_message
:
"可连接"
,
fail_message
:
"连接失败"
})
})
});
</script>
{% endblock %}
apps/assets/templates/assets/gateway_create_update.html
View file @
e66cfc2e
...
...
@@ -66,3 +66,28 @@
</div>
</div>
{% endblock %}
{% block custom_foot_js %}
<script>
var
protocol_id
=
'#'
+
'{{ form.protocol.id_for_label }}'
;
var
private_key_id
=
'#'
+
'{{ form.private_key_file.id_for_label }}'
;
var
port
=
'#'
+
'{{ form.port.id_for_label }}'
;
function
protocolChange
()
{
if
(
$
(
protocol_id
+
" option:selected"
).
text
()
===
'rdp'
)
{
$
(
port
).
val
(
3389
);
$
(
private_key_id
).
closest
(
'.form-group'
).
addClass
(
'hidden'
)
}
else
{
$
(
port
).
val
(
22
);
$
(
private_key_id
).
closest
(
'.form-group'
).
removeClass
(
'hidden'
)
}
}
$
(
document
).
ready
(
function
(){
protocolChange
();
})
.
on
(
'change'
,
protocol_id
,
function
(){
protocolChange
();
});
</script>
{% endblock %}
\ No newline at end of file
apps/assets/templates/assets/system_user_detail.html
View file @
e66cfc2e
...
...
@@ -64,14 +64,14 @@
</tr>
<tr>
<td>
{% trans 'Protocol' %}:
</td>
<td><b>
{{ system_user.protocol }}
</b></td>
<td><b
id=
"id_protocol_type"
>
{{ system_user.protocol }}
</b></td>
</tr>
<tr>
<tr
class=
"only-ssh"
>
<td>
{% trans 'Sudo' %}:
</td>
<td><b>
{{ system_user.sudo }}
</b></td>
</tr>
{% if system_user.shell %}
<tr>
<tr
class=
"only-ssh"
>
<td>
{% trans 'Shell' %}:
</td>
<td><b>
{{ system_user.shell }}
</b></td>
</tr>
...
...
@@ -107,7 +107,7 @@
</div>
<div
class=
"col-sm-4"
style=
"padding-left: 0;padding-right: 0"
>
<div
class=
"panel panel-primary"
>
<div
class=
"panel panel-primary
only-ssh
"
>
<div
class=
"panel-heading"
>
<i
class=
"fa fa-info-circle"
></i>
{% trans 'Quick update' %}
</div>
...
...
@@ -236,6 +236,9 @@ function updateSystemUserNode(nodes) {
}
jumpserver
.
nodes_selected
=
{};
$
(
document
).
ready
(
function
()
{
if
(
$
(
'#id_protocol_type'
).
text
()
===
'rdp'
){
$
(
'.only-ssh'
).
addClass
(
'hidden'
)
}
$
(
'.select2'
).
select2
()
.
on
(
'select2:select'
,
function
(
evt
)
{
var
data
=
evt
.
params
.
data
;
...
...
apps/assets/templates/assets/system_user_update.html
View file @
e66cfc2e
...
...
@@ -15,10 +15,3 @@
</div>
{% endblock %}
{% block custom_foot_js %}
<script>
$
(
document
).
ready
(
function
()
{
$
(
'.select2'
).
select2
();
})
</script>
{% endblock %}
\ No newline at end of file
apps/perms/templates/perms/asset_permission_list.html
View file @
e66cfc2e
...
...
@@ -226,7 +226,7 @@ function initTree() {
},
async
:
{
enable
:
true
,
url
:
"{% url 'api-assets:node-children-2' %}?assets=1&all=
1
"
,
url
:
"{% url 'api-assets:node-children-2' %}?assets=1&all="
,
autoParam
:[
"id"
,
"name=n"
,
"level=lv"
],
dataFilter
:
filter
,
type
:
'get'
...
...
@@ -238,7 +238,7 @@ function initTree() {
};
var
zNodes
=
[];
$
.
get
(
"{% url 'api-assets:node-children-2' %}?assets=1&all=
1
"
,
function
(
data
,
status
){
$
.
get
(
"{% url 'api-assets:node-children-2' %}?assets=1&all="
,
function
(
data
,
status
){
$
.
each
(
data
,
function
(
index
,
value
)
{
value
[
"pId"
]
=
value
[
"parent"
];
value
[
"name"
]
=
value
[
"value"
];
...
...
@@ -304,6 +304,7 @@ $(document).ready(function(){
if
(
row
.
child
.
isShown
())
{
tr
.
removeClass
(
'details'
);
$
(
this
).
children
(
'i:first-child'
).
removeClass
(
'fa-angle-down'
).
addClass
(
'fa-angle-right'
);
row
.
child
.
hide
();
// Remove from the 'open' array
...
...
@@ -311,7 +312,7 @@ $(document).ready(function(){
}
else
{
tr
.
addClass
(
'details'
);
$
(
'.toggle i
'
).
removeClass
(
'fa-angle-right'
).
addClass
(
'fa-angle-down'
);
$
(
this
).
children
(
'i:first-child
'
).
removeClass
(
'fa-angle-right'
).
addClass
(
'fa-angle-down'
);
row
.
child
(
format
(
row
.
data
())).
show
();
// Add to the 'open' array
if
(
idx
===
-
1
)
{
...
...
apps/perms/views.py
View file @
e66cfc2e
...
...
@@ -42,7 +42,7 @@ class AssetPermissionCreateView(AdminUserRequiredMixin, CreateView):
if
nodes_id
:
nodes_id
=
nodes_id
.
split
(
","
)
nodes
=
Node
.
objects
.
filter
(
id__in
=
nodes_id
)
nodes
=
Node
.
objects
.
filter
(
id__in
=
nodes_id
)
.
exclude
(
id
=
Node
.
root
()
.
id
)
form
[
'nodes'
]
.
initial
=
nodes
if
assets_id
:
assets_id
=
assets_id
.
split
(
","
)
...
...
apps/terminal/templates/terminal/session_list.html
View file @
e66cfc2e
...
...
@@ -102,8 +102,12 @@
<a
onclick=
"window.open('/luna/replay/{{ session.id }}','luna', 'height=600, width=800, top=400, left=400, toolbar=no, menubar=no, scrollbars=no, location=no, status=no')"
class=
"btn btn-xs btn-warning btn-replay"
>
{% trans "Replay" %}
</a>
{% else %}
<!--<a onclick="window.open('/luna/monitor/{{ session.id }}','luna', 'height=600, width=800, top=0, left=0, toolbar=no, menubar=no, scrollbars=no, location=no, status=no')" class="btn btn-xs btn-warning btn-monitor" >{% trans "Monitor" %}</a>-->
{% if session.protocol == 'rdp' %}
<a
class=
"btn btn-xs btn-danger btn-term"
disabled
value=
"{{ session.id }}"
terminal=
"{{ session.terminal.id }}"
>
{% trans "Terminate" %}
</a>
{% else %}
<a
class=
"btn btn-xs btn-danger btn-term"
value=
"{{ session.id }}"
terminal=
"{{ session.terminal.id }}"
>
{% trans "Terminate" %}
</a>
{% endif %}
{% endif %}
</td>
</tr>
{% endfor %}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment