lib/authpds/controllers/authpds_controller.rb in authpds-0.0.6 vs lib/authpds/controllers/authpds_controller.rb in authpds-0.0.7

- old
+ new

@@ -28,17 +28,17 @@ # 3. primary institution for the current user # 4. first default institution def current_primary_institution @current_primary_institution ||= (InstitutionList.institutions_defined?) ? - (params["institution"].nil? or InstitutionList.instance.get(params["institution"]).nil?) ? + (params["#{institution_param_key}"].nil? or InstitutionList.instance.get(params["#{institution_param_key}"]).nil?) ? (primary_institution_from_ip.nil?) ? (current_user.nil? or current_user.primary_institution.nil?) ? InstitutionList.instance.default_institutions.first : current_user.primary_institution : primary_institution_from_ip : - InstitutionList.instance.get(params["institution"]) : + InstitutionList.instance.get(params["#{institution_param_key}"]) : nil end # Grab the first institution that matches the client IP def primary_institution_from_ip @@ -53,15 +53,21 @@ :application : current_primary_institution.application_layout end # Override to add institution. def url_for(options={}) - options["institution"] = params["institution"] unless params["institution"].nil? or options["institution"] + options["#{institution_param_key}"] = + params["#{institution_param_key}"] unless params["#{institution_param_key}"].nil? or + options["#{institution_param_key}"] super(options) end def user_session_redirect_url(url) (url.nil?) ? (request.referer.nil?) ? root_url : request.referer : url + end + + def institution_param_key + @institution_param_key ||= UserSession.insitution_param end end end end end \ No newline at end of file