Skip to content

Commit 57c9916

Browse files
committed
fix: circular import between groups.py and config.py breaks migrations
Move the DEFAULT_GROUP_SHARE_PERMISSION import from module level into the two methods that use it. The top-level import created a cycle: users -> groups -> config -> run_migrations -> auths -> users. Migrations failed silently on startup.
1 parent ebd7b9f commit 57c9916

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

backend/open_webui/models/groups.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
from sqlalchemy.orm import Session
88
from open_webui.internal.db import Base, JSONField, get_db, get_db_context
9-
from open_webui.config import DEFAULT_GROUP_SHARE_PERMISSION
109

1110
from open_webui.models.files import FileMetadataResponse
1211

@@ -133,6 +132,8 @@ class GroupListResponse(BaseModel):
133132
class GroupTable:
134133
def _ensure_default_share_config(self, group_data: dict) -> dict:
135134
"""Ensure the group data dict has a default share config if not already set."""
135+
from open_webui.config import DEFAULT_GROUP_SHARE_PERMISSION
136+
136137
if "data" not in group_data or group_data["data"] is None:
137138
group_data["data"] = {}
138139
if "config" not in group_data["data"]:
@@ -503,6 +504,7 @@ def remove_user_from_all_groups(
503504
def create_groups_by_group_names(
504505
self, user_id: str, group_names: list[str], db: Optional[Session] = None
505506
) -> list[GroupModel]:
507+
from open_webui.config import DEFAULT_GROUP_SHARE_PERMISSION
506508

507509
# check for existing groups
508510
existing_groups = self.get_all_groups(db=db)

0 commit comments

Comments
 (0)