Add LDAP GroupSync support for Auditor users
What does this MR do and why?
Closes #2998 (closed): there was no way to sync LDAP users to GitLab as
Auditor users
through LDAP GroupSync, even though the equivalent already existed for
Administrator users (admin_group).
This MR adds an audit_group LDAP config option, following the exact
pattern already used for admin_group:
EE::Gitlab::Auth::Ldap::Sync::AuditorUsersis a new subclass of the existingSync::Usersbase class (the same base classAdminUsersandExternalUsersalready use), settingattribute :auditorand reading member DNs fromaudit_group.EE::Gitlab::Auth::Ldap::Sync::Groups#update_permissionscalls it wheneveraudit_groupis configured, mirroring the existingadmin_groupbranch.Gitlab::Auth::Ldap::Config#audit_groupreads the new option, next to the existingadmin_groupreader.
Members of the configured LDAP group are granted the auditor role on sync; users who are no longer members have it revoked, exactly like the existing admin sync behavior.
Disclosure
This merge request was prepared with the assistance of Claude Code (Anthropic), including
root-cause analysis of the existing admin_group sync pattern, and the
implementation, tests, and documentation above. All changes have been
reviewed prior to submission.
Screenshots or screen recordings
N/A — backend/config change, no UI changes.
How to set up and validate locally
bin/rspec ee/spec/lib/ee/gitlab/auth/ldap/sync/auditor_users_spec.rb ee/spec/lib/ee/gitlab/auth/ldap/sync/groups_spec.rb- All examples pass, including the new
audit_groupsync and revoke cases.