class LdapFluff::Posix::MemberService

handles the naughty bits of posix ldap

Public Class Methods

new(ldap, config) click to toggle source
Calls superclass method LdapFluff::GenericMemberService::new
# File lib/ldap_fluff/posix_member_service.rb, line 5
def initialize(ldap, config)
  @attr_login = (config.attr_login || 'memberuid')
  super
end

Public Instance Methods

find_user(uid, base_dn = @base) click to toggle source
# File lib/ldap_fluff/posix_member_service.rb, line 10
def find_user(uid, base_dn = @base)
  user = @ldap.search(:filter => name_filter(uid), :base => base_dn)
  raise UIDNotFoundException if (user.nil? || user.empty?)
  user
end
find_user_groups(uid) click to toggle source

return an ldap user with groups attached note : this method is not particularly fast for large ldap systems

# File lib/ldap_fluff/posix_member_service.rb, line 18
def find_user_groups(uid)
  @ldap.search(
    :filter => Net::LDAP::Filter.eq('memberuid', uid),
    :base => @group_base, :attributes => ["cn"]
  ).map { |entry| entry[:cn][0] }
end