mirror of
https://github.com/open-webui/open-webui.git
synced 2026-07-11 08:34:32 -05:00
[PR #19381] [CLOSED] feat: add LDAP group filtering based on search filter memberOf #25193
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/19381
Author: @ctolon
Created: 11/22/2025
Status: ❌ Closed
Base:
dev← Head:ldap-filter-memberof📝 Commits (1)
6025264add functionality for sync LDAP memberOf groups which only in LDAP search filters📊 Changes
4 files changed (+57 additions, -0 deletions)
View changed files
📝
backend/open_webui/config.py(+6 -0)📝
backend/open_webui/main.py(+2 -0)📝
backend/open_webui/routers/auths.py(+24 -0)➕
backend/open_webui/utils/ldap_utils.py(+25 -0)📄 Description
Pull Request Checklist
Note to first-time contributors: Please open a discussion post in Discussions to discuss your idea/fix with the community before creating a pull request, and describe your changes before submitting a pull request.
This is to ensure large feature PRs are discussed with the community first, before starting work on it. If the community does not want this feature or it is not relevant for Open WebUI as a project, it can be identified in the discussion before working on the feature and submitting the PR.
Before submitting, make sure you've checked the following:
devbranch. Not targeting thedevbranch will lead to immediate closure of the PR.Changelog Entry
Description
This pull request introduces an optional LDAP group filtering feature that allows administrators to restrict which LDAP groups are synced to Open WebUI based on the
memberOffilters defined inLDAP_SEARCH_FILTERS. This addresses a common enterprise use case where users belong to many AD/LDAP groups but only specific groupsshould be managed in Open WebUI.
When
LDAP_FILTER_MEMBEROFis enabled, the system parsesmemberOffilters fromLDAP_SEARCH_FILTERSand only syncs groups that match the filter criteria. Thismaintains backward compatibility as the feature is disabled by default.
Added
LDAP_FILTER_MEMBEROF(boolean, default:false) to control LDAP group filtering behaviorbackend/open_webui/utils/ldap_utils.pycontaining:parse_memberof_groups_from_filter()function to extract group CNs from LDAP filtersldap3.utils.dn.parse_dn()Changed
backend/open_webui/config.py: AddedLDAP_FILTER_MEMBEROFconfiguration with persistent storage supportbackend/open_webui/main.py: Registered new config option in application statebackend/open_webui/routers/auths.py:LDAP_FILTER_MEMBEROFconfig retrieval during loginparse_memberof_groups_from_filterutility functionDeprecated
Removed
Fixed
Security
Breaking Changes
Additional Information
(?i)(?<![a-z0-9_])memberOf\s*=\s*([^()]+)for robust filter extractionmemberOffilters in search stringsScreenshots or Videos
output:
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.