fix: LoginAssetACL confirm action

pull/9119/head^2
Eric 2 years ago
parent 1fb0b0849d
commit 10e3100d3c

@ -1,10 +1,10 @@
from rest_framework.response import Response
from rest_framework.generics import CreateAPIView from rest_framework.generics import CreateAPIView
from rest_framework.response import Response
from common.utils import reverse, lazyproperty from common.utils import reverse, lazyproperty
from orgs.utils import tmp_to_org from orgs.utils import tmp_to_org
from ..models import LoginAssetACL
from .. import serializers from .. import serializers
from ..models import LoginAssetACL
__all__ = ['LoginAssetCheckAPI'] __all__ = ['LoginAssetCheckAPI']
@ -31,12 +31,12 @@ class LoginAssetCheckAPI(CreateAPIView):
def check_confirm(self): def check_confirm(self):
with tmp_to_org(self.serializer.asset.org): with tmp_to_org(self.serializer.asset.org):
acl = LoginAssetACL.objects\ acl = LoginAssetACL.objects \
.filter(action=LoginAssetACL.ActionChoices.login_confirm)\ .filter(action=LoginAssetACL.ActionChoices.confirm) \
.filter_user(self.serializer.user)\ .filter_user(self.serializer.user) \
.filter_asset(self.serializer.asset)\ .filter_asset(self.serializer.asset) \
.filter_account(self.serializer.validated_data.get('account_username'))\ .filter_account(self.serializer.validated_data.get('account_username')) \
.valid()\ .valid() \
.first() .first()
if acl: if acl:
need_confirm = True need_confirm = True

Loading…
Cancel
Save