module DeviseLDAPMultiple

To be included in models

Public Instance Methods

current_scope() click to toggle source

Returns the name of the model from the object calling this function

# File lib/devise_ldap_multiple/concern.rb, line 23
def current_scope
  self.class.name.downcase.split("::").last.to_s
end
ldap(*options) click to toggle source

Lets you specify a list off attributes to return, and returns them in a hash If not attributes are specified, all attributes are returned in a hash (with the exception of some fields which clog up the console since they’re huge)

# File lib/devise_ldap_multiple/concern.rb, line 10
def ldap (*options)
  attributes = {}
  unless options.empty?
    options.each do |option|
      attributes[option] = Devise::LDAP::Adapter.get_ldap_param(self.email, option, self.current_scope).first
    end
  else
    attributes = Devise::LDAP::Adapter.get_ldap_entry(self.email, self.current_scope).myhash.except(:usercertificate).except :thumbnailphoto, :usercertificate, :homemdb, :msexchsafesendershash
  end
  attributes
end