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
a8c95093
Commit
a8c95093
authored
Jul 06, 2019
by
BaiJiangJie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Update] 修复Action转化的bug
parent
0d72c4a7
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
6 deletions
+10
-6
asset_permission.py
apps/perms/models/asset_permission.py
+10
-6
No files found.
apps/perms/models/asset_permission.py
View file @
a8c95093
...
@@ -52,16 +52,20 @@ class Action:
...
@@ -52,16 +52,20 @@ class Action:
@classmethod
@classmethod
def
choices_to_value
(
cls
,
value
):
def
choices_to_value
(
cls
,
value
):
if
not
value
:
if
not
isinstance
(
value
,
list
):
return
cls
.
NONE
db_value
=
[
cls
.
NAME_MAP_REVERSE
[
v
]
for
v
in
value
if
v
in
cls
.
NAME_MAP_REVERSE
.
keys
()
]
if
not
db_value
:
return
cls
.
NONE
return
cls
.
NONE
if
len
(
value
)
==
1
:
return
cls
.
NAME_MAP_REVERSE
.
get
(
value
[
0
],
cls
.
NONE
)
def
to_choices
(
x
,
y
):
def
to_choices
(
x
,
y
):
x
=
cls
.
NAME_MAP_REVERSE
.
get
(
x
,
cls
.
NONE
)
y
=
cls
.
NAME_MAP_REVERSE
.
get
(
y
,
cls
.
NONE
)
return
x
|
y
return
x
|
y
return
reduce
(
to_choices
,
value
)
result
=
reduce
(
to_choices
,
db_value
)
return
result
@classmethod
@classmethod
def
choices
(
cls
):
def
choices
(
cls
):
...
...
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