# File lib/ldap_fluff/ldap_fluff.rb, line 7 def initialize(config=nil) config ||= LdapFluff::Config.instance type = config.server_type if type.respond_to? :to_sym if type.to_sym == :posix @ldap = Posix.new(config) elsif type.to_sym == :active_directory @ldap = ActiveDirectory.new(config) elsif type.to_sym == :free_ipa @ldap = FreeIPA.new(config) else raise Exception, "Unsupported connection type. Supported types = :active_directory, :posix, :free_ipa" end end end
return true if the user password combination authenticates the user, otherwise false
# File lib/ldap_fluff/ldap_fluff.rb, line 25 def authenticate?(uid, password) @ldap.bind? uid, password end
return a list[] of groups for a given uid
# File lib/ldap_fluff/ldap_fluff.rb, line 30 def group_list(uid) @ldap.groups_for_uid(uid) end
return true if a user is in all of the groups in grouplist
# File lib/ldap_fluff/ldap_fluff.rb, line 36 def is_in_groups?(uid, grouplist) @ldap.is_in_groups(uid, grouplist, true) end