Module: Lockdown::Frameworks::Rails

Defined in:
lib/lockdown/frameworks/rails.rb,
lib/lockdown/frameworks/rails/view.rb,
lib/lockdown/frameworks/rails/controller.rb

Defined Under Namespace

Modules: Controller, Environment, View

Class Method Summary collapse

Class Method Details

.included(mod) ⇒ Object



10
11
12
13
# File 'lib/lockdown/frameworks/rails.rb', line 10

def included(mod)
  mod.extend Lockdown::Frameworks::Rails::Environment
  mixin
end

.mixinObject



15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/lockdown/frameworks/rails.rb', line 15

def mixin
  mixin_controller

  Lockdown.view_helper.class_eval do
    include Lockdown::Frameworks::Rails::View
  end

  Lockdown::Configuration.class_eval do 
    def self.skip_sync?
      skip_db_sync_in.include?(::Rails.env)
    end
  end
end

.mixin_controller(klass = Lockdown.controller_parent) ⇒ Object



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/lockdown/frameworks/rails.rb', line 29

def mixin_controller(klass = Lockdown.controller_parent)
  klass.class_eval do
    include Lockdown::Session
    include Lockdown::Frameworks::Rails::Controller::Lock
  end

  klass.helper_method :authorized?

  klass.hide_action(:set_current_user, :configure_lockdown, :check_request_authorization)

  klass.before_filter do |c|
    c.set_current_user
    c.configure_lockdown
    c.check_request_authorization
  end

  klass.filter_parameter_logging :password, :password_confirmation
      
  klass.rescue_from SecurityError, :with => proc{|e| ld_access_denied(e)}
end