Module: Authpds::Helpers::Institution::CurrentInstitutionHelper
- Includes:
- ParamHelper
- Included in:
- Controllers::AuthpdsController
- Defined in:
- lib/authpds/helpers/institution/current_institution_helper.rb
Instance Method Summary collapse
-
#current_primary_institution ⇒ Object
Determine current primary institution based on: 0.
Methods included from ParamHelper
#institution_param, #institution_param_key
Instance Method Details
#current_primary_institution ⇒ Object
Determine current primary institution based on:
0. institutions are not being used (returns nil)
1. institution query string parameter in URL
2. institution associated with the client IP
3. primary institution for the current user
4. first default institution
14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/authpds/helpers/institution/current_institution_helper.rb', line 14 def current_primary_institution @current_primary_institution ||= case when (institution_param.present? && all_institutions[institution_param]) all_institutions[institution_param] when primary_institution_from_ip.present? primary_institution_from_ip when (@current_user && current_user.primary_institution) current_user.primary_institution else Institutions.defaults.first end end |