Class: UcbRails::LdapPerson::Entry

Inherits:
Object
  • Object
show all
Includes:
ActiveAttr::Attributes, ActiveAttr::BasicModel, ActiveAttr::BlockInitialization, ActiveAttr::MassAssignment
Defined in:
app/models/ucb_rails/ldap_person/entry.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.new_from_ldap_entry(ldap_entry) ⇒ Object



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'app/models/ucb_rails/ldap_person/entry.rb', line 41

def new_from_ldap_entry(ldap_entry)
  p ldap_entry.expired?
  new(
    :uid => ldap_entry.uid,
    :calnet_id => ldap_entry.berkeleyedukerberosprincipalstring.first,
    :employee_id => ldap_entry.employeenumber,
    :first_name => ldap_entry.givenname.first,
    :last_name => ldap_entry.sn.first,
    :email => ldap_entry.mail.first,
    :phone => ldap_entry.phone,
    :departments => ldap_entry.berkeleyeduunithrdeptname,
    :affiliations => ldap_entry.berkeleyeduaffiliations,
    :affiliate_id => ldap_entry.berkeleyeduaffid,
    :inactive => ldap_entry.expired? || false
  )
end

Instance Method Details

#==(other) ⇒ Object

Currently only used in rspec



35
36
37
# File 'app/models/ucb_rails/ldap_person/entry.rb', line 35

def ==(other)
  uid == other.uid
end

#full_nameObject



22
23
24
# File 'app/models/ucb_rails/ldap_person/entry.rb', line 22

def full_name
  "#{first_name()} #{last_name()}"
end

#last_firstObject



26
27
28
# File 'app/models/ucb_rails/ldap_person/entry.rb', line 26

def last_first
  "#{last_name}, #{first_name}"
end

#last_first_downcaseObject



30
31
32
# File 'app/models/ucb_rails/ldap_person/entry.rb', line 30

def last_first_downcase
  last_first.downcase
end