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
984391e2
Commit
984391e2
authored
Nov 24, 2016
by
Administrator
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
同步Master分支上的代码, 解决部分冲突问题
parent
1bc88e5b
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
91 additions
and
102 deletions
+91
-102
urls.py
apps/jumpserver/urls.py
+1
-0
list.html
apps/ops/templates/cron/list.html
+44
-40
list.html
apps/ops/templates/sudo/list.html
+44
-40
__init__.py
apps/ops/urls/__init__.py
+0
-1
api_urls.py
apps/ops/urls/api_urls.py
+0
-7
views_urls.py
apps/ops/urls/views_urls.py
+0
-8
_nav.html
apps/templates/_nav.html
+2
-6
No files found.
apps/jumpserver/urls.py
View file @
984391e2
...
...
@@ -42,6 +42,7 @@ urlpatterns = [
urlpatterns
+=
[
url
(
r'^api/v1/ops'
,
include
(
router
.
urls
)),
url
(
r'^ops/'
,
include
(
'ops.urls'
)),
]
if
settings
.
DEBUG
:
...
...
apps/ops/templates/cron/list.html
View file @
984391e2
{% extends '_base_list.html' %}
{% load i18n static %}
{% block custom_head_css_js %}
{{ block.super }}
<style>
div
.dataTables_wrapper
div
.dataTables_filter
,
.dataTables_length
{
float
:
right
!important
;
}
div
.dataTables_wrapper
div
.dataTables_filter
{
margin-left
:
15px
;
}
</style>
{% block table_search %}
<div
class=
"html5buttons"
>
<div
class=
"dt-buttons btn-group"
>
<a
class=
"btn btn-default buttons-pdf"
tabindex=
"0"
href=
"#"
>
<span>
PDF
</span></a>
<a
class=
"btn btn-default buttons-excel"
tabindex=
"0"
href=
"#"
>
<span>
Excel
</span>
</a>
</div>
</div>
{% endblock %}
{% block table_search %}{% endblock %}
{% block table_container %}
<div
class=
"uc pull-left"
><a
href=
"javascript:void(0);"
class=
"btn btn-sm btn-primary"
data-toggle=
"modal"
data-target=
"#user_import_modal"
>
{% trans "Import user" %}
</a></div>
<div
class=
"uc pull-left m-l-5 m-r-5"
><a
href=
"{% url "
users:user-create
"
%}"
class=
"btn btn-sm btn-primary"
>
{% trans "Create user" %}
</a></div>
<div
class=
"uc pull-left"
><a
href=
"javascript:void(0);"
class=
"btn btn-sm btn-primary"
data-toggle=
"modal"
data-target=
"#user_import_modal"
>
{% trans "Import user" %}
</a></div>
<table
class=
"table table-striped table-bordered table-hover "
id=
"user_list_table"
>
<thead>
<tr>
<th
class=
"text-center"
>
<div
class=
"checkbox checkbox-default"
><input
id=
""
type=
"checkbox"
class=
"ipt_check_all"
><label></label></div>
{#
<div><input
id=
""
type=
"checkbox"
class=
"ipt_check_all"
><label></label></div>
#}
<input
id=
""
type=
"checkbox"
class=
"ipt_check_all"
>
</th>
<th
class=
"text-center"
>
{% trans 'Name' %}
</
a></
th>
<th
class=
"text-center"
>
{% trans 'Username' %}
</
a></
th>
<th
class=
"text-center"
>
{% trans 'Name' %}
</th>
<th
class=
"text-center"
>
{% trans 'Username' %}
</th>
<th
class=
"text-center"
>
{% trans 'Role' %}
</th>
<th
class=
"text-center"
>
{% trans 'User group' %}
</th>
<th
class=
"text-center"
>
{% trans 'Asset num' %}
</th>
<th
class=
"text-center"
>
{% trans 'Active' %}
</a></th>
<th
class=
"text-center"
>
{% trans 'Active' %}
</th>
<th
class=
"text-center"
>
{% trans 'Action' %}
</th>
</tr>
</thead>
...
...
@@ -65,34 +62,43 @@ $(document).ready(function(){
$
(
td
).
html
(
detail_btn
.
replace
(
'99991937'
,
rowData
.
id
));
}},
{
targets
:
4
,
createdCell
:
function
(
td
,
cellData
)
{
var
innerHtml
=
cellData
.
length
>
8
?
cellData
.
substring
(
0
,
8
)
+
'...'
:
cellData
;
$
(
td
).
html
(
'<
a href="javascript:void(0);" data-toggle="tooltip" title="'
+
cellData
+
'">'
+
innerHtml
+
'</a
>'
);
var
innerHtml
=
cellData
.
length
>
20
?
cellData
.
substring
(
0
,
20
)
+
'...'
:
cellData
;
$
(
td
).
html
(
'<
span href="javascript:void(0);" data-toggle="tooltip" title="'
+
cellData
+
'">'
+
innerHtml
+
'</span
>'
);
}},
{
targets
:
6
,
createdCell
:
function
(
td
,
cellData
)
{
{
targets
:
5
,
createdCell
:
function
(
td
,
cellData
)
{
if
(
!
cellData
)
{
$
(
td
).
html
(
'<i class="fa fa-times text-danger"></i>'
)
}
else
{
$
(
td
).
html
(
'<i class="fa fa-check text-navy"></i>'
)
}
}},
{
targets
:
7
,
createdCell
:
function
(
td
,
cellData
,
rowData
)
{
{
targets
:
6
,
createdCell
:
function
(
td
,
cellData
,
rowData
)
{
var
update_btn
=
'<a href="{% url "users:user-update" pk=99991937 %}" class="btn btn-xs btn-info">{% trans "Update" %}</a>'
.
replace
(
'99991937'
,
cellData
);
var
del_btn
=
'<a class="btn btn-xs btn-danger m-l-xs btn_user_delete" data-uid="99991937">{% trans "Delete" %}</a>'
.
replace
(
'99991937'
,
cellData
);
if
(
rowData
.
id
===
1
)
{
if
(
rowData
.
id
===
1
||
rowData
.
username
==
"admin"
)
{
$
(
td
).
html
(
update_btn
)
}
else
{
$
(
td
).
html
(
update_btn
+
del_btn
)
}
}}],
ajax_url
:
'{% url "
users:user-bulk-update-api
" %}'
,
columns
:
[{
data
:
function
(){
return
""
}},
{
data
:
"username"
},
{
data
:
"name"
},
{
data
:
"get_role_display"
},
{
data
:
"group
_display"
},
{
data
:
function
(){
return
999
}},
{
data
:
"active_display
"
},
{
data
:
"id"
}],
ajax_url
:
'{% url "
api-users:user-list
" %}'
,
columns
:
[{
data
:
"id"
},
{
data
:
"username"
},
{
data
:
"name"
},
{
data
:
"get_role
_display"
},
{
data
:
"groups_display"
},
{
data
:
"is_valid
"
},
{
data
:
"id"
}],
op_html
:
$
(
'#actions'
).
html
()
};
jumpserver
.
initDataTable
(
options
);
var
table
=
jumpserver
.
initDataTable
(
options
);
$
(
'.buttons-pdf'
).
click
(
function
()
{
var
users
=
[];
var
rows
=
table
.
rows
(
'.selected'
).
data
();
$
.
each
(
rows
,
function
(
index
,
obj
)
{
users
.
push
(
obj
.
id
)
})
});
}).
on
(
'click'
,
'#btn_bulk_update'
,
function
(){
var
action
=
$
(
'#slct_bulk_update'
).
val
();
var
$data_table
=
$
(
'#user_list_table'
).
DataTable
()
var
$data_table
=
$
(
'#user_list_table'
).
DataTable
()
;
var
id_list
=
[];
var
plain_id_list
=
[];
$data_table
.
rows
({
selected
:
true
}).
every
(
function
(){
...
...
@@ -101,8 +107,8 @@ $(document).ready(function(){
});
if
(
id_list
===
[])
{
return
false
;
}
;
var
the_url
=
"{% url '
users:user-bulk-update-api
' %}"
;
}
var
the_url
=
"{% url '
api-users:user-list
' %}"
;
function
doDeactive
()
{
var
body
=
$
.
each
(
id_list
,
function
(
index
,
user_object
)
{
user_object
[
'is_active'
]
=
false
;
...
...
@@ -155,7 +161,7 @@ $(document).ready(function(){
var
$this
=
$
(
this
);
function
doDelete
()
{
var
uid
=
$this
.
data
(
'uid'
);
var
the_url
=
'{% url "
users:user-patch-api
" pk=99991937 %}'
.
replace
(
'99991937'
,
uid
);
var
the_url
=
'{% url "
api-users:user-detail
" pk=99991937 %}'
.
replace
(
'99991937'
,
uid
);
var
body
=
{};
var
success
=
function
()
{
var
msg
=
"{% trans 'User Deleted.' %}"
;
...
...
@@ -165,7 +171,7 @@ $(document).ready(function(){
var
fail
=
function
()
{
var
msg
=
"{% trans 'User Deleting failed.' %}"
;
swal
(
"{% trans 'User Delete' %}"
,
msg
,
"error"
);
}
}
;
APIUpdateAttr
({
url
:
the_url
,
body
:
JSON
.
stringify
(
body
),
...
...
@@ -208,15 +214,15 @@ $(document).ready(function(){
post_list
.
push
(
content
);
});
if
(
post_list
===
[])
{
return
false
;
}
;
var
the_url
=
"{% url '
users:user-bulk-update-api
' %}"
;
return
false
}
var
the_url
=
"{% url '
api-users:user-list
' %}"
;
var
success
=
function
()
{
var
msg
=
"{% trans 'The selected users has been updated successfully.' %}"
;
swal
(
"{% trans 'User Updated' %}"
,
msg
,
"success"
);
$
(
'#user_list_table'
).
DataTable
().
ajax
.
reload
();
jumpserver
.
checked
=
false
;
}
}
;
APIUpdateAttr
({
url
:
the_url
,
method
:
'PATCH'
,
body
:
JSON
.
stringify
(
post_list
),
success
:
success
});
$
(
'#user_bulk_update_modal'
).
modal
(
'hide'
);
}).
on
(
'click'
,
'#btn_user_import'
,
function
()
{
...
...
@@ -229,13 +235,11 @@ $(document).ready(function(){
}
else
{
$
(
'#user_import_modal'
).
modal
(
'hide'
);
var
$data_table
=
$
(
'#user_list_table'
).
DataTable
();
toastr
.
success
(
"{% trans 'Import User Success.' %}"
)
toastr
.
success
(
"{% trans 'Import User Success.' %}"
)
;
$data_table
.
ajax
.
reload
();
}
}
$form
.
ajaxSubmit
({
success
:
success
});
}).
on
(
'change'
,
'#id_excel'
,
function
()
{
$
(
this
).
siblings
(
'.help-block'
).
remove
();
})
</script>
{% endblock %}
...
...
apps/ops/templates/sudo/list.html
View file @
984391e2
{% extends '_base_list.html' %}
{% load i18n static %}
{% block custom_head_css_js %}
{{ block.super }}
<style>
div
.dataTables_wrapper
div
.dataTables_filter
,
.dataTables_length
{
float
:
right
!important
;
}
div
.dataTables_wrapper
div
.dataTables_filter
{
margin-left
:
15px
;
}
</style>
{% block table_search %}
<div
class=
"html5buttons"
>
<div
class=
"dt-buttons btn-group"
>
<a
class=
"btn btn-default buttons-pdf"
tabindex=
"0"
href=
"#"
>
<span>
PDF
</span></a>
<a
class=
"btn btn-default buttons-excel"
tabindex=
"0"
href=
"#"
>
<span>
Excel
</span>
</a>
</div>
</div>
{% endblock %}
{% block table_search %}{% endblock %}
{% block table_container %}
<div
class=
"uc pull-left"
><a
href=
"javascript:void(0);"
class=
"btn btn-sm btn-primary"
data-toggle=
"modal"
data-target=
"#user_import_modal"
>
{% trans "Import user" %}
</a></div>
<div
class=
"uc pull-left m-l-5 m-r-5"
><a
href=
"{% url "
users:user-create
"
%}"
class=
"btn btn-sm btn-primary"
>
{% trans "Create user" %}
</a></div>
<div
class=
"uc pull-left"
><a
href=
"javascript:void(0);"
class=
"btn btn-sm btn-primary"
data-toggle=
"modal"
data-target=
"#user_import_modal"
>
{% trans "Import user" %}
</a></div>
<table
class=
"table table-striped table-bordered table-hover "
id=
"user_list_table"
>
<thead>
<tr>
<th
class=
"text-center"
>
<div
class=
"checkbox checkbox-default"
><input
id=
""
type=
"checkbox"
class=
"ipt_check_all"
><label></label></div>
{#
<div><input
id=
""
type=
"checkbox"
class=
"ipt_check_all"
><label></label></div>
#}
<input
id=
""
type=
"checkbox"
class=
"ipt_check_all"
>
</th>
<th
class=
"text-center"
>
{% trans 'Name' %}
</
a></
th>
<th
class=
"text-center"
>
{% trans 'Username' %}
</
a></
th>
<th
class=
"text-center"
>
{% trans 'Name' %}
</th>
<th
class=
"text-center"
>
{% trans 'Username' %}
</th>
<th
class=
"text-center"
>
{% trans 'Role' %}
</th>
<th
class=
"text-center"
>
{% trans 'User group' %}
</th>
<th
class=
"text-center"
>
{% trans 'Asset num' %}
</th>
<th
class=
"text-center"
>
{% trans 'Active' %}
</a></th>
<th
class=
"text-center"
>
{% trans 'Active' %}
</th>
<th
class=
"text-center"
>
{% trans 'Action' %}
</th>
</tr>
</thead>
...
...
@@ -65,34 +62,43 @@ $(document).ready(function(){
$
(
td
).
html
(
detail_btn
.
replace
(
'99991937'
,
rowData
.
id
));
}},
{
targets
:
4
,
createdCell
:
function
(
td
,
cellData
)
{
var
innerHtml
=
cellData
.
length
>
8
?
cellData
.
substring
(
0
,
8
)
+
'...'
:
cellData
;
$
(
td
).
html
(
'<
a href="javascript:void(0);" data-toggle="tooltip" title="'
+
cellData
+
'">'
+
innerHtml
+
'</a
>'
);
var
innerHtml
=
cellData
.
length
>
20
?
cellData
.
substring
(
0
,
20
)
+
'...'
:
cellData
;
$
(
td
).
html
(
'<
span href="javascript:void(0);" data-toggle="tooltip" title="'
+
cellData
+
'">'
+
innerHtml
+
'</span
>'
);
}},
{
targets
:
6
,
createdCell
:
function
(
td
,
cellData
)
{
{
targets
:
5
,
createdCell
:
function
(
td
,
cellData
)
{
if
(
!
cellData
)
{
$
(
td
).
html
(
'<i class="fa fa-times text-danger"></i>'
)
}
else
{
$
(
td
).
html
(
'<i class="fa fa-check text-navy"></i>'
)
}
}},
{
targets
:
7
,
createdCell
:
function
(
td
,
cellData
,
rowData
)
{
{
targets
:
6
,
createdCell
:
function
(
td
,
cellData
,
rowData
)
{
var
update_btn
=
'<a href="{% url "users:user-update" pk=99991937 %}" class="btn btn-xs btn-info">{% trans "Update" %}</a>'
.
replace
(
'99991937'
,
cellData
);
var
del_btn
=
'<a class="btn btn-xs btn-danger m-l-xs btn_user_delete" data-uid="99991937">{% trans "Delete" %}</a>'
.
replace
(
'99991937'
,
cellData
);
if
(
rowData
.
id
===
1
)
{
if
(
rowData
.
id
===
1
||
rowData
.
username
==
"admin"
)
{
$
(
td
).
html
(
update_btn
)
}
else
{
$
(
td
).
html
(
update_btn
+
del_btn
)
}
}}],
ajax_url
:
'{% url "
users:user-bulk-update-api
" %}'
,
columns
:
[{
data
:
function
(){
return
""
}},
{
data
:
"username"
},
{
data
:
"name"
},
{
data
:
"get_role_display"
},
{
data
:
"group
_display"
},
{
data
:
function
(){
return
999
}},
{
data
:
"active_display
"
},
{
data
:
"id"
}],
ajax_url
:
'{% url "
api-users:user-list
" %}'
,
columns
:
[{
data
:
"id"
},
{
data
:
"username"
},
{
data
:
"name"
},
{
data
:
"get_role
_display"
},
{
data
:
"groups_display"
},
{
data
:
"is_valid
"
},
{
data
:
"id"
}],
op_html
:
$
(
'#actions'
).
html
()
};
jumpserver
.
initDataTable
(
options
);
var
table
=
jumpserver
.
initDataTable
(
options
);
$
(
'.buttons-pdf'
).
click
(
function
()
{
var
users
=
[];
var
rows
=
table
.
rows
(
'.selected'
).
data
();
$
.
each
(
rows
,
function
(
index
,
obj
)
{
users
.
push
(
obj
.
id
)
})
});
}).
on
(
'click'
,
'#btn_bulk_update'
,
function
(){
var
action
=
$
(
'#slct_bulk_update'
).
val
();
var
$data_table
=
$
(
'#user_list_table'
).
DataTable
()
var
$data_table
=
$
(
'#user_list_table'
).
DataTable
()
;
var
id_list
=
[];
var
plain_id_list
=
[];
$data_table
.
rows
({
selected
:
true
}).
every
(
function
(){
...
...
@@ -101,8 +107,8 @@ $(document).ready(function(){
});
if
(
id_list
===
[])
{
return
false
;
}
;
var
the_url
=
"{% url '
users:user-bulk-update-api
' %}"
;
}
var
the_url
=
"{% url '
api-users:user-list
' %}"
;
function
doDeactive
()
{
var
body
=
$
.
each
(
id_list
,
function
(
index
,
user_object
)
{
user_object
[
'is_active'
]
=
false
;
...
...
@@ -155,7 +161,7 @@ $(document).ready(function(){
var
$this
=
$
(
this
);
function
doDelete
()
{
var
uid
=
$this
.
data
(
'uid'
);
var
the_url
=
'{% url "
users:user-patch-api
" pk=99991937 %}'
.
replace
(
'99991937'
,
uid
);
var
the_url
=
'{% url "
api-users:user-detail
" pk=99991937 %}'
.
replace
(
'99991937'
,
uid
);
var
body
=
{};
var
success
=
function
()
{
var
msg
=
"{% trans 'User Deleted.' %}"
;
...
...
@@ -165,7 +171,7 @@ $(document).ready(function(){
var
fail
=
function
()
{
var
msg
=
"{% trans 'User Deleting failed.' %}"
;
swal
(
"{% trans 'User Delete' %}"
,
msg
,
"error"
);
}
}
;
APIUpdateAttr
({
url
:
the_url
,
body
:
JSON
.
stringify
(
body
),
...
...
@@ -208,15 +214,15 @@ $(document).ready(function(){
post_list
.
push
(
content
);
});
if
(
post_list
===
[])
{
return
false
;
}
;
var
the_url
=
"{% url '
users:user-bulk-update-api
' %}"
;
return
false
}
var
the_url
=
"{% url '
api-users:user-list
' %}"
;
var
success
=
function
()
{
var
msg
=
"{% trans 'The selected users has been updated successfully.' %}"
;
swal
(
"{% trans 'User Updated' %}"
,
msg
,
"success"
);
$
(
'#user_list_table'
).
DataTable
().
ajax
.
reload
();
jumpserver
.
checked
=
false
;
}
}
;
APIUpdateAttr
({
url
:
the_url
,
method
:
'PATCH'
,
body
:
JSON
.
stringify
(
post_list
),
success
:
success
});
$
(
'#user_bulk_update_modal'
).
modal
(
'hide'
);
}).
on
(
'click'
,
'#btn_user_import'
,
function
()
{
...
...
@@ -229,13 +235,11 @@ $(document).ready(function(){
}
else
{
$
(
'#user_import_modal'
).
modal
(
'hide'
);
var
$data_table
=
$
(
'#user_list_table'
).
DataTable
();
toastr
.
success
(
"{% trans 'Import User Success.' %}"
)
toastr
.
success
(
"{% trans 'Import User Success.' %}"
)
;
$data_table
.
ajax
.
reload
();
}
}
$form
.
ajaxSubmit
({
success
:
success
});
}).
on
(
'change'
,
'#id_excel'
,
function
()
{
$
(
this
).
siblings
(
'.help-block'
).
remove
();
})
</script>
{% endblock %}
...
...
apps/ops/urls/__init__.py
deleted
100644 → 0
View file @
1bc88e5b
apps/ops/urls/api_urls.py
deleted
100644 → 0
View file @
1bc88e5b
# coding:utf-8
from
django.conf.urls
import
url
from
rest_framework
import
routers
apps/ops/urls/views_urls.py
deleted
100644 → 0
View file @
1bc88e5b
# coding:utf-8
from
django.conf.urls
import
url
from
..
import
views
app_name
=
'ops'
apps/templates/_nav.html
View file @
984391e2
...
...
@@ -38,7 +38,8 @@
<li
id=
"terminal"
>
<a
href=
"{% url 'terminal:terminal-list' %}"
>
<i
class=
"fa fa-desktop"
></i><span
class=
"nav-label"
>
{% trans 'Terminal' %}
</span><span
class=
"label label-info pull-right"
></span>
</a>
</li>
<li
id=
"ops"
>
<a>
...
...
@@ -50,11 +51,6 @@
</ul>
</li>
<li
id=
""
>
<a
href=
""
>
<i
class=
"fa fa-files-o"
></i><span
class=
"nav-label"
>
{% trans 'Audits' %}
</span><span
class=
"label label-info pull-right"
></span>
</a>
</li>
<li
id=
"audits"
>
<a
href=
"#"
><i
class=
"fa fa-files-o"
></i>
<span
class=
"nav-label"
>
{% trans 'Audits' %}
</span><span
class=
"fa arrow"
></span></a>
<ul
class=
"nav nav-second-level"
>
...
...
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