mirror of
https://github.com/open-webui/open-webui.git
synced 2026-07-11 09:33:54 -05:00
[GH-ISSUE #17308] feat: in __user__ include the list of groups the user is part of #18233
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?
Originally created by @AlexZorzi on GitHub (Sep 9, 2025).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/17308
Check Existing Issues
Problem Description
Im managing a openwebui for my company, i was request to track spending by each department, at this time im able to inject in the request headers with only the user ID through the
__user__variable.To keep things more anonymized i would like to track only the total department usage, since im using Oauth users get synced with their own Group from the identity manager so the data is already there, its just missing from the
__user__variable when making a function.Desired Solution you'd like
__user__should contain a list of the user groups, since the user can be part of more than one groupAlternatives Considered
No response
Additional Context
Code i currently use to inject the user id in the request headers
@hemzet commented on GitHub (Sep 19, 2025):
@AlexZorzi
Workaround:
@Schnubl commented on GitHub (Sep 28, 2025):
Hi @hemzet , can you pls explain how to use this code and where to put it in, i have also done a workaround for bring groups to frontend and modifyed the core which i dont like because its a pain when new updates released.
Would it be possible to make this a function or a pipe so you dont have to change the core directly?
@hemzet commented on GitHub (Sep 28, 2025):
@Schnubl
The snippet shows usage in a pipe function. No modification of core required. Just import the group model and use it.
@Schnubl commented on GitHub (Sep 29, 2025):
thx for the fast response.
i tried to creat a new function pipe and paste the code into it.
When try to svae it i get an error = "id"
here is the code that i pasted into the new function:
Did i misunderstand you?
@hemzet commented on GitHub (Sep 30, 2025):
Well, the provided code was simply a snippet to showcase the lines you need to add to your function for accessing group data. It's not the full code of a working function.
@AlexZorzi commented on GitHub (Sep 30, 2025):
Thanks @hemzet for the workaround
@Schnubl edit my Function to your needs, i provide a list of groups to track since my users have multiple groups and you can only send one to openrouter.
@seppel123 commented on GitHub (Oct 2, 2025):
Im sorry i really misunderstood that.
I asked to bring the groups into the frontend, this function works in backend und send results to frontend.