Module: DRCClient

Defined in:
lib/drc_client.rb

Defined Under Namespace

Modules: HelperMethods

Constant Summary collapse

@@drc_config =

These are initialized when you call configure

{
  :base_url => nil,
  :enable_single_sign_out => nil,
  :user_model => nil,
  :drc_user_column => nil,
  :local_user_id_column => nil,
  :require_local_user => nil,
  :require_access_level => nil # none, student, teacher, director, federation_president
}

Class Method Summary collapse

Class Method Details

.configObject



46
47
48
# File 'lib/drc_client.rb', line 46

def self.config
  return @@drc_config
end

.configure(configuration) ⇒ Object



28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/drc_client.rb', line 28

def self.configure(configuration)
  @@drc_config[:base_url] = configuration.delete(:base_url)
  @@drc_config[:enable_single_sign_out] = configuration.delete(:enable_single_sign_out) || false
  @@drc_config[:user_model] = configuration.delete(:user_model)
  @@drc_config[:drc_user_column] = configuration.delete(:drc_user_column) || :drc_user
  @@drc_config[:require_local_user] = configuration.delete(:require_local_user)
  @@drc_config[:require_access_level] = configuration.delete(:require_access_level)
  @@drc_config[:local_user_id_column] = configuration.delete(:local_user_id_column) || :id

  configuration.merge!({:cas_base_url => @@drc_config[:base_url],
                        :enable_single_sign_out => @@drc_config[:enable_single_sign_out]})
  CASClient::Frameworks::Rails::Filter.configure(configuration)
end

.filter(opts = {}) ⇒ Object



19
20
21
22
23
24
25
26
# File 'lib/drc_client.rb', line 19

def self.filter(opts={})
  gateway = opts.delete(:gateway)
  if gateway
    CASClient::Frameworks::Rails::GatewayFilter
  else
    CASClient::Frameworks::Rails::Filter
  end
end

.logout(controller, service = nil) ⇒ Object



42
43
44
# File 'lib/drc_client.rb', line 42

def self.logout(controller,service=nil)
  CASClient::Frameworks::Rails::Filter.logout(controller,service)
end

.mock_login(username) ⇒ Object



50
51
52
# File 'lib/drc_client.rb', line 50

def self.(username)
  CASClient::Frameworks::Rails::Filter.fake(username)
end