Class: ActiveSalesforce::SessionIDAuthenticationFilter

Inherits:
Object
  • Object
show all
Defined in:
lib/active_record/connection_adapters/sid_authentication_filter.rb

Constant Summary collapse

@@klasses =
Set.new

Class Method Summary collapse

Class Method Details

.filter(controller) ⇒ Object



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/active_record/connection_adapters/sid_authentication_filter.rb', line 33

def self.filter(controller)
  # Look to see if a SID was passed in the URL
  params = controller.params
  sid = params[:sid]
  
  if sid
    api_server_url = params[:api_server_url]
    
    # Iterate over all classes that have registered for SID auth support
    connection = nil
    @@klasses.each do |klass|
      unless connection
        klass.establish_connection(:adapter => 'activesalesforce', :sid => sid, :url => api_server_url)
        connection = klass.connection
      else
        klass = connection
      end
    end
  end
end

.register(klass) ⇒ Object



28
29
30
# File 'lib/active_record/connection_adapters/sid_authentication_filter.rb', line 28

def self.register(klass)
  @@klasses.add(klass)
end