perf: 修复登录和推送系统用户是密码选择

pull/7535/head
ibuler 2022-01-19 15:50:42 +08:00 committed by Jiangjie.Bai
parent 83c5344307
commit 89c7e514eb
2 changed files with 4 additions and 2 deletions

View File

@ -150,7 +150,9 @@ class AuthMixin:
def load_asset_special_auth(self, asset, username=''):
"""
"""
authbooks = list(AuthBook.objects.filter(asset=asset, systemuser=self))
authbooks = AuthBook.objects.filter(asset=asset).filter(
Q(username=username) | Q(systemuser=self)
)
if len(authbooks) == 0:
return None
elif len(authbooks) == 1:

View File

@ -245,7 +245,7 @@ def push_system_user_util(system_user, assets, task_name, username=None):
special_auth_set = set()
auth_books = AuthBook.objects.filter(asset_id__in=asset_ids).filter(
Q(username__in=usernames) | Q(systemuser__username__in=usernames)
Q(username__in=usernames) | Q(systemuser=system_user)
).prefetch_related('systemuser')
for auth_book in auth_books: