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
c2aab50c
Commit
c2aab50c
authored
Oct 25, 2016
by
ibuler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add proxy log list
parent
6a510dad
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
436 additions
and
7 deletions
+436
-7
serializers.py
apps/audits/serializers.py
+2
-0
proxy_log_detail.html
apps/audits/templates/audits/proxy_log_detail.html
+120
-0
proxy_log_list.html
apps/audits/templates/audits/proxy_log_list.html
+92
-0
urls.py
apps/audits/urls.py
+3
-1
views.py
apps/audits/views.py
+27
-2
footable.eot
apps/static/css/plugins/footable/fonts/footable.eot
+0
-0
footable.svg
apps/static/css/plugins/footable/fonts/footable.svg
+0
-0
footable.ttf
apps/static/css/plugins/footable/fonts/footable.ttf
+0
-0
footable.woff
apps/static/css/plugins/footable/fonts/footable.woff
+0
-0
footable.core.css
apps/static/css/plugins/footable/footable.core.css
+178
-0
_nav.html
apps/templates/_nav.html
+14
-4
No files found.
apps/audits/serializers.py
View file @
c2aab50c
...
@@ -9,6 +9,8 @@ from . import models
...
@@ -9,6 +9,8 @@ from . import models
class
ProxyLogSerializer
(
serializers
.
ModelSerializer
):
class
ProxyLogSerializer
(
serializers
.
ModelSerializer
):
class
Meta
:
class
Meta
:
model
=
models
.
ProxyLog
model
=
models
.
ProxyLog
fields
=
[
'id'
,
'name'
,
'username'
,
'hostname'
,
'ip'
,
'system_user'
,
'login_type'
,
'terminal'
,
'log_file'
,
'was_failed'
,
'is_finished'
,
'date_start'
,
'date_finished'
,
'get_login_type_display'
]
class
CommandLogSerializer
(
serializers
.
ModelSerializer
):
class
CommandLogSerializer
(
serializers
.
ModelSerializer
):
...
...
apps/audits/templates/audits/proxy_log_detail.html
0 → 100644
View file @
c2aab50c
{% extends 'base.html' %}
{% load common_tags %}
{% load users_tags %}
{% load bootstrap %}
{% load static %}
{% load i18n %}
{% block custom_head_css_js %}
<script
src=
"{% static "
css
/
plugins
/
footable
/
footable
.
core
.
css
"
%}"
></script>
{% endblock %}
{% block content %}
<div
class=
"wrapper wrapper-content animated fadeInRight"
>
<div
class=
"row"
>
<div
class=
"col-sm-12"
>
<div
class=
"ibox float-e-margins"
>
<div
class=
"panel-options"
>
<ul
class=
"nav nav-tabs"
>
<li
class=
"active"
>
<a
href=
"#"
class=
"text-center"
>
{% trans 'Proxy log detail' %}
</a>
</li>
</ul>
</div>
<div
class=
"tab-content"
>
<div
class=
"col-sm-7"
style=
"padding-left: 0;"
>
<div
class=
"ibox float-e-margins"
>
<div
class=
"ibox-title"
>
<span
style=
"float: left"
>
{% trans 'Command log list' %}
<b>
{{ user_object.name }}
</b></span>
<div
class=
"ibox-tools"
>
<a
class=
"collapse-link"
>
<i
class=
"fa fa-chevron-up"
></i>
</a>
<a
class=
"dropdown-toggle"
data-toggle=
"dropdown"
href=
"#"
>
<i
class=
"fa fa-wrench"
></i>
</a>
<ul
class=
"dropdown-menu dropdown-user"
>
</ul>
<a
class=
"close-link"
>
<i
class=
"fa fa-times"
></i>
</a>
</div>
</div>
<div
class=
"ibox-content"
>
<table
class=
"footable table table-stripped toggle-arrow-tiny command"
data-page-size=
"8"
>
{#
<thead>
#}
{#
<tr>
#}
{#
<th
data-toggle=
"true"
>
No
</th>
#}
{#
<th>
Command
</th>
#}
{#
<th>
Datetime
</th>
#}
{#
</tr>
#}
{#
</thead>
#}
{#
<tbody>
#}
{#
</tbody>
#}
</table>
</div>
</div>
</div>
<div
class=
"col-sm-5"
style=
"padding-left: 0;padding-right: 0"
>
<div
class=
"ibox float-e-margins"
>
<div
class=
"ibox-title"
>
<span
style=
"float: left"
>
{% trans 'Detail' %}
<b>
{{ user_object.name }}
</b></span>
<div
class=
"ibox-tools"
>
<a
class=
"collapse-link"
>
<i
class=
"fa fa-chevron-up"
></i>
</a>
<a
class=
"dropdown-toggle"
data-toggle=
"dropdown"
href=
"#"
>
<i
class=
"fa fa-wrench"
></i>
</a>
<ul
class=
"dropdown-menu dropdown-user"
>
</ul>
<a
class=
"close-link"
>
<i
class=
"fa fa-times"
></i>
</a>
</div>
</div>
<div
class=
"ibox-content"
>
<table
class=
"table table-hover"
>
<thead>
<tr>
<th
class=
"text-center"
>
{% trans 'Name' %}
</th>
<th
class=
"text-center"
>
{% trans 'Asset count' %}
</th>
<th
class=
"text-center"
>
{% trans 'System user' %}
</th>
<th></th>
</tr>
</thead>
<tbody>
{% for asset_group, system_users in asset_groups %}
<tr
class=
"gradeX"
>
<td
class=
"text-center"
>
<a
href=
"{% url 'assets:asset-group-detail' pk=asset_group.id %}"
>
{{ asset_group.name }}
</a>
</td>
<td
class=
"text-center"
>
{{ asset_group.assets.count }}
</td>
<td
class=
"text-center"
>
{{ system_users|join_attr:"name" }}
</td>
<td>
<button
class=
"btn btn-danger btn-xs btn_delete_user_group {% if not asset_group.is_inherit_from_user_groups %} disabled {% endif %}"
type=
"button"
style=
"float: right;"
><i
class=
"fa fa-minus"
></i></button>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
{% endblock %}
{% block custom_foot_js %}
<script>
$
(
document
).
ready
(
function
()
{
$
(
'.command'
).
footable
({
"rows"
:
$
.
get
({
%
url
'audits:command-log-create-list-api'
%
})
})
});
</script>
{% endblock %}
apps/audits/templates/audits/proxy_log_list.html
0 → 100644
View file @
c2aab50c
{% 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>
{% endblock %}
{% block table_search %}{% endblock %}
{% block table_container %}
{#
<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>
#}
<table
class=
"table table-striped table-bordered table-hover "
id=
"proxy_log_list_table"
>
<thead>
<tr>
<th
class=
"text-center"
>
<div
class=
"checkbox checkbox-default"
>
<input
type=
"checkbox"
class=
"ipt_check_all"
>
</div>
</th>
<th
class=
"text-center"
>
{% trans 'Username' %}
</th>
<th
class=
"text-center"
>
{% trans 'IP' %}
</th>
<th
class=
"text-center"
>
{% trans 'System user' %}
</th>
<th
class=
"text-center"
>
{% trans 'Login type' %}
</th>
{#
<th
class=
"text-center"
>
{% trans 'Terminal' %}
</th>
#}
<th
class=
"text-center"
>
{% trans 'Success' %}
</th>
<th
class=
"text-center"
>
{% trans 'Finished' %}
</th>
<th
class=
"text-center"
>
{% trans 'Date start' %}
</th>
<th
class=
"text-center"
>
{% trans 'Date finished' %}
</th>
<th
class=
"text-center"
>
{% trans 'Action' %}
</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
{% endblock %}
{% block custom_foot_js %}
<script
src=
"{% static 'js/jquery.form.min.js' %}"
></script>
<script>
$
(
document
).
ready
(
function
(){
var
options
=
{
ele
:
$
(
'#proxy_log_list_table'
),
columnDefs
:
[
{
targets
:
1
,
createdCell
:
function
(
td
,
cellData
,
rowData
)
{
var
detail_btn
=
'<a href="{% url "users:user-detail" pk=99991937 %}">'
+
cellData
+
'</a>'
;
$
(
td
).
html
(
detail_btn
.
replace
(
'99991937'
,
rowData
.
id
));
}},
{
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
:
6
,
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
:
9
,
createdCell
:
function
(
td
,
cellData
,
rowData
)
{
var
detail_btn
=
'<a href="{% url "audits:proxy-log-detail" pk=99991937 %}" class="btn btn-xs btn-info">{% trans "Detail" %}</a>'
.
replace
(
'99991937'
,
cellData
);
var
delete_btn
=
'<a class="btn btn-xs btn-danger m-l-xs btn_delete" data-uid="99991937" data-name="99991938">{% trans "Delete" %}</a>'
.
replace
(
'99991937'
,
cellData
)
.
replace
(
'99991938'
,
rowData
.
name
);
$
(
td
).
html
(
detail_btn
+
delete_btn
)
}}
],
ajax_url
:
'{% url "audits:proxy-log-list-create-api" %}'
,
columns
:
[{
data
:
function
(){
return
""
}},
{
data
:
"name"
},
{
data
:
"ip"
},
{
data
:
"system_user"
},
{
data
:
"terminal"
},
{
data
:
'was_failed'
},
{
data
:
"is_finished"
},
{
data
:
"date_start"
},
{
data
:
'date_finished'
},
{
data
:
'id'
}],
op_html
:
$
(
'#actions'
).
html
()
};
jumpserver
.
initDataTable
(
options
);
}).
on
(
'click'
,
'.btn_delete'
,
function
(){
var
$this
=
$
(
this
);
var
uid
=
$this
.
data
(
'uid'
);
var
name
=
$
(
this
).
data
(
'name'
);
var
the_url
=
'{% url "terminal:terminal-detail-update-delete-api" pk=99991937 %}'
.
replace
(
'99991937'
,
uid
);
objectDelete
(
$this
,
name
,
the_url
)
})
</script>
{% endblock %}
apps/audits/urls.py
View file @
c2aab50c
...
@@ -7,11 +7,13 @@ import views
...
@@ -7,11 +7,13 @@ import views
app_name
=
'audits'
app_name
=
'audits'
urlpatterns
=
[
urlpatterns
=
[
url
(
r'^proxy-log$'
,
views
.
ProxyLogListView
.
as_view
(),
name
=
'proxy-log-list'
),
url
(
r'^proxy-log/(?P<pk>\d+)$'
,
views
.
ProxyLogDetailView
.
as_view
(),
name
=
'proxy-log-detail'
),
]
]
urlpatterns
+=
[
urlpatterns
+=
[
url
(
r'^v1/proxy-log/$'
,
api
.
ProxyLogListCreateApi
.
as_view
(),
name
=
'proxy-log-list-create-api'
),
url
(
r'^v1/proxy-log/$'
,
api
.
ProxyLogListCreateApi
.
as_view
(),
name
=
'proxy-log-list-create-api'
),
url
(
r'^v1/proxy-log/(?P<pk>\d+)/$'
,
api
.
ProxyLogDetailApi
.
as_view
(),
name
=
'proxy-log-detail-api'
),
url
(
r'^v1/proxy-log/(?P<pk>\d+)/$'
,
api
.
ProxyLogDetailApi
.
as_view
(),
name
=
'proxy-log-detail-api'
),
url
(
r'^v1/command-log/$'
,
api
.
CommandLogCreateApi
.
as_view
(),
name
=
'command-log-create-api'
),
url
(
r'^v1/command-log/$'
,
api
.
CommandLogCreateApi
.
as_view
(),
name
=
'command-log-create-
list-
api'
),
]
]
apps/audits/views.py
View file @
c2aab50c
from
django.shortcuts
import
render
# ~*~ coding: utf-8 ~*~
#
from
django.views.generic
import
ListView
,
UpdateView
,
DeleteView
,
DetailView
from
django.utils.translation
import
ugettext
as
_
from
django.urls
import
reverse_lazy
from
.models
import
ProxyLog
,
CommandLog
class
ProxyLogListView
(
ListView
):
model
=
ProxyLog
template_name
=
'audits/proxy_log_list.html'
def
get_context_data
(
self
,
**
kwargs
):
context
=
super
(
ProxyLogListView
,
self
)
.
get_context_data
(
**
kwargs
)
context
.
update
({
'app'
:
_
(
'Audits'
),
'action'
:
_
(
'Proxy log list'
)})
return
context
class
ProxyLogDetailView
(
DetailView
):
model
=
ProxyLog
template_name
=
'audits/proxy_log_detail.html'
def
get_context_data
(
self
,
**
kwargs
):
context
=
super
(
ProxyLogDetailView
,
self
)
.
get_context_data
(
**
kwargs
)
context
.
update
({
'app'
:
_
(
'Audits'
),
'action'
:
_
(
'Proxy log detail'
)})
# Create your views here.
apps/static/css/plugins/footable/fonts/footable.eot
0 → 100644
View file @
c2aab50c
File added
apps/static/css/plugins/footable/fonts/footable.svg
0 → 100644
View file @
c2aab50c
This diff is collapsed.
Click to expand it.
apps/static/css/plugins/footable/fonts/footable.ttf
0 → 100644
View file @
c2aab50c
File added
apps/static/css/plugins/footable/fonts/footable.woff
0 → 100644
View file @
c2aab50c
File added
apps/static/css/plugins/footable/footable.core.css
0 → 100644
View file @
c2aab50c
@font-face
{
font-family
:
'footable'
;
src
:
url('fonts/footable.eot')
;
src
:
url('fonts/footable.eot?#iefix')
format
(
'embedded-opentype'
),
url('fonts/footable.woff')
format
(
'woff'
),
url('fonts/footable.ttf')
format
(
'truetype'
),
url('fonts/footable.svg#footable')
format
(
'svg'
);
font-weight
:
normal
;
font-style
:
normal
;
}
@media
screen
and
(
-webkit-min-device-pixel-ratio
:
0
)
{
@font-face
{
font-family
:
'footable'
;
src
:
url('fonts/footable.svg#footable')
format
(
'svg'
);
font-weight
:
normal
;
font-style
:
normal
;
}
}
.footable
{
width
:
100%
;
/** SORTING **/
/** PAGINATION **/
}
.footable.breakpoint
>
tbody
>
tr
.footable-detail-show
>
td
{
border-bottom
:
none
;
}
.footable.breakpoint
>
tbody
>
tr
.footable-detail-show
>
td
>
span
.footable-toggle
:before
{
content
:
"\e001"
;
}
.footable.breakpoint
>
tbody
>
tr
:hover:not
(
.footable-row-detail
)
{
cursor
:
pointer
;
}
.footable.breakpoint
>
tbody
>
tr
>
td
.footable-cell-detail
{
background
:
#eee
;
border-top
:
none
;
}
.footable.breakpoint
>
tbody
>
tr
>
td
>
span
.footable-toggle
{
display
:
inline-block
;
font-family
:
'footable'
;
speak
:
none
;
font-style
:
normal
;
font-weight
:
normal
;
font-variant
:
normal
;
text-transform
:
none
;
-webkit-font-smoothing
:
antialiased
;
padding-right
:
5px
;
font-size
:
14px
;
color
:
#888888
;
}
.footable.breakpoint
>
tbody
>
tr
>
td
>
span
.footable-toggle
:before
{
content
:
"\e000"
;
}
.footable.breakpoint.toggle-circle
>
tbody
>
tr
.footable-detail-show
>
td
>
span
.footable-toggle
:before
{
content
:
"\e005"
;
}
.footable.breakpoint.toggle-circle
>
tbody
>
tr
>
td
>
span
.footable-toggle
:before
{
content
:
"\e004"
;
}
.footable.breakpoint.toggle-circle-filled
>
tbody
>
tr
.footable-detail-show
>
td
>
span
.footable-toggle
:before
{
content
:
"\e003"
;
}
.footable.breakpoint.toggle-circle-filled
>
tbody
>
tr
>
td
>
span
.footable-toggle
:before
{
content
:
"\e002"
;
}
.footable.breakpoint.toggle-square
>
tbody
>
tr
.footable-detail-show
>
td
>
span
.footable-toggle
:before
{
content
:
"\e007"
;
}
.footable.breakpoint.toggle-square
>
tbody
>
tr
>
td
>
span
.footable-toggle
:before
{
content
:
"\e006"
;
}
.footable.breakpoint.toggle-square-filled
>
tbody
>
tr
.footable-detail-show
>
td
>
span
.footable-toggle
:before
{
content
:
"\e009"
;
}
.footable.breakpoint.toggle-square-filled
>
tbody
>
tr
>
td
>
span
.footable-toggle
:before
{
content
:
"\e008"
;
}
.footable.breakpoint.toggle-arrow
>
tbody
>
tr
.footable-detail-show
>
td
>
span
.footable-toggle
:before
{
content
:
"\e00f"
;
}
.footable.breakpoint.toggle-arrow
>
tbody
>
tr
>
td
>
span
.footable-toggle
:before
{
content
:
"\e011"
;
}
.footable.breakpoint.toggle-arrow-small
>
tbody
>
tr
.footable-detail-show
>
td
>
span
.footable-toggle
:before
{
content
:
"\e013"
;
}
.footable.breakpoint.toggle-arrow-small
>
tbody
>
tr
>
td
>
span
.footable-toggle
:before
{
content
:
"\e015"
;
}
.footable.breakpoint.toggle-arrow-circle
>
tbody
>
tr
.footable-detail-show
>
td
>
span
.footable-toggle
:before
{
content
:
"\e01b"
;
}
.footable.breakpoint.toggle-arrow-circle
>
tbody
>
tr
>
td
>
span
.footable-toggle
:before
{
content
:
"\e01d"
;
}
.footable.breakpoint.toggle-arrow-circle-filled
>
tbody
>
tr
.footable-detail-show
>
td
>
span
.footable-toggle
:before
{
content
:
"\e00b"
;
}
.footable.breakpoint.toggle-arrow-circle-filled
>
tbody
>
tr
>
td
>
span
.footable-toggle
:before
{
content
:
"\e00d"
;
}
.footable.breakpoint.toggle-arrow-tiny
>
tbody
>
tr
.footable-detail-show
>
td
>
span
.footable-toggle
:before
{
content
:
"\e01f"
;
}
.footable.breakpoint.toggle-arrow-tiny
>
tbody
>
tr
>
td
>
span
.footable-toggle
:before
{
content
:
"\e021"
;
}
.footable.breakpoint.toggle-arrow-alt
>
tbody
>
tr
.footable-detail-show
>
td
>
span
.footable-toggle
:before
{
content
:
"\e017"
;
}
.footable.breakpoint.toggle-arrow-alt
>
tbody
>
tr
>
td
>
span
.footable-toggle
:before
{
content
:
"\e019"
;
}
.footable.breakpoint.toggle-medium
>
tbody
>
tr
>
td
>
span
.footable-toggle
{
font-size
:
18px
;
}
.footable.breakpoint.toggle-large
>
tbody
>
tr
>
td
>
span
.footable-toggle
{
font-size
:
24px
;
}
.footable
>
thead
>
tr
>
th
{
-webkit-touch-callout
:
none
;
-webkit-user-select
:
none
;
-khtml-user-select
:
none
;
-moz-user-select
:
-moz-none
;
-ms-user-select
:
none
;
user-select
:
none
;
}
.footable
>
thead
>
tr
>
th
.footable-sortable
:hover
{
cursor
:
pointer
;
}
.footable
>
thead
>
tr
>
th
.footable-sorted
>
span
.footable-sort-indicator
:before
{
content
:
"\e013"
;
}
.footable
>
thead
>
tr
>
th
.footable-sorted-desc
>
span
.footable-sort-indicator
:before
{
content
:
"\e012"
;
}
.footable
>
thead
>
tr
>
th
>
span
.footable-sort-indicator
{
display
:
inline-block
;
font-family
:
'footable'
;
speak
:
none
;
font-style
:
normal
;
font-weight
:
normal
;
font-variant
:
normal
;
text-transform
:
none
;
-webkit-font-smoothing
:
antialiased
;
padding-left
:
5px
;
}
.footable
>
thead
>
tr
>
th
>
span
.footable-sort-indicator
:before
{
content
:
"\e022"
;
}
.footable
>
tfoot
.pagination
{
margin
:
0
;
}
.footable.no-paging
.hide-if-no-paging
{
display
:
none
;
}
.footable-row-detail-inner
{
display
:
table
;
}
.footable-row-detail-row
{
display
:
table-row
;
line-height
:
1.5em
;
}
.footable-row-detail-group
{
display
:
block
;
line-height
:
2em
;
font-size
:
1.2em
;
font-weight
:
bold
;
}
.footable-row-detail-name
{
display
:
table-cell
;
font-weight
:
bold
;
padding-right
:
0.5em
;
}
.footable-row-detail-value
{
display
:
table-cell
;
}
.footable-odd
{
background-color
:
#f7f7f7
;
}
apps/templates/_nav.html
View file @
c2aab50c
...
@@ -39,10 +39,20 @@
...
@@ -39,10 +39,20 @@
<i
class=
"fa fa-desktop"
></i><span
class=
"nav-label"
>
{% trans 'Terminal' %}
</span><span
class=
"label label-info pull-right"
></span>
<i
class=
"fa fa-desktop"
></i><span
class=
"nav-label"
>
{% trans 'Terminal' %}
</span><span
class=
"label label-info pull-right"
></span>
</a>
</a>
</li>
</li>
<li
id=
""
>
<li
id=
"audits"
>
<a
href=
""
>
<a
href=
"#"
><i
class=
"fa fa-files-o"
></i>
<span
class=
"nav-label"
>
{% trans 'Audits' %}
</span><span
class=
"fa arrow"
></span></a>
<i
class=
"fa fa-files-o"
></i><span
class=
"nav-label"
>
{% trans 'Audits' %}
</span><span
class=
"label label-info pull-right"
></span>
<ul
class=
"nav nav-second-level"
>
</a>
<li
id=
"proxy-log"
>
<a
href=
"{% url 'audits:proxy-log-list' %}"
>
{% trans 'Proxy log' %}
</a>
</li>
<li
id=
"login"
>
<a
href=
"{% url 'perms:asset-permission-list' %}"
>
{% trans 'Login log' %}
</a>
</li>
<li
id=
"admin"
>
<a
href=
"{% url 'perms:asset-permission-list' %}"
>
{% trans 'Admin log' %}
</a>
</li>
</ul>
</li>
</li>
<li
id=
""
>
<li
id=
""
>
<a
href=
"#"
>
<a
href=
"#"
>
...
...
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