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
deeb9cdf
Unverified
Commit
deeb9cdf
authored
Dec 25, 2019
by
BaiJiangJie
Committed by
GitHub
Dec 25, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3564 from jumpserver/dev_bai
[Update] 修改校验用户资产权限API不使用缓存
parents
15d1e021
7a6a1b9b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
1 deletion
+7
-1
common.py
apps/perms/api/user_permission/common.py
+3
-0
mixin.py
apps/perms/api/user_permission/mixin.py
+4
-1
No files found.
apps/perms/api/user_permission/common.py
View file @
deeb9cdf
...
...
@@ -59,6 +59,9 @@ class GetUserAssetPermissionActionsApi(UserAssetPermissionMixin,
class
ValidateUserAssetPermissionApi
(
UserAssetPermissionMixin
,
APIView
):
permission_classes
=
(
IsOrgAdminOrAppUser
,)
def
get_cache_policy
(
self
):
return
0
def
get_obj
(
self
):
user_id
=
self
.
request
.
query_params
.
get
(
'user_id'
,
''
)
user
=
get_object_or_404
(
User
,
id
=
user_id
)
...
...
apps/perms/api/user_permission/mixin.py
View file @
deeb9cdf
...
...
@@ -10,9 +10,12 @@ from ...hands import Node, Asset
class
UserAssetPermissionMixin
(
UserPermissionMixin
):
util
=
None
def
get_cache_policy
(
self
):
return
self
.
request
.
query_params
.
get
(
'cache_policy'
,
'0'
)
@lazyproperty
def
util
(
self
):
cache_policy
=
self
.
request
.
query_params
.
get
(
'cache_policy'
,
'0'
)
cache_policy
=
self
.
get_cache_policy
(
)
system_user_id
=
self
.
request
.
query_params
.
get
(
"system_user"
)
util
=
AssetPermissionUtilV2
(
self
.
obj
,
cache_policy
=
cache_policy
)
if
system_user_id
:
...
...
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