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
33c29956
Commit
33c29956
authored
Apr 10, 2018
by
ibuler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Update] 修复bug
parent
84634eb8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
7 deletions
+16
-7
utils.py
apps/common/utils.py
+11
-4
views.py
apps/perms/views.py
+5
-3
No files found.
apps/common/utils.py
View file @
33c29956
...
...
@@ -358,11 +358,17 @@ def get_short_uuid_str():
return
str
(
uuid
.
uuid4
())
.
split
(
'-'
)[
-
1
]
def
is_uuid
(
s
):
if
UUID_PATTERN
.
match
(
s
):
return
True
def
is_uuid
(
seq
):
if
isinstance
(
seq
,
str
):
if
UUID_PATTERN
.
match
(
seq
):
return
True
else
:
return
False
else
:
return
False
for
s
in
seq
:
if
not
is_uuid
(
s
):
return
False
return
True
def
get_signer
():
...
...
@@ -386,3 +392,4 @@ class TeeObj:
def
close
(
self
):
self
.
file_obj
.
close
()
apps/perms/views.py
View file @
33c29956
...
...
@@ -8,7 +8,7 @@ from django.views.generic.edit import DeleteView
from
django.urls
import
reverse_lazy
from
django.conf
import
settings
from
common.utils
import
get_object_or_none
from
common.utils
import
is_uuid
from
.hands
import
AdminUserRequiredMixin
,
Node
,
Asset
from
.models
import
AssetPermission
from
.forms
import
AssetPermissionForm
...
...
@@ -37,13 +37,15 @@ class AssetPermissionCreateView(AdminUserRequiredMixin, CreateView):
def
get_form
(
self
,
form_class
=
None
):
form
=
super
()
.
get_form
(
form_class
=
form_class
)
nodes_id
=
self
.
request
.
GET
.
get
(
"nodes"
)
.
split
(
","
)
assets_id
=
self
.
request
.
GET
.
get
(
"assets"
)
.
split
(
","
)
nodes_id
=
self
.
request
.
GET
.
get
(
"nodes"
)
assets_id
=
self
.
request
.
GET
.
get
(
"assets"
)
if
nodes_id
:
nodes_id
=
nodes_id
.
split
(
","
)
nodes
=
Node
.
objects
.
filter
(
id__in
=
nodes_id
)
form
[
'nodes'
]
.
initial
=
nodes
if
assets_id
:
assets_id
=
assets_id
.
split
(
","
)
assets
=
Asset
.
objects
.
filter
(
id__in
=
assets_id
)
form
[
'assets'
]
.
initial
=
assets
return
form
...
...
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