perf(perms): 获取用户所有授权时转换成 list

pull/5068/head
xinwen 2020-11-22 17:18:46 +08:00 committed by 老广
parent 7be7c8cee1
commit 39ab5978be
1 changed files with 3 additions and 0 deletions

View File

@ -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