mirror of
https://github.com/wahyd4/gitlabhq.git
synced 2026-08-28 22:16:15 +10:00
Pass LDAP adapter to finders in update_permissions
This commit is contained in:
@@ -31,13 +31,13 @@ module Gitlab
|
||||
return true unless Gitlab.config.ldap['group_base'].present?
|
||||
|
||||
# Get LDAP user entry
|
||||
ldap_user = Gitlab::LDAP::Person.find_by_dn(user.extern_uid)
|
||||
ldap_user = Gitlab::LDAP::Person.find_by_dn(user.extern_uid, adapter)
|
||||
|
||||
# Get all GitLab groups with activated LDAP
|
||||
groups = ::Group.where('ldap_cn IS NOT NULL')
|
||||
|
||||
# Get LDAP groups based on cn from GitLab groups
|
||||
ldap_groups = groups.pluck(:ldap_cn).map { |cn| Gitlab::LDAP::Group.find_by_cn(cn) }
|
||||
ldap_groups = groups.pluck(:ldap_cn).map { |cn| Gitlab::LDAP::Group.find_by_cn(cn, adapter) }
|
||||
ldap_groups = ldap_groups.compact.uniq
|
||||
|
||||
# Iterate over ldap groups and check user membership
|
||||
|
||||
@@ -7,8 +7,9 @@
|
||||
module Gitlab
|
||||
module LDAP
|
||||
class Group
|
||||
def self.find_by_cn(cn)
|
||||
Gitlab::LDAP::Adapter.new.group(cn)
|
||||
def self.find_by_cn(cn, adapter=nil)
|
||||
adapter ||= Gitlab::LDAP::Adapter.new
|
||||
adapter.group(cn)
|
||||
end
|
||||
|
||||
def initialize(entry)
|
||||
|
||||
Reference in New Issue
Block a user