perf: 登录资产的 ACL 支持 ip 控制 (#10581)

Co-authored-by: ibuler <ibuler@qq.com>
This commit is contained in:
fit2bot
2023-05-29 19:45:55 +08:00
committed by GitHub
parent fd7e821f11
commit e61227d694
22 changed files with 235 additions and 129 deletions

View File

@@ -340,15 +340,14 @@ class AuthACLMixin:
def _check_login_acl(self, user, ip):
# ACL 限制用户登录
acl = LoginACL.match(user, ip)
acl = LoginACL.get_match_rule_acls(user, ip)
if not acl:
return
acl: LoginACL
if acl.is_action(acl.ActionChoices.accept):
if acl.is_action(LoginACL.ActionChoices.accept):
return
if acl.is_action(acl.ActionChoices.reject):
if acl.is_action(LoginACL.ActionChoices.reject):
raise errors.LoginACLIPAndTimePeriodNotAllowed(user.username, request=self.request)
if acl.is_action(acl.ActionChoices.review):