Class: KU::LDAP::Entry::User

Inherits:
Base
  • Object
show all
Defined in:
lib/ku/ldap/entry/user.rb

Constant Summary

Constants inherited from Base

Base::BASE

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#==, first, #initialize, search

Constructor Details

This class inherits a constructor from KU::LDAP::Entry::Base

Class Method Details

.authenticate(directory, id, password) ⇒ Object



9
10
11
12
# File 'lib/ku/ldap/entry/user.rb', line 9

def self.authenticate directory, id, password
  entry = Array(directory.authenticate(base, KU::LDAP::Filter.new.eq(identifier, id), password)).first
  new entry if entry
end

Instance Method Details

#departmentObject



38
39
40
# File 'lib/ku/ldap/entry/user.rb', line 38

def department
  self[:departmentnumber]
end

#emailObject



42
43
44
# File 'lib/ku/ldap/entry/user.rb', line 42

def email
  self[:mail]
end

#first_nameObject



18
19
20
# File 'lib/ku/ldap/entry/user.rb', line 18

def first_name
  self[:givenname]
end

#full_nameObject



26
27
28
# File 'lib/ku/ldap/entry/user.rb', line 26

def full_name
  self[:displayname]
end

#group_idsObject



54
55
56
# File 'lib/ku/ldap/entry/user.rb', line 54

def group_ids
  groups.map(&:id)
end

#groupsObject



50
51
52
# File 'lib/ku/ldap/entry/user.rb', line 50

def groups
  @groups ||= KU::LDAP.groups(:memberuid, id, :eq)
end

#idObject



14
15
16
# File 'lib/ku/ldap/entry/user.rb', line 14

def id
  self[:uid]
end

#last_nameObject



22
23
24
# File 'lib/ku/ldap/entry/user.rb', line 22

def last_name
  self[:sn]
end

#primary_groupObject



46
47
48
# File 'lib/ku/ldap/entry/user.rb', line 46

def primary_group
  Group.new self[:employeetype]
end

#primary_institutionObject



34
35
36
# File 'lib/ku/ldap/entry/user.rb', line 34

def primary_institution
  self[:o]
end

#titleObject



30
31
32
# File 'lib/ku/ldap/entry/user.rb', line 30

def title
  self[:title]
end