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
3383b2b5
Commit
3383b2b5
authored
Oct 15, 2016
by
ibuler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add terminal mode
parent
9960a6cd
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
3 deletions
+29
-3
models.py
apps/audits/models.py
+4
-2
models.py
apps/terminal/models.py
+25
-1
No files found.
apps/audits/models.py
View file @
3383b2b5
...
...
@@ -9,8 +9,9 @@ from django.utils.translation import ugettext_lazy as _
class
LoginLog
(
models
.
Model
):
LOGIN_TYPE_CHOICE
=
(
(
'S'
,
'ssh'
),
(
'W'
,
'web'
),
(
'W'
,
'Web'
),
(
'T'
,
'Terminal'
),
(
'WT'
,
'Web Terminal'
)
)
username
=
models
.
CharField
(
max_length
=
20
,
verbose_name
=
_
(
'Username'
))
...
...
@@ -19,6 +20,7 @@ class LoginLog(models.Model):
login_ip
=
models
.
GenericIPAddressField
(
verbose_name
=
_
(
'Login ip'
))
login_city
=
models
.
CharField
(
max_length
=
100
,
blank
=
True
,
null
=
True
,
verbose_name
=
_
(
'Login city'
))
user_agent
=
models
.
CharField
(
max_length
=
100
,
blank
=
True
,
null
=
True
,
verbose_name
=
_
(
'User agent'
))
from_terminal
=
models
.
ForeignKey
date_login
=
models
.
DateTimeField
(
auto_now
=
True
,
verbose_name
=
_
(
'Date login'
))
date_logout
=
models
.
DateTimeField
(
null
=
True
,
verbose_name
=
_
(
'Date logout'
))
...
...
apps/terminal/models.py
View file @
3383b2b5
from
__future__
import
unicode_literals
from
django.db
import
models
from
django.utils.translation
import
ugettext_lazy
as
_
# Create your models here.
from
users.models
import
User
class
Terminal
(
models
.
Model
):
name
=
models
.
CharField
(
max_length
=
30
,
verbose_name
=
_
(
'Name'
))
ip
=
models
.
GenericIPAddressField
(
verbose_name
=
_
(
'From ip'
))
is_active
=
models
.
BooleanField
(
default
=
False
,
verbose_name
=
_
(
'Is active'
))
is_bound_ip
=
models
.
BooleanField
(
default
=
False
,
verbose_name
=
_
(
'Is bound ip'
))
heatbeat_interval
=
models
.
IntegerField
(
default
=
60
,
verbose_name
=
_
(
'Heatbeat interval'
))
mail_to
=
models
.
ManyToManyField
(
User
,
verbose_name
=
_
(
'Mail to '
))
date_created
=
models
.
DateTimeField
(
auto_now
=
True
)
comment
=
models
.
TextField
(
verbose_name
=
_
(
'Comment'
))
class
Meta
:
db_table
=
'terminal'
ordering
=
[
'name'
]
class
TerminalHeatbeat
(
models
.
Model
):
terminal
=
models
.
ForeignKey
(
Terminal
,
on_delete
=
models
.
SET_NULL
)
date_timestamp
=
models
.
IntegerField
()
class
Meta
:
db_table
=
'terminal_heatbeat'
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