Spaces:
Build error
Build error
Download backend/open_webui/utils/groups.py from Joshua0918/open-webui: direct link, hf CLI and curl.
- Browser
- Download file 704 Bytes
-
https://huggingface.co/spaces/Joshua0918/open-webui/resolve/main/backend/open_webui/utils/groups.py
- Command line
-
hf download hf://spaces/Joshua0918/open-webui/backend/open_webui/utils/groups.py
-
curl -L -o groups.py https://huggingface.co/spaces/Joshua0918/open-webui/resolve/main/backend/open_webui/utils/groups.py
704 Bytes
| import logging | |
| from open_webui.models.groups import Groups | |
| log = logging.getLogger(__name__) | |
| def apply_default_group_assignment( | |
| default_group_id: str, | |
| user_id: str, | |
| db=None, | |
| ) -> None: | |
| """ | |
| Apply default group assignment to a user if default_group_id is provided. | |
| Args: | |
| default_group_id: ID of the default group to add the user to | |
| user_id: ID of the user to add to the default group | |
| """ | |
| if default_group_id: | |
| try: | |
| Groups.add_users_to_group(default_group_id, [user_id], db=db) | |
| except Exception as e: | |
| log.error( | |
| f"Failed to add user {user_id} to default group {default_group_id}: {e}" | |
| ) | |