Sha256: 9084acb93d5d8190ea675b350e7950fc7132d4454e4374334747f0686b7ef4bb
Contents?: true
Size: 903 Bytes
Versions: 10
Compression:
Stored size: 903 Bytes
Contents
# Session manager that attempts to pull the user record from UCPath, and # falls back to LDAP if needed module UcbRailsUser module UserSessionManager class InUcPathAddToUsersTable < ActiveInUserTable def login(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 private def safely_load_user_from_api(&block) begin user = block.call rescue StandardError user = nil end user end end end end
Version data entries
10 entries across 10 versions & 1 rubygems