mirror of
https://github.com/open-webui/open-webui.git
synced 2026-05-06 19:08:59 -05:00
[PR #17196] [CLOSED] feat: Add OAUTH_PRESERVE_LOCAL_GROUPS option to protect local groups during OAuth sync #39986
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/open-webui/open-webui/pull/17196
Author: @wggcch
Created: 9/4/2025
Status: ❌ Closed
Base:
main← Head:feat/oauth-group-sync-preserve-local-groups📝 Commits (1)
d7975f2feat:📊 Changes
3 files changed (+91 additions, -8 deletions)
View changed files
📝
backend/open_webui/config.py(+6 -0)📝
backend/open_webui/models/groups.py(+29 -1)📝
backend/open_webui/utils/oauth.py(+56 -7)📄 Description
🎯 Problem
Currently, OAuth group synchronization overwrites all local groups, removing users from locally managed groups when they login via OAuth. This creates management conflicts between OAuth-managed and locally-managed groups.
🚀 Solution
This PR introduces a new optional configuration
OAUTH_PRESERVE_LOCAL_GROUPSthat allows administrators to preserve locally created groups while still enabling OAuth group synchronization.📋 Changes
New Configuration Option
OAUTH_PRESERVE_LOCAL_GROUPS(default:false) - Enables protection of local groups during OAuth syncCore Functionality
oauth_sourcein metadata)Modified Files
backend/open_webui/config.py: Added new configuration optionbackend/open_webui/models/groups.py: Extended group creation with OAuth trackingbackend/open_webui/utils/oauth.py: Enhanced group sync logic for local group preservation🔧 Usage
🧪 Scenarios Covered
🔄 Backward Compatibility
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.