Skip to content

Commit

Permalink
perf(perms): 获取用户所有授权时转换成 list
Browse files Browse the repository at this point in the history
  • Loading branch information
xuxinwen authored and ibuler committed Nov 22, 2020
1 parent 0104b94 commit c3a32d2
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions apps/perms/utils/asset/user_permission.py
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,9 @@ def get_user_all_assetpermissions_id(user: User):
asset_perms_id = AssetPermission.objects.valid().filter(
Q(users=user) | Q(user_groups__users=user)
).distinct().values_list('id', flat=True)

# !!! 这个很重要,必须转换成 list,避免 Django 生成嵌套子查询
asset_perms_id = list(asset_perms_id)
return asset_perms_id


Expand Down

0 comments on commit c3a32d2

Please sign in to comment.