Module: Rhoconnect::Handler::Helpers::AuthMethod

Included in:
Changes::Engine, Query::Engine, Search::Engine
Defined in:
lib/rhoconnect/handler/helpers/auth_method.rb

Instance Method Summary collapse

Instance Method Details

#auth_method(operation, client_id = -1)) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/rhoconnect/handler/helpers/auth_method.rb', line 5

def auth_method(operation,client_id=-1)
  edockey = nil
  docobj = nil
  if client_id == -1 
    edockey = :errors
    docobj = @source
  else
    edockey = :search_errors
    docobj = Client.load(client_id,{:source_name => @source.name})
  end 
  begin
    docobj.flush_data(edockey) if operation == 'login'
    @model.send operation
  rescue Exception => e
    log "Model raised #{operation} exception: #{e}"
    log e.backtrace.join("\n")
    docobj.put_data(edockey,{"#{operation}-error"=>{'message'=>e.message}},true)
    return false
  end
  true
end