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



38
39
40
41
42
43
44
45
46
47
48
49
# File 'app/models/ucb_rails/ldap_person/entry.rb', line 38

def new_from_ldap_entry(ldap_entry)
  new(
    :uid => ldap_entry.uid,
    :calnet_id => ldap_entry.berkeleyedukerberosprincipalstring.first,
    :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
  )
end

Instance Method Details

#==(other) ⇒ Object

Currently only used in rspec



32
33
34
# File 'app/models/ucb_rails/ldap_person/entry.rb', line 32

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

#full_nameObject



19
20
21
# File 'app/models/ucb_rails/ldap_person/entry.rb', line 19

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

#last_firstObject



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

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

#last_first_downcaseObject



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

def last_first_downcase
  last_first.downcase
end