Module: CalnetAuthenticated::UserModel::ClassMethods
- Defined in:
- lib/calnet_authenticated/user_model.rb
Overview
PrepMethod
Instance Method Summary collapse
-
#find_create_and_update_by_uid(uid) ⇒ Object
Find or Create a user from a given uid, and then proceed to update the user’s information from the UCB::LDAP::Person.find_by_uid(uid) response.
Instance Method Details
#find_create_and_update_by_uid(uid) ⇒ Object
Find or Create a user from a given uid, and then proceed to update the user’s information from the UCB::LDAP::Person.find_by_uid(uid) response.
Returns: user
73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/calnet_authenticated/user_model.rb', line 73 def find_create_and_update_by_uid(uid) user = self.find_or_create_by_uid(uid) person = UCB::LDAP::Person.find_by_uid(uid) user.update_attributes!({ :displayname => person.displayname, :sn => person.sn.first, :mail => person.mail.first || '', :telephonenumber => person.telephonenumber.first }) user end |