class Wobaduser::User

Constants

ATTR_MV

ATTR_MV is for multi-valued attributes. Generated readers will always return an array.

ATTR_SV

ATTR_SV is for single valued attributes only. Generated readers will convert the value to a string before returning or calling your Proc.

Public Instance Methods

all_groups() click to toggle source
# File lib/wobaduser/user.rb, line 65
def all_groups
  filter = Net::LDAP::Filter.present("cn") & Net::LDAP::Filter.eq("objectClass", "group") &
     Net::LDAP::Filter.ex("member:1.2.840.113556.1.4.1941", @entry.dn)
  @ldap.search(filter: filter, attributes: ['cn']).map(&:cn).flatten.map(&:as_utf8)
end
filter(valid = false) click to toggle source
# File lib/wobaduser/user.rb, line 56
def filter(valid = false)
  filter = Net::LDAP::Filter.eq('objectClass', 'user')
  if valid
    filter & ~(Net::LDAP::Filter.ex('UserAccountControl:1.2.840.113556.1.4.803', 2))
  else
    filter
  end
end