Module: Rhoconnect::Condition::ClientRequiredHelpers
- Defined in:
- lib/rhoconnect/condition/client_required.rb
Instance Method Summary collapse
-
#extract_current_client ⇒ Object
helper method.
Instance Method Details
#extract_current_client ⇒ Object
helper method
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/rhoconnect/condition/client_required.rb', line 30 def extract_current_client client = nil # TODO: This is removed when V3 is deprecated if params["cud"] cud_client_id = JSON.parse(params["cud"])["client_id"] params.merge!(:client_id => cud_client_id) if cud_client_id end client_id = @env[Rhoconnect::CLIENT_ID_HEADER] client_id = params[:client_id] unless client_id if client_id client = Client.load(client_id.to_s, params[:source_name] ? {:source_name => params[:source_name]} : {:source_name => '*'}) if client and current_user and client.user_id != current_user.login client.switch_user(current_user.login) end end client end |