197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
|
# File 'lib/opennebula/ldap_auth.rb', line 197
def get_groups
if @options[:rfc2307bis]
ldap_groups = [@user['memberOf']].flatten
else
group_base = @options[:group_base] ? @options[:group_base] : @options[:base]
filter = Net::LDAP::Filter.equals(@options[:group_field], @user[@options[:user_group_field]].first)
ldap_groups = @ldap.search(
:base => group_base,
:attributes => [ "dn" ],
:filter => filter
).map! { |entry| entry.dn }
end
groups = []
ldap_groups.each do |group|
if (g = in_hash_ignore_case?(@mapping, group))
if ldap_groups.include? @options[:group_admin_group_dn]
groups << "*#{@mapping[g]}"
else
groups << @mapping[g]
end
end
end
groups.delete(false)
groups.compact.uniq
end
|