LdapFluff::ActiveDirectory

Public Instance Methods

bind?(uid = nil, password = nil, opts = {}) click to toggle source
# File lib/ldap_fluff/active_directory.rb, line 3
def bind?(uid = nil, password = nil, opts = {})
  unless uid.include?(',') || uid.include?('\') || opts[:search] == false
    service_bind
    user = @member_service.find_user(uid)
    uid = user.first.dn if user && user.first
  end
  @ldap.auth(uid, password)
  @ldap.bind
end
is_in_groups(uid, gids = [], all = false) click to toggle source

active directory stores group membership on a users model TODO: query by group individually not like this

# File lib/ldap_fluff/active_directory.rb, line 15
def is_in_groups(uid, gids = [], all = false)
  service_bind
  return true if gids == []
  begin
    groups       = @member_service.find_user_groups(uid)
    intersection = gids & groups
    return (all ? intersection == gids : intersection.size > 0)
  rescue MemberService::UIDNotFoundException
    return false
  end
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.