Compare commits

...

2 Commits

Author SHA1 Message Date
GareArc
ddca38d573 fix: centralize access_mode validation and support sso_verified
- Add ALLOWED_ACCESS_MODES constant to centralize valid access modes
- Include 'sso_verified' in validation to fix app duplication errors
- Update error message to dynamically list all allowed modes
- Refactor for maintainability: single source of truth for access modes

This fixes the issue where apps with access_mode='sso_verified' could not
be duplicated because the validation in update_app_access_mode() was missing
this mode, even though it was documented in WebAppSettings model.
2026-02-13 23:26:53 -08:00
GareArc
1d26105e84 fix: include sso_verified in access_mode validation
When duplicating apps, the access_mode is inherited from the original app.
If the original app has access_mode='sso_verified', the validation would
fail because update_app_access_mode only accepted public/private/private_all.

This adds 'sso_verified' to the allowed values to match the WebAppSettings
model documentation and prevent duplication errors.
2026-02-13 23:01:17 -08:00

View File

@@ -4,6 +4,8 @@ from pydantic import BaseModel, Field
from services.enterprise.base import EnterpriseRequest
ALLOWED_ACCESS_MODES = ["public", "private", "private_all", "sso_verified"]
class WebAppSettings(BaseModel):
access_mode: str = Field(
@@ -123,8 +125,8 @@ class EnterpriseService:
def update_app_access_mode(cls, app_id: str, access_mode: str):
if not app_id:
raise ValueError("app_id must be provided.")
if access_mode not in ["public", "private", "private_all"]:
raise ValueError("access_mode must be either 'public', 'private', or 'private_all'")
if access_mode not in ALLOWED_ACCESS_MODES:
raise ValueError(f"access_mode must be one of: {', '.join(ALLOWED_ACCESS_MODES)}")
data = {"appId": app_id, "accessMode": access_mode}