@@ -9,6 +9,7 @@ from app.db.models import (
|
||||
UserWorkspaceAccess,
|
||||
Workspace,
|
||||
)
|
||||
from app.core.config import settings
|
||||
|
||||
|
||||
class AccessService:
|
||||
@@ -36,19 +37,25 @@ class AccessService:
|
||||
|
||||
@staticmethod
|
||||
def default_user_workspace_code(db: Session) -> str | None:
|
||||
"""Return the first active ABC project workspace.
|
||||
"""Return the configured public feedback workspace.
|
||||
|
||||
The old Q&A_Platform seed workspace must not determine the first SSO
|
||||
redirect after ABC projects are synchronized.
|
||||
Users without an explicit role assignment receive END_USER access to
|
||||
this workspace. A configured code prevents old seed data or a newly
|
||||
created project from changing the public writer target.
|
||||
"""
|
||||
return db.execute(
|
||||
configured_code = settings.default_support_workspace_code.strip()
|
||||
query = (
|
||||
select(Workspace.workspace_code)
|
||||
.where(
|
||||
Workspace.is_active.is_(True),
|
||||
Workspace.workspace_type == "SOFTWARE_APP",
|
||||
)
|
||||
.order_by(Workspace.id.asc()),
|
||||
).scalar()
|
||||
)
|
||||
if configured_code:
|
||||
query = query.where(Workspace.workspace_code == configured_code)
|
||||
else:
|
||||
query = query.order_by(Workspace.id.asc())
|
||||
return db.execute(query).scalar()
|
||||
|
||||
@staticmethod
|
||||
def _upsert_support_user(
|
||||
|
||||
Reference in New Issue
Block a user