LdapFluff::FreeIPA

Public Instance Methods

bind?(uid = nil, password = nil, opts = {}) click to toggle source
# File lib/ldap_fluff/freeipa.rb, line 3
def bind?(uid = nil, password = nil, opts = {})
  unless uid.include?(',')
    unless opts[:search] == false
      service_bind
      user = @member_service.find_user(uid)
    end
    uid = user && user.first ? user.first.dn : "uid=#{uid},cn=users,cn=accounts,#{@base}"
  end
  @ldap.auth(uid, password)
  @ldap.bind
end
groups_for_uid(uid) click to toggle source
# File lib/ldap_fluff/freeipa.rb, line 15
def groups_for_uid(uid)
  begin
    super
  rescue MemberService::InsufficientQueryPrivilegesException
    raise UnauthenticatedException, "Insufficient Privileges to query groups data"
  end
end
is_in_groups(uid, gids = [], all = true) click to toggle source

In freeipa, a simple user query returns a full set of nested groups! yipee

gids should be an array of group common names

returns true if owner is in ALL of the groups if all=true, otherwise returns true if owner is in ANY of the groups

# File lib/ldap_fluff/freeipa.rb, line 30
def is_in_groups(uid, gids = [], all = true)
  service_bind
  groups = @member_service.find_user_groups(uid)
  if all
    return groups & gids == gids
  else
    return groups & gids != []
  end
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.