perf: 修改命令过滤相关的Model, CommandFilterACL, CommandGroup; 修改Model QuerySet 相关的方法;

This commit is contained in:
Bai
2022-12-04 00:04:39 +08:00
parent 6480b916d6
commit 2b5bd558f3
7 changed files with 147 additions and 119 deletions

View File

@@ -31,13 +31,13 @@ class LoginAssetCheckAPI(CreateAPIView):
def check_confirm(self):
with tmp_to_org(self.serializer.asset.org):
acl = LoginAssetACL.objects \
.filter(action=LoginAssetACL.ActionChoices.review) \
.filter_user(self.serializer.user) \
.filter_asset(self.serializer.asset) \
.filter_account(self.serializer.validated_data.get('account_username')) \
.valid() \
.first()
kwargs = {
'user': self.serializer.user,
'asset': self.serializer.asset,
'account_username': self.serializer.validated_data.get('account_username'),
'action': LoginAssetACL.ActionChoices.review
}
acl = LoginAssetACL.filter_queryset(**kwargs).valid().first()
if acl:
need_confirm = True
response_data = self._get_response_data_of_need_confirm(acl)