Class: UcbRailsUser::LdapPerson::Entry

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.new_from_ldap_entry(ldap_entry) ⇒ Object



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

def new_from_ldap_entry(ldap_entry)
  new(
    :uid => ldap_entry.uid,
    :calnet_id => ldap_entry.berkeleyedukerberosprincipalstring.first,
    :employee_id => ldap_entry.attributes[:berkeleyeduucpathid]&.first,
    :student_id => ldap_entry.berkeleyedustuid,
    :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.first,
    :inactive => ldap_entry.expired? || false
  )
end

Instance Method Details

#==(other) ⇒ Object

Currently only used in rspec



36
37
38
# File 'app/models/ucb_rails_user/ldap_person/entry.rb', line 36

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

#full_nameObject



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

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

#last_firstObject



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

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

#last_first_downcaseObject



31
32
33
# File 'app/models/ucb_rails_user/ldap_person/entry.rb', line 31

def last_first_downcase
  last_first.downcase
end