Class: UcbRailsUser::UserSessionManager::InUcPathAddToUsersTable

Inherits:
ActiveInUserTable show all
Defined in:
app/models/ucb_rails_user/user_session_manager/in_uc_path_add_to_users_table.rb

Instance Attribute Summary

Attributes inherited from Base

#uid

Instance Method Summary collapse

Methods inherited from ActiveInUserTable

#current_user

Methods inherited from Base

#current_user, current_user, current_user=, #log_request, #logout, #people_ou_entry

Instance Method Details

#login(uid) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'app/models/ucb_rails_user/user_session_manager/in_uc_path_add_to_users_table.rb', line 8

def (uid)
  self.uid = uid

  # try UCPath first
  user = safely_load_user_from_api do
    UcbRailsUser::UserUcPathService.create_or_update_user_from_ldap_uid(self.uid)
  end

  # if that doesn't work, try LDAP
  user ||= safely_load_user_from_api do
    UcbRailsUser::UserLdapService.create_or_update_user_from_entry(people_ou_entry)
  end

  user&.tap do |u|
    u&.touch(:last_login_at)
  end
end