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
c715c8ec
Commit
c715c8ec
authored
Dec 23, 2014
by
ibuler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改bug, 添加测试文件
parent
a05e4147
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
1 deletion
+30
-1
models.py
jasset/models.py
+1
-1
test_add_user.py
test_add_user.py
+29
-0
No files found.
jasset/models.py
View file @
c715c8ec
...
...
@@ -20,7 +20,7 @@ class Asset(models.Model):
password_common
=
models
.
CharField
(
max_length
=
160
,
blank
=
True
,
null
=
True
)
username_super
=
models
.
CharField
(
max_length
=
80
,
blank
=
True
,
null
=
True
)
password_super
=
models
.
CharField
(
max_length
=
160
,
blank
=
True
,
null
=
True
)
date_added
=
models
.
Cha
rField
(
max_length
=
80
)
date_added
=
models
.
Intege
rField
(
max_length
=
80
)
comment
=
models
.
CharField
(
max_length
=
100
,
blank
=
True
,
null
=
True
)
def
__unicode__
(
self
):
...
...
test_add_user.py
0 → 100644
View file @
c715c8ec
#coding: utf-8
import
os
import
django
os
.
environ
[
'DJANGO_SETTINGS_MODULE'
]
=
'jumpserver.settings'
django
.
setup
()
from
juser.models
import
User
,
Group
from
jasset.models
import
Asset
,
IDC
from
jpermission.models
import
Permission
g
=
Group
(
name
=
'wzp'
,
comment
=
'wzp project'
)
g
.
save
()
u
=
User
(
username
=
'hadoop'
,
password
=
'hadoop'
,
name
=
'hadoop'
,
email
=
'ibuler@qq.com'
,
group
=
g
,
ldap_pwd
=
'hadoop'
,
ssh_key_pwd
=
'hadoop'
,
date_joined
=
0
)
u
.
save
()
i
=
IDC
(
name
=
'lf'
)
i
.
save
()
a
=
Asset
(
ip
=
'172.16.1.122'
,
port
=
2001
,
idc
=
i
,
group
=
g
,
date_added
=
0
)
a
.
save
()
p
=
Permission
(
user
=
u
,
asset
=
a
)
p
.
save
()
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