lib/prx_auth/rails/ext/controller.rb in prx_auth-rails-4.0.0 vs lib/prx_auth/rails/ext/controller.rb in prx_auth-rails-4.1.0

- old
+ new

@@ -50,11 +50,14 @@ def current_user prx_auth_token end def current_user_info - session[PRX_USER_INFO_SESSION_KEY] ||= fetch_userinfo + session[PRX_USER_INFO_SESSION_KEY] ||= begin + info = fetch_userinfo + info.slice('name', 'preferred_username', 'email', 'image_href', 'apps') + end end def current_user_name current_user_info['name'] || current_user_info['preferred_username'] || current_user_info['email'] end @@ -85,11 +88,11 @@ def sign_out_user reset_session end def account_name_for(account_id) - account_for(account_id).try(:[], :name) + account_for(account_id).try(:[], 'name') end def account_for(account_id) lookup_accounts([account_id]).first end @@ -105,10 +108,11 @@ # fetch any accounts we don't have yet missing = ids - session[PRX_ACCOUNT_MAPPING_SESSION_KEY].keys if missing.present? fetch_accounts(missing).each do |account| - session[PRX_ACCOUNT_MAPPING_SESSION_KEY][account['id']] = account.with_indifferent_access + minimal = account.slice('name', 'type') + session[PRX_ACCOUNT_MAPPING_SESSION_KEY][account['id']] = minimal end end ids.map { |id| session[PRX_ACCOUNT_MAPPING_SESSION_KEY][id] } end