mirror of
https://github.com/open-webui/open-webui
synced 2024-11-22 08:07:55 +00:00
fix: user ID filtering in GroupTable query
This commit is contained in:
parent
37f19f68eb
commit
80e2d4d4ee
@ -11,7 +11,7 @@ from open_webui.apps.webui.models.files import FileMetadataResponse
|
|||||||
|
|
||||||
|
|
||||||
from pydantic import BaseModel, ConfigDict
|
from pydantic import BaseModel, ConfigDict
|
||||||
from sqlalchemy import BigInteger, Column, String, Text, JSON
|
from sqlalchemy import BigInteger, Column, String, Text, JSON, func
|
||||||
|
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
@ -128,7 +128,8 @@ class GroupTable:
|
|||||||
return [
|
return [
|
||||||
GroupModel.model_validate(group)
|
GroupModel.model_validate(group)
|
||||||
for group in db.query(Group)
|
for group in db.query(Group)
|
||||||
.filter(Group.user_ids.contains([user_id]))
|
.filter(func.json_array_length(Group.user_ids) > 0) # Ensure array exists
|
||||||
|
.filter(Group.user_ids.cast(String).like(f'%"{user_id}"%')) # String-based check
|
||||||
.order_by(Group.updated_at.desc())
|
.order_by(Group.updated_at.desc())
|
||||||
.all()
|
.all()
|
||||||
]
|
]
|
||||||
|
Loading…
Reference in New Issue
Block a user