fix: add batch get access mode api

This commit is contained in:
GareArc
2025-04-11 15:24:32 -04:00
parent cb13b53ccd
commit 5f87bdbe3a
7 changed files with 86 additions and 68 deletions

View File

@ -13,8 +13,7 @@ from libs.password import compare_password
from models.account import Account, AccountStatus
from models.model import App, EndUser, Site
from services.enterprise.enterprise_service import EnterpriseService
from services.errors.account import (AccountLoginError, AccountNotFoundError,
AccountPasswordError)
from services.errors.account import AccountLoginError, AccountNotFoundError, AccountPasswordError
from services.feature_service import FeatureService
from tasks.mail_email_code_login import send_email_code_login_mail_task
@ -110,10 +109,11 @@ class WebAppAuthService:
"""Check if the user is allowed to access the app."""
system_features = FeatureService.get_system_features()
if system_features.webapp_auth.enabled:
app_settings = EnterpriseService.get_app_access_mode_by_code(app_code=app_code)
app_settings = EnterpriseService.WebAppAuth.get_app_access_mode_by_code(app_code=app_code)
if app_settings.access_mode != "public" and not EnterpriseService.is_user_allowed_to_access_webapp(
account.id, app_code=app_code
if (
app_settings.access_mode != "public"
and not EnterpriseService.WebAppAuth.is_user_allowed_to_access_webapp(account.id, app_code=app_code)
):
raise WebAppAuthAccessDeniedError()