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
eba8e542
Unverified
Commit
eba8e542
authored
Jul 06, 2019
by
老广
Committed by
GitHub
Jul 06, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2891 from jumpserver/dev_perms
[Update] 修复Action转化的bug
parents
0d72c4a7
a8c95093
Hide 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 @
eba8e542
...
...
@@ -52,16 +52,20 @@ class Action:
@classmethod
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
if
len
(
value
)
==
1
:
return
cls
.
NAME_MAP_REVERSE
.
get
(
value
[
0
],
cls
.
NONE
)
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
reduce
(
to_choices
,
value
)
result
=
reduce
(
to_choices
,
db_value
)
return
result
@classmethod
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