10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
# File 'lib/shibboleth-rails/user_model_additions.rb', line 10
def find_or_create_from_shibboleth(identity)
affiliations = identity.delete(:affiliations)
first_name = identity.delete(:first_name)
last_name = identity.delete(:last_name)
user = find_or_create_by_emplid(identity)
user.update_attribute(:name_n, identity[:name_n])
user.update_attribute(:first_name, first_name) if user.respond_to?(:first_name) && first_name.present?
user.update_attribute(:last_name, last_name) if user.respond_to?(:last_name) && last_name.present?
user.update_role(affiliations) if user.respond_to?(:update_role)
user
end
|