Sha256: 4e80ebbbc23f77ac0fb6e2bef16fe702ed2c0decc583bedd3e22f2a40a63dc02
Contents?: true
Size: 1.3 KB
Versions: 12
Compression:
Stored size: 1.3 KB
Contents
module UcbRails::LdapPerson class Entry # include ActiveAttr::Model <--- doesn't work with 4.0 (mass assign. security) include ::ActiveAttr::Attributes include ::ActiveAttr::BasicModel include ::ActiveAttr::BlockInitialization include ::ActiveAttr::MassAssignment attribute :uid attribute :calnet_id attribute :first_name attribute :last_name attribute :email attribute :phone attribute :departments attribute :affiliations def full_name "#{first_name()} #{last_name()}" end def last_first "#{last_name}, #{first_name}" end def last_first_downcase last_first.downcase end # Currently only used in rspec def ==(other) uid == other.uid end class << self 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 end end end
Version data entries
12 entries across 12 versions & 1 rubygems