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
56df1f69
Commit
56df1f69
authored
Mar 14, 2015
by
guanghongwei
Browse files
Options
Browse Files
Download
Plain Diff
merge
parents
026836eb
78dc6e51
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
121 additions
and
36 deletions
+121
-36
AddUserAsset.py
docs/AddUserAsset.py
+25
-4
models.py
jasset/models.py
+1
-2
views.py
jasset/views.py
+31
-8
jumpserver.conf
jumpserver.conf
+1
-1
foot_script.html
templates/foot_script.html
+2
-2
group_add.html
templates/jasset/group_add.html
+14
-2
group_list.html
templates/jasset/group_list.html
+2
-0
host_add.html
templates/jasset/host_add.html
+12
-2
host_edit.html
templates/jasset/host_edit.html
+16
-0
host_list.html
templates/jasset/host_list.html
+5
-3
nav.html
templates/nav.html
+12
-12
No files found.
docs/AddUserAsset.py
View file @
56df1f69
...
@@ -12,12 +12,31 @@ django.setup()
...
@@ -12,12 +12,31 @@ django.setup()
from
juser.views
import
db_add_user
,
md5_crypt
,
CRYPTOR
,
db_add_group
from
juser.views
import
db_add_user
,
md5_crypt
,
CRYPTOR
,
db_add_group
from
jasset.models
import
Asset
,
IDC
,
BisGroup
from
jasset.models
import
Asset
,
IDC
,
BisGroup
from
juser.models
import
UserGroup
,
DEPT
from
juser.models
import
UserGroup
,
DEPT
,
User
from
jasset.views
import
jasset_group_add
from
jasset.views
import
jasset_group_add
from
jperm.models
import
CmdGroup
from
jperm.models
import
CmdGroup
from
jlog.models
import
Log
from
jlog.models
import
Log
def
install
():
IDC
.
objects
.
create
(
name
=
'ALL'
,
comment
=
'ALL'
)
IDC
.
objects
.
create
(
name
=
'默认'
,
comment
=
'默认'
)
DEPT
.
objects
.
create
(
name
=
"默认"
,
comment
=
"默认部门"
)
DEPT
.
objects
.
create
(
name
=
"超管部"
,
comment
=
"超级管理员部门"
)
dept
=
DEPT
.
objects
.
get
(
name
=
'超管部'
)
dept2
=
DEPT
.
objects
.
get
(
name
=
'默认'
)
UserGroup
.
objects
.
create
(
name
=
'ALL'
,
dept
=
dept
,
comment
=
'ALL'
)
UserGroup
.
objects
.
create
(
name
=
'默认'
,
dept
=
dept
,
comment
=
'默认'
)
BisGroup
.
objects
.
create
(
name
=
'ALL'
,
dept
=
dept
,
comment
=
'ALL'
)
BisGroup
.
objects
.
create
(
name
=
'默认'
,
dept
=
dept
,
comment
=
'默认'
)
User
(
id
=
5000
,
username
=
"admin"
,
password
=
md5_crypt
(
'admin'
),
name
=
'admin'
,
email
=
'admin@jumpserver.org'
,
role
=
'SU'
,
is_active
=
True
,
dept
=
dept
)
.
save
()
User
(
id
=
5001
,
username
=
"group_admin"
,
password
=
md5_crypt
(
'group_admin'
),
name
=
'group_admin'
,
email
=
'group_admin@jumpserver.org'
,
role
=
'DA'
,
is_active
=
True
,
dept
=
dept2
)
.
save
()
def
test_add_idc
():
def
test_add_idc
():
for
i
in
range
(
1
,
20
):
for
i
in
range
(
1
,
20
):
name
=
'IDC'
+
str
(
i
)
name
=
'IDC'
+
str
(
i
)
...
@@ -67,11 +86,10 @@ def test_add_user():
...
@@ -67,11 +86,10 @@ def test_add_user():
def
test_add_asset_group
():
def
test_add_asset_group
():
BisGroup
.
objects
.
create
(
name
=
'ALL'
,
type
=
'A'
,
comment
=
'ALL'
)
dept
=
DEPT
.
objects
.
get
(
name
=
'默认'
)
user_all
=
Asset
.
objects
.
all
()
for
i
in
range
(
1
,
20
):
for
i
in
range
(
1
,
20
):
name
=
'AssetGroup'
+
str
(
i
)
name
=
'AssetGroup'
+
str
(
i
)
group
=
BisGroup
(
name
=
name
,
type
=
'A'
,
comment
=
name
)
group
=
BisGroup
(
name
=
name
,
dept
=
dept
,
comment
=
name
)
group
.
save
()
group
.
save
()
print
'Add:
%
s'
%
name
print
'Add:
%
s'
%
name
...
@@ -80,11 +98,13 @@ def test_add_asset():
...
@@ -80,11 +98,13 @@ def test_add_asset():
idc_all
=
IDC
.
objects
.
all
()
idc_all
=
IDC
.
objects
.
all
()
test_idc
=
random
.
choice
(
idc_all
)
test_idc
=
random
.
choice
(
idc_all
)
bis_group_all
=
BisGroup
.
objects
.
all
()
bis_group_all
=
BisGroup
.
objects
.
all
()
dept_all
=
DEPT
.
objects
.
all
()
for
i
in
range
(
1
,
500
):
for
i
in
range
(
1
,
500
):
ip
=
'192.168.1.'
+
str
(
i
)
ip
=
'192.168.1.'
+
str
(
i
)
asset
=
Asset
(
ip
=
ip
,
port
=
22
,
login_type
=
'L'
,
idc
=
test_idc
,
is_active
=
True
,
comment
=
'test'
)
asset
=
Asset
(
ip
=
ip
,
port
=
22
,
login_type
=
'L'
,
idc
=
test_idc
,
is_active
=
True
,
comment
=
'test'
)
asset
.
save
()
asset
.
save
()
asset
.
bis_group
=
[
random
.
choice
(
bis_group_all
)
for
i
in
range
(
2
)]
asset
.
bis_group
=
[
random
.
choice
(
bis_group_all
)
for
i
in
range
(
2
)]
asset
.
dept
=
[
random
.
choice
(
dept_all
)
for
i
in
range
(
2
)]
print
"Add:
%
s"
%
ip
print
"Add:
%
s"
%
ip
...
@@ -108,6 +128,7 @@ def test_add_log():
...
@@ -108,6 +128,7 @@ def test_add_log():
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
install
()
test_add_dept
()
test_add_dept
()
test_add_group
()
test_add_group
()
test_add_user
()
test_add_user
()
...
...
jasset/models.py
View file @
56df1f69
...
@@ -17,6 +17,7 @@ class BisGroup(models.Model):
...
@@ -17,6 +17,7 @@ class BisGroup(models.Model):
(
'A'
,
'ASSET'
),
(
'A'
,
'ASSET'
),
)
)
name
=
models
.
CharField
(
max_length
=
80
,
unique
=
True
)
name
=
models
.
CharField
(
max_length
=
80
,
unique
=
True
)
dept
=
models
.
ForeignKey
(
DEPT
)
comment
=
models
.
CharField
(
max_length
=
160
,
blank
=
True
,
null
=
True
)
comment
=
models
.
CharField
(
max_length
=
160
,
blank
=
True
,
null
=
True
)
type
=
models
.
CharField
(
max_length
=
1
,
choices
=
GROUP_TYPE
,
default
=
'P'
)
type
=
models
.
CharField
(
max_length
=
1
,
choices
=
GROUP_TYPE
,
default
=
'P'
)
...
@@ -27,8 +28,6 @@ class BisGroup(models.Model):
...
@@ -27,8 +28,6 @@ class BisGroup(models.Model):
class
Asset
(
models
.
Model
):
class
Asset
(
models
.
Model
):
LOGIN_TYPE_CHOICES
=
(
LOGIN_TYPE_CHOICES
=
(
(
'L'
,
'LDAP'
),
(
'L'
,
'LDAP'
),
(
'S'
,
'SSH_KEY'
),
(
'P'
,
'PASSWORD'
),
(
'M'
,
'MAP'
),
(
'M'
,
'MAP'
),
)
)
ip
=
models
.
IPAddressField
(
unique
=
True
)
ip
=
models
.
IPAddressField
(
unique
=
True
)
...
...
jasset/views.py
View file @
56df1f69
...
@@ -6,7 +6,7 @@ from django.template import RequestContext
...
@@ -6,7 +6,7 @@ from django.template import RequestContext
from
django.shortcuts
import
render_to_response
from
django.shortcuts
import
render_to_response
from
models
import
IDC
,
Asset
,
BisGroup
from
models
import
IDC
,
Asset
,
BisGroup
from
juser.models
import
UserGroup
from
juser.models
import
UserGroup
,
DEPT
from
connect
import
PyCrypt
,
KEY
from
connect
import
PyCrypt
,
KEY
from
jlog.models
import
Log
from
jlog.models
import
Log
from
jumpserver.views
import
jasset_group_add
,
jasset_host_edit
,
pages
from
jumpserver.views
import
jasset_group_add
,
jasset_host_edit
,
pages
...
@@ -19,8 +19,8 @@ def index(request):
...
@@ -19,8 +19,8 @@ def index(request):
return
render_to_response
(
'jasset/jasset.html'
,
)
return
render_to_response
(
'jasset/jasset.html'
,
)
def
f_add_host
(
ip
,
port
,
idc
,
jtype
,
group
,
active
,
comment
,
username
=
''
,
password
=
''
):
def
f_add_host
(
ip
,
port
,
idc
,
jtype
,
group
,
dept
,
active
,
comment
,
username
=
''
,
password
=
''
):
groups
=
[]
groups
,
depts
=
[],
[]
idc
=
IDC
.
objects
.
get
(
name
=
idc
)
idc
=
IDC
.
objects
.
get
(
name
=
idc
)
if
jtype
==
'M'
:
if
jtype
==
'M'
:
print
username
,
password
print
username
,
password
...
@@ -45,7 +45,14 @@ def f_add_host(ip, port, idc, jtype, group, active, comment, username='', passwo
...
@@ -45,7 +45,14 @@ def f_add_host(ip, port, idc, jtype, group, active, comment, username='', passwo
groups
.
append
(
c
)
groups
.
append
(
c
)
groups
.
extend
([
all_group
,
private_group
])
groups
.
extend
([
all_group
,
private_group
])
print
dept
for
d
in
dept
:
print
d
p
=
DEPT
.
objects
.
get
(
name
=
d
)
depts
.
append
(
p
)
a
.
bis_group
=
groups
a
.
bis_group
=
groups
a
.
dept
=
depts
a
.
save
()
a
.
save
()
...
@@ -53,6 +60,7 @@ def add_host(request):
...
@@ -53,6 +60,7 @@ def add_host(request):
login_types
=
{
'L'
:
'LDAP'
,
'S'
:
'SSH_KEY'
,
'P'
:
'PASSWORD'
,
'M'
:
'MAP'
}
login_types
=
{
'L'
:
'LDAP'
,
'S'
:
'SSH_KEY'
,
'P'
:
'PASSWORD'
,
'M'
:
'MAP'
}
header_title
,
path1
,
path2
=
u'添加主机'
,
u'资产管理'
,
u'添加主机'
header_title
,
path1
,
path2
=
u'添加主机'
,
u'资产管理'
,
u'添加主机'
eidc
=
IDC
.
objects
.
all
()
eidc
=
IDC
.
objects
.
all
()
edept
=
DEPT
.
objects
.
all
()
egroup
=
BisGroup
.
objects
.
filter
(
type
=
'A'
)
egroup
=
BisGroup
.
objects
.
filter
(
type
=
'A'
)
eusergroup
=
UserGroup
.
objects
.
all
()
eusergroup
=
UserGroup
.
objects
.
all
()
...
@@ -64,6 +72,7 @@ def add_host(request):
...
@@ -64,6 +72,7 @@ def add_host(request):
j_group
=
request
.
POST
.
getlist
(
'j_group'
)
j_group
=
request
.
POST
.
getlist
(
'j_group'
)
j_active
=
request
.
POST
.
get
(
'j_active'
)
j_active
=
request
.
POST
.
get
(
'j_active'
)
j_comment
=
request
.
POST
.
get
(
'j_comment'
)
j_comment
=
request
.
POST
.
get
(
'j_comment'
)
j_dept
=
request
.
POST
.
getlist
(
'j_dept'
)
if
Asset
.
objects
.
filter
(
ip
=
str
(
j_ip
)):
if
Asset
.
objects
.
filter
(
ip
=
str
(
j_ip
)):
emg
=
u'该IP
%
s 已存在!'
%
j_ip
emg
=
u'该IP
%
s 已存在!'
%
j_ip
...
@@ -72,9 +81,9 @@ def add_host(request):
...
@@ -72,9 +81,9 @@ def add_host(request):
if
j_type
==
'M'
:
if
j_type
==
'M'
:
j_user
=
request
.
POST
.
get
(
'j_user'
)
j_user
=
request
.
POST
.
get
(
'j_user'
)
j_password
=
cryptor
.
encrypt
(
request
.
POST
.
get
(
'j_password'
))
j_password
=
cryptor
.
encrypt
(
request
.
POST
.
get
(
'j_password'
))
f_add_host
(
j_ip
,
j_port
,
j_idc
,
j_type
,
j_group
,
j_active
,
j_comment
,
j_user
,
j_password
)
f_add_host
(
j_ip
,
j_port
,
j_idc
,
j_type
,
j_group
,
j_
dept
,
j_
active
,
j_comment
,
j_user
,
j_password
)
else
:
else
:
f_add_host
(
j_ip
,
j_port
,
j_idc
,
j_type
,
j_group
,
j_active
,
j_comment
)
f_add_host
(
j_ip
,
j_port
,
j_idc
,
j_type
,
j_group
,
j_
dept
,
j_
active
,
j_comment
)
smg
=
u'主机
%
s 添加成功'
%
j_ip
smg
=
u'主机
%
s 添加成功'
%
j_ip
return
render_to_response
(
'jasset/host_add.html'
,
locals
(),
context_instance
=
RequestContext
(
request
))
return
render_to_response
(
'jasset/host_add.html'
,
locals
(),
context_instance
=
RequestContext
(
request
))
...
@@ -184,28 +193,37 @@ def host_del(request, offset):
...
@@ -184,28 +193,37 @@ def host_del(request, offset):
def
host_edit
(
request
):
def
host_edit
(
request
):
actives
=
{
1
:
u'激活'
,
0
:
u'禁用'
}
actives
=
{
1
:
u'激活'
,
0
:
u'禁用'
}
login_types
=
{
'L'
:
'LDAP'
,
'
S'
:
'SSH_KEY'
,
'P'
:
'PASSWORD'
,
'
M'
:
'MAP'
}
login_types
=
{
'L'
:
'LDAP'
,
'M'
:
'MAP'
}
header_title
,
path1
,
path2
=
u'修改主机'
,
u'资产管理'
,
u'修改主机'
header_title
,
path1
,
path2
=
u'修改主机'
,
u'资产管理'
,
u'修改主机'
groups
,
e_group
=
[],
[]
groups
,
e_group
,
e_dept
,
depts
=
[],
[],
[],
[]
eidc
=
IDC
.
objects
.
all
()
eidc
=
IDC
.
objects
.
all
()
egroup
=
BisGroup
.
objects
.
filter
(
type
=
'A'
)
egroup
=
BisGroup
.
objects
.
filter
(
type
=
'A'
)
edept
=
DEPT
.
objects
.
all
()
offset
=
request
.
GET
.
get
(
'id'
)
offset
=
request
.
GET
.
get
(
'id'
)
for
g
in
Asset
.
objects
.
get
(
id
=
int
(
offset
))
.
bis_group
.
all
():
for
g
in
Asset
.
objects
.
get
(
id
=
int
(
offset
))
.
bis_group
.
all
():
e_group
.
append
(
g
)
e_group
.
append
(
g
)
for
d
in
Asset
.
objects
.
get
(
id
=
int
(
offset
))
.
dept
.
all
():
e_dept
.
append
(
d
)
post
=
Asset
.
objects
.
get
(
id
=
int
(
offset
))
post
=
Asset
.
objects
.
get
(
id
=
int
(
offset
))
if
request
.
method
==
'POST'
:
if
request
.
method
==
'POST'
:
j_ip
=
request
.
POST
.
get
(
'j_ip'
)
j_ip
=
request
.
POST
.
get
(
'j_ip'
)
j_idc
=
request
.
POST
.
get
(
'j_idc'
)
j_idc
=
request
.
POST
.
get
(
'j_idc'
)
j_port
=
request
.
POST
.
get
(
'j_port'
)
j_port
=
request
.
POST
.
get
(
'j_port'
)
j_type
=
request
.
POST
.
get
(
'j_type'
)
j_type
=
request
.
POST
.
get
(
'j_type'
)
j_dept
=
request
.
POST
.
getlist
(
'j_dept'
)
j_group
=
request
.
POST
.
getlist
(
'j_group'
)
j_group
=
request
.
POST
.
getlist
(
'j_group'
)
j_active
=
request
.
POST
.
get
(
'j_active'
)
j_active
=
request
.
POST
.
get
(
'j_active'
)
j_comment
=
request
.
POST
.
get
(
'j_comment'
)
j_comment
=
request
.
POST
.
get
(
'j_comment'
)
j_idc
=
IDC
.
objects
.
get
(
name
=
j_idc
)
j_idc
=
IDC
.
objects
.
get
(
name
=
j_idc
)
for
group
in
j_group
:
for
group
in
j_group
:
print
group
c
=
BisGroup
.
objects
.
get
(
name
=
group
)
c
=
BisGroup
.
objects
.
get
(
name
=
group
)
groups
.
append
(
c
)
groups
.
append
(
c
)
for
dept
in
j_dept
:
d
=
DEPT
.
objects
.
get
(
name
=
dept
)
depts
.
append
(
d
)
a
=
Asset
.
objects
.
get
(
id
=
int
(
offset
))
a
=
Asset
.
objects
.
get
(
id
=
int
(
offset
))
if
j_type
==
'M'
:
if
j_type
==
'M'
:
if
post
.
password
==
request
.
POST
.
get
(
'j_password'
):
if
post
.
password
==
request
.
POST
.
get
(
'j_password'
):
...
@@ -231,6 +249,7 @@ def host_edit(request):
...
@@ -231,6 +249,7 @@ def host_edit(request):
a
.
save
()
a
.
save
()
a
.
bis_group
=
groups
a
.
bis_group
=
groups
a
.
dept
=
depts
a
.
save
()
a
.
save
()
smg
=
u'主机
%
s 修改成功'
%
j_ip
smg
=
u'主机
%
s 修改成功'
%
j_ip
return
HttpResponseRedirect
(
'/jasset/host_list'
)
return
HttpResponseRedirect
(
'/jasset/host_list'
)
...
@@ -317,10 +336,13 @@ def del_idc(request, offset):
...
@@ -317,10 +336,13 @@ def del_idc(request, offset):
def
add_group
(
request
):
def
add_group
(
request
):
header_title
,
path1
,
path2
=
u'添加主机组'
,
u'资产管理'
,
u'添加主机组'
header_title
,
path1
,
path2
=
u'添加主机组'
,
u'资产管理'
,
u'添加主机组'
posts
=
Asset
.
objects
.
all
()
posts
=
Asset
.
objects
.
all
()
edept
=
DEPT
.
objects
.
all
()
if
request
.
method
==
'POST'
:
if
request
.
method
==
'POST'
:
j_group
=
request
.
POST
.
get
(
'j_group'
)
j_group
=
request
.
POST
.
get
(
'j_group'
)
j_dept
=
request
.
POST
.
get
(
'j_dept'
)
j_hosts
=
request
.
POST
.
getlist
(
'j_hosts'
)
j_hosts
=
request
.
POST
.
getlist
(
'j_hosts'
)
j_comment
=
request
.
POST
.
get
(
'j_comment'
)
j_comment
=
request
.
POST
.
get
(
'j_comment'
)
j_dept
=
DEPT
.
objects
.
get
(
name
=
j_dept
)
if
BisGroup
.
objects
.
filter
(
name
=
j_group
):
if
BisGroup
.
objects
.
filter
(
name
=
j_group
):
emg
=
u'该主机组已存在!'
emg
=
u'该主机组已存在!'
...
@@ -328,6 +350,7 @@ def add_group(request):
...
@@ -328,6 +350,7 @@ def add_group(request):
else
:
else
:
BisGroup
.
objects
.
create
(
name
=
j_group
,
comment
=
j_comment
,
type
=
'A'
)
BisGroup
.
objects
.
create
(
name
=
j_group
,
comment
=
j_comment
,
type
=
'A'
)
group
=
BisGroup
.
objects
.
get
(
name
=
j_group
)
group
=
BisGroup
.
objects
.
get
(
name
=
j_group
)
group
.
dept
=
j_dept
for
host
in
j_hosts
:
for
host
in
j_hosts
:
g
=
Asset
.
objects
.
get
(
id
=
host
)
g
=
Asset
.
objects
.
get
(
id
=
host
)
group
.
asset_set
.
add
(
g
)
group
.
asset_set
.
add
(
g
)
...
@@ -342,7 +365,7 @@ def list_group(request):
...
@@ -342,7 +365,7 @@ def list_group(request):
if
keyword
:
if
keyword
:
posts
=
BisGroup
.
objects
.
filter
(
Q
(
name__contains
=
keyword
)
|
Q
(
comment__contains
=
keyword
))
posts
=
BisGroup
.
objects
.
filter
(
Q
(
name__contains
=
keyword
)
|
Q
(
comment__contains
=
keyword
))
else
:
else
:
posts
=
BisGroup
.
objects
.
filter
(
type
=
'A'
)
.
order_by
(
'id'
)
posts
=
BisGroup
.
objects
.
all
(
)
.
order_by
(
'id'
)
contact_list
,
p
,
contacts
,
page_range
,
current_page
,
show_first
,
show_end
=
pages
(
posts
,
request
)
contact_list
,
p
,
contacts
,
page_range
,
current_page
,
show_first
,
show_end
=
pages
(
posts
,
request
)
return
render_to_response
(
'jasset/group_list.html'
,
locals
(),
context_instance
=
RequestContext
(
request
))
return
render_to_response
(
'jasset/group_list.html'
,
locals
(),
context_instance
=
RequestContext
(
request
))
...
...
jumpserver.conf
View file @
56df1f69
...
@@ -8,7 +8,7 @@ password = mysql234
...
@@ -8,7 +8,7 @@ password = mysql234
database
=
jumpserver
database
=
jumpserver
[
ldap
]
[
ldap
]
ldap_enable
=
1
ldap_enable
=
0
host_url
=
ldap
://
127
.
0
.
0
.
1
:
389
host_url
=
ldap
://
127
.
0
.
0
.
1
:
389
base_dn
=
dc
=
jumpserver
,
dc
=
org
base_dn
=
dc
=
jumpserver
,
dc
=
org
root_dn
=
cn
=
admin
,
dc
=
jumpserver
,
dc
=
org
root_dn
=
cn
=
admin
,
dc
=
jumpserver
,
dc
=
org
...
...
templates/foot_script.html
View file @
56df1f69
...
@@ -27,7 +27,7 @@
...
@@ -27,7 +27,7 @@
var
str
=
document
.
location
.
pathname
.
split
(
"/"
)[
1
];
var
str
=
document
.
location
.
pathname
.
split
(
"/"
)[
1
];
var
str1
=
document
.
location
.
pathname
.
split
(
"/"
)[
2
];
var
str1
=
document
.
location
.
pathname
.
split
(
"/"
)[
2
];
$
(
"#"
+
str
).
addClass
(
'active'
);
$
(
"#"
+
str
).
addClass
(
'active'
);
if
(
$
(
"
#
"
+
str1
).
length
>
0
)
{
if
(
$
(
"
.
"
+
str1
).
length
>
0
)
{
$
(
"
#
"
+
str1
).
addClass
(
'active'
);
$
(
"
.
"
+
str1
).
addClass
(
'active'
);
}
}
</script>
</script>
templates/jasset/group_add.html
View file @
56df1f69
...
@@ -16,13 +16,25 @@
...
@@ -16,13 +16,25 @@
<div
class=
"alert alert-success text-center"
>
{{ smg }}
</div>
<div
class=
"alert alert-success text-center"
>
{{ smg }}
</div>
{% endif %}
{% endif %}
<form
id=
"assetForm"
method=
"post"
class=
"form-horizontal"
>
<form
id=
"assetForm"
method=
"post"
class=
"form-horizontal"
>
<div
class=
"form-group"
><label
class=
"col-sm-2 control-label"
>
主机组名
</label>
<div
class=
"form-group"
><label
class=
"col-sm-2 control-label"
>
主机组名
<span
class=
"red-fonts"
>
*
</span>
</label>
<div
class=
"col-sm-8"
name=
"group_id"
value=
"{{ post.id }}"
><input
type=
"text"
value=
"{{ group.name }}"
placeholder=
"网站"
name=
"j_group"
class=
"form-control"
></div>
<div
class=
"col-sm-8"
name=
"group_id"
value=
"{{ post.id }}"
><input
type=
"text"
value=
"{{ group.name }}"
placeholder=
"网站"
name=
"j_group"
class=
"form-control"
></div>
</div>
</div>
<div
class=
"hr-line-dashed"
></div>
<div
class=
"hr-line-dashed"
></div>
<div
class=
"form-group"
>
<div
class=
"form-group"
>
<label
for=
"groups"
class=
"col-lg-2 control-label"
>
主机
</label>
<label
for=
"j_dept"
class=
"col-lg-2 control-label"
>
所属部门
<span
class=
"red-fonts"
>
*
</span></label>
<div
class=
"col-sm-8"
>
<select
id=
"j_dept"
name=
"j_dept"
class=
"form-control m-b"
>
{% for d in edept %}
<option
type=
"checkbox"
value=
"{{ d.name }}"
>
{{ d.name }}
</option>
{% endfor %}
</select>
</div>
</div>
<div
class=
"hr-line-dashed"
></div>
<div
class=
"form-group"
>
<label
for=
"groups"
class=
"col-lg-2 control-label"
>
主机
<span
class=
"red-fonts"
>
*
</span></label>
<div
class=
"col-sm-3"
>
<div
class=
"col-sm-3"
>
<select
id=
"groups"
size=
"12"
class=
"form-control m-b"
multiple
>
<select
id=
"groups"
size=
"12"
class=
"form-control m-b"
multiple
>
{% for post in posts %}
{% for post in posts %}
...
...
templates/jasset/group_list.html
View file @
56df1f69
...
@@ -28,6 +28,7 @@
...
@@ -28,6 +28,7 @@
<tr>
<tr>
<th
class=
"text-center"
><input
id=
"checkall"
type=
"checkbox"
class=
"i-checks"
name=
"checkall"
value=
"checkall"
data-editable=
'false'
onclick=
"check_all('contents_form')"
></th>
<th
class=
"text-center"
><input
id=
"checkall"
type=
"checkbox"
class=
"i-checks"
name=
"checkall"
value=
"checkall"
data-editable=
'false'
onclick=
"check_all('contents_form')"
></th>
<th
class=
"text-center"
>
主机组名
</th>
<th
class=
"text-center"
>
主机组名
</th>
<th
class=
"text-center"
>
所属部门
</th>
<th
class=
"text-center"
>
主机数量
</th>
<th
class=
"text-center"
>
主机数量
</th>
<th
class=
"text-center"
>
备注
</th>
<th
class=
"text-center"
>
备注
</th>
<th
class=
"text-center"
>
操作
</th>
<th
class=
"text-center"
>
操作
</th>
...
@@ -38,6 +39,7 @@
...
@@ -38,6 +39,7 @@
<tr
class=
"gradeX"
>
<tr
class=
"gradeX"
>
<td
class=
"text-center"
name=
"j_id"
value=
"{{ post.id }}"
data-editable=
'false'
><input
name=
"id"
value=
"{{ post.id }}"
type=
"checkbox"
class=
"i-checks"
></td>
<td
class=
"text-center"
name=
"j_id"
value=
"{{ post.id }}"
data-editable=
'false'
><input
name=
"id"
value=
"{{ post.id }}"
type=
"checkbox"
class=
"i-checks"
></td>
<td
class=
"text-center"
>
{{ post.name }}
</td>
<td
class=
"text-center"
>
{{ post.name }}
</td>
<td
class=
"text-center"
>
{{ post.dept.name }}
</td>
<td
class=
"text-center"
>
<a
href=
"/jasset/group_detail/?id={{ post.id }}"
>
{{ post.asset_set.count }}
</a>
</td>
<td
class=
"text-center"
>
<a
href=
"/jasset/group_detail/?id={{ post.id }}"
>
{{ post.asset_set.count }}
</a>
</td>
<td
class=
"text-center"
>
{{ post.comment }}
</td>
<td
class=
"text-center"
>
{{ post.comment }}
</td>
<td
class=
"text-center"
>
<td
class=
"text-center"
>
...
...
templates/jasset/host_add.html
View file @
56df1f69
...
@@ -57,8 +57,6 @@
...
@@ -57,8 +57,6 @@
<div
class=
"form-group"
><label
class=
"col-sm-2 control-label"
>
登录方式
<span
class=
"red-fonts"
>
*
</span>
</label>
<div
class=
"form-group"
><label
class=
"col-sm-2 control-label"
>
登录方式
<span
class=
"red-fonts"
>
*
</span>
</label>
<div
class=
"col-sm-8"
>
<div
class=
"col-sm-8"
>
<div
class=
"radio i-checks"
><label>
<input
type=
"radio"
id=
"L"
checked=
""
value=
"L"
name=
"j_type"
onclick=
"show(this)"
>
<i>
LDAP
</i></label></div>
<div
class=
"radio i-checks"
><label>
<input
type=
"radio"
id=
"L"
checked=
""
value=
"L"
name=
"j_type"
onclick=
"show(this)"
>
<i>
LDAP
</i></label></div>
<div
class=
"radio i-checks"
><label>
<input
type=
"radio"
id=
"S"
value=
"S"
name=
"j_type"
onclick=
"show(this)"
>
<i>
SSH_KEY
</i></label></div>
<div
class=
"radio i-checks"
><label>
<input
type=
"radio"
id=
"P"
value=
"P"
name=
"j_type"
onclick=
"show(this)"
>
<i>
PASSWORD
</i></label></div>
<div
class=
"radio i-checks"
><label>
<input
type=
"radio"
id=
"M"
value=
"M"
name=
"j_type"
onclick=
"show(this)"
>
<i>
MAP
</i></label></div>
<div
class=
"radio i-checks"
><label>
<input
type=
"radio"
id=
"M"
value=
"M"
name=
"j_type"
onclick=
"show(this)"
>
<i>
MAP
</i></label></div>
</div>
</div>
...
@@ -86,6 +84,18 @@
...
@@ -86,6 +84,18 @@
</div>
</div>
</div>
</div>
<div
class=
"hr-line-dashed"
></div>
<div
class=
"form-group"
>
<label
for=
"j_dept"
class=
"col-lg-2 control-label"
>
所属部门
<span
class=
"red-fonts"
>
*
</span></label>
<div
class=
"col-sm-8"
>
<select
id=
"j_dept"
name=
"j_dept"
class=
"form-control m-b"
multiple
size=
"10"
>
{% for d in edept %}
<option
type=
"checkbox"
value=
"{{ d.name }}"
>
{{ d.name }} {% if d.comment %} --- {{ d.comment }} {% endif %}
</option>
{% endfor %}
</select>
</div>
</div>
<div
class=
"hr-line-dashed"
></div>
<div
class=
"hr-line-dashed"
></div>
<div
class=
"form-group"
>
<div
class=
"form-group"
>
<label
for=
"j_group"
class=
"col-lg-2 control-label"
>
所属主机组
<span
class=
"red-fonts"
>
*
</span></label>
<label
for=
"j_group"
class=
"col-lg-2 control-label"
>
所属主机组
<span
class=
"red-fonts"
>
*
</span></label>
...
...
templates/jasset/host_edit.html
View file @
56df1f69
...
@@ -93,6 +93,22 @@
...
@@ -93,6 +93,22 @@
</div>
</div>
</div>
</div>
<div
class=
"hr-line-dashed"
></div>
<div
class=
"form-group"
>
<label
for=
"j_dept"
class=
"col-lg-2 control-label"
>
所属部门
<span
class=
"red-fonts"
>
*
</span>
</label>
<div
class=
"col-sm-8"
>
<select
id=
"j_dept"
name=
"j_dept"
class=
"form-control m-b"
multiple
size=
"10"
>
{% for g in edept %}
{% if g in e_dept %}
<option
type=
"checkbox"
value=
"{{ g.name }}"
selected
>
{{ g.name }} --- {{ g.comment }}
</option>
{% else %}
<option
type=
"checkbox"
value=
"{{ g.name }}"
>
{{ g.name }} --- {{ g.comment }}
</option>
{% endif %}
{% endfor %}
</select>
</div>
</div>
<div
class=
"hr-line-dashed"
></div>
<div
class=
"hr-line-dashed"
></div>
<div
class=
"form-group"
>
<div
class=
"form-group"
>
<label
for=
"j_group"
class=
"col-lg-2 control-label"
>
所属主机组
<span
class=
"red-fonts"
>
*
</span>
</label>
<label
for=
"j_group"
class=
"col-lg-2 control-label"
>
所属主机组
<span
class=
"red-fonts"
>
*
</span>
</label>
...
...
templates/jasset/host_list.html
View file @
56df1f69
...
@@ -53,9 +53,10 @@
...
@@ -53,9 +53,10 @@
<th
class=
"text-center"
>
端口号
</th>
<th
class=
"text-center"
>
端口号
</th>
<th
class=
"text-center"
name=
"j_type"
>
登录方式
</th>
<th
class=
"text-center"
name=
"j_type"
>
登录方式
</th>
<th
class=
"text-center"
name=
"j_idc"
>
所属IDC
</th>
<th
class=
"text-center"
name=
"j_idc"
>
所属IDC
</th>
<th
class=
"text-center"
>
所属业务组
</th>
<th
class=
"text-center"
>
所属部门
</th>
<th
class=
"text-center"
>
所属主机组
</th>
<th
class=
"text-center"
>
是否激活
</th>
<th
class=
"text-center"
>
是否激活
</th>
<
th
class=
"text-center"
name=
"j_time"
>
添加时间
</th
>
<
!--<th class="text-center" name="j_time"> 添加时间 </th>--
>
<th
class=
"text-center"
name=
"j_comment"
>
备注
</th>
<th
class=
"text-center"
name=
"j_comment"
>
备注
</th>
<th
class=
"text-center"
>
操作
</th>
<th
class=
"text-center"
>
操作
</th>
</tr>
</tr>
...
@@ -68,9 +69,10 @@
...
@@ -68,9 +69,10 @@
<td
class=
"text-center"
name=
"j_port"
>
{{ post.port }}
</td>
<td
class=
"text-center"
name=
"j_port"
>
{{ post.port }}
</td>
<td
class=
"text-center"
name=
"j_type"
>
{{ login_types|get_item:post.login_type }}
</td>
<td
class=
"text-center"
name=
"j_type"
>
{{ login_types|get_item:post.login_type }}
</td>
<td
class=
"text-center"
name=
"j_idc"
>
{{ post.idc.name }}
</td>
<td
class=
"text-center"
name=
"j_idc"
>
{{ post.idc.name }}
</td>
<td
class=
"text-center"
name=
"j_group"
>
{{ post.dept.all | group_str2 }}
</td>
<td
class=
"text-center"
name=
"j_group"
>
{{ post.bis_group.all | group_str2 }}
</td>
<td
class=
"text-center"
name=
"j_group"
>
{{ post.bis_group.all | group_str2 }}
</td>
<td
class=
"text-center"
name=
"j_active"
>
{{ post.is_active|bool2str }}
</td>
<td
class=
"text-center"
name=
"j_active"
>
{{ post.is_active|bool2str }}
</td>
<
td
class=
"text-center"
>
{{ post.date_added|date:"Y-m-d H:i:s" }}
</td
>
<
!--<td class="text-center"> {{ post.date_added|date:"Y-m-d H:i:s" }} </td>--
>
<td
class=
"text-center"
name=
"j_comment"
>
{{ post.comment }}
</td>
<td
class=
"text-center"
name=
"j_comment"
>
{{ post.comment }}
</td>
<td
class=
"text-center"
data-editable=
'false'
>
<td
class=
"text-center"
data-editable=
'false'
>
<a
value=
"/jasset/{{ post.ip }}/"
class=
"iframe btn btn-xs btn-primary"
>
详情
</a>
<a
value=
"/jasset/{{ post.ip }}/"
class=
"iframe btn btn-xs btn-primary"
>
详情
</a>
...
...
templates/nav.html
View file @
56df1f69
...
@@ -15,23 +15,23 @@
...
@@ -15,23 +15,23 @@
<li
id=
"juser"
>
<li
id=
"juser"
>
<a
href=
"#"
><i
class=
"fa fa-rebel"
></i>
<span
class=
"nav-label"
>
用户管理
</span><span
class=
"fa arrow"
></span></a>
<a
href=
"#"
><i
class=
"fa fa-rebel"
></i>
<span
class=
"nav-label"
>
用户管理
</span><span
class=
"fa arrow"
></span></a>
<ul
class=
"nav nav-second-level"
>
<ul
class=
"nav nav-second-level"
>
<li
id
=
"dept_list"
><a
href=
"/juser/dept_list/"
>
查看部门
</a></li>
<li
class
=
"dept_list"
><a
href=
"/juser/dept_list/"
>
查看部门
</a></li>
<li
id
=
"dept_add"
><a
href=
"/juser/dept_add/"
>
添加部门
</a></li>
<li
class
=
"dept_add"
><a
href=
"/juser/dept_add/"
>
添加部门
</a></li>
<li
id
=
"group_list"
><a
href=
"/juser/group_list/"
>
查看小组
</a></li>
<li
class
=
"group_list"
><a
href=
"/juser/group_list/"
>
查看小组
</a></li>
<li
id
=
"group_add"
><a
href=
"/juser/group_add/"
>
添加小组
</a></li>
<li
class
=
"group_add"
><a
href=
"/juser/group_add/"
>
添加小组
</a></li>
<li
id=
"user_lis
t"
><a
href=
"/juser/user_list/"
>
查看用户
<span
class=
"label {% ifequal user_active_num user_total_num %}label-primary {% else %}label-warning {% endifequal %}pull-right"
>
{{ user_active_num }}/{{ user_total_num }}
</span></a></li>
<li
class=
"user_list user_edi
t"
><a
href=
"/juser/user_list/"
>
查看用户
<span
class=
"label {% ifequal user_active_num user_total_num %}label-primary {% else %}label-warning {% endifequal %}pull-right"
>
{{ user_active_num }}/{{ user_total_num }}
</span></a></li>
<li
id
=
"user_add"
><a
href=
"/juser/user_add/"
>
添加用户
</a></li>
<li
class
=
"user_add"
><a
href=
"/juser/user_add/"
>
添加用户
</a></li>
</ul>
</ul>
</li>
</li>
<li
id=
"jasset"
>
<li
id=
"jasset"
>
<a><i
class=
"fa fa-cube"
></i>
<span
class=
"nav-label"
>
资产管理
</span><span
class=
"fa arrow"
></span></a>
<a><i
class=
"fa fa-cube"
></i>
<span
class=
"nav-label"
>
资产管理
</span><span
class=
"fa arrow"
></span></a>
<ul
class=
"nav nav-second-level"
>
<ul
class=
"nav nav-second-level"
>
<li
id=
"host_add
"
><a
href=
"/jasset/host_add/"
>
添加资产
</a></li>
<li
class=
"host_add host_add_multi
"
><a
href=
"/jasset/host_add/"
>
添加资产
</a></li>
<li
id
=
"host_list"
><a
href=
"/jasset/host_list/"
>
查看资产
&
nbsp
&
nbsp
</span><span
class=
"label label-info pull-right"
>
16/18
</span></a></li>
<li
class
=
"host_list"
><a
href=
"/jasset/host_list/"
>
查看资产
&
nbsp
&
nbsp
</span><span
class=
"label label-info pull-right"
>
16/18
</span></a></li>
<li
id
=
"jgroup_add"
><a
href=
"/jasset/jgroup_add/"
>
添加主机组
</a></li>
<li
class
=
"jgroup_add"
><a
href=
"/jasset/jgroup_add/"
>
添加主机组
</a></li>
<li
id=
"jgroup_list
"
><a
href=
"/jasset/jgroup_list/"
>
查看主机组
</a></li>
<li
class=
"jgroup_list group_detail
"
><a
href=
"/jasset/jgroup_list/"
>
查看主机组
</a></li>
<li
id
=
"idc_add"
><a
href=
"/jasset/idc_add/"
>
添加IDC
</a></li>
<li
class
=
"idc_add"
><a
href=
"/jasset/idc_add/"
>
添加IDC
</a></li>
<li
id=
"idc_list
"
><a
href=
"/jasset/idc_list/"
>
查看IDC
</a></li>
<li
class=
"idc_list idc_detail
"
><a
href=
"/jasset/idc_list/"
>
查看IDC
</a></li>
</ul>
</ul>
</li>
</li>
<li
id=
"jperm"
>
<li
id=
"jperm"
>
...
...
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