mirror of
https://github.com/open-webui/open-webui.git
synced 2026-05-07 11:28:35 -05:00
[PR #20241] [CLOSED] fix: Knowledge Base not visible when shared with multiple groups #25516
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/20241
Author: @Classic298
Created: 12/29/2025
Status: ❌ Closed
Base:
dev← Head:fix-access-control📝 Commits (1)
09e3ec2fix: SQLite JSON contains query for multi-group Knowledge Base visibility (#137)📊 Changes
1 file changed (+14 additions, -13 deletions)
View changed files
📝
backend/open_webui/utils/db/access_control.py(+14 -13)📄 Description
Summary
.contains()withEXISTS+json_each()pattern using parameterized queriesProblem
When a Knowledge Base was shared with multiple groups (e.g., Group B and Group C), users belonging to those groups couldn't see it. Sharing with a single group worked correctly.
The root cause was SQLAlchemy's
.contains([gid])not working correctly with SQLite's JSON columns when the array has multiple items.Solution
Use SQLite's
json_each()table-valued function withEXISTSsubquery, matching the pattern already used inmodels/chats.py. This properly checks if a value exists in a JSON array.Fixes #20229, https://github.com/open-webui/open-webui/issues/20124
Test plan
Contributor License Agreement
By submitting this pull request, I confirm that I have read and fully agree to the Contributor License Agreement (CLA), and I am providing my contributions under its terms.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.