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, System, View

Class Method Summary collapse

Class Method Details

.included(mod) ⇒ Object



12
13
14
15
# File 'lib/lockdown/frameworks/rails.rb', line 12

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

.mixinObject



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/lockdown/frameworks/rails.rb', line 17

def mixin
  Lockdown.controller_parent.class_eval do
    include Lockdown::Session
    include Lockdown::Frameworks::Rails::Controller::Lock
  end

  Lockdown.controller_parent.helper_method :authorized?

  Lockdown.controller_parent.before_filter do |c|
    c.set_current_user
    c.configure_lockdown
    c.check_request_authorization
  end

  Lockdown.controller_parent.filter_parameter_logging :password, 
    :password_confirmation
      
  Lockdown.controller_parent.rescue_from SecurityError, 
    :with => proc{|e| access_denied(e)}

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

  Lockdown::System.class_eval do 
    extend Lockdown::Frameworks::Rails::System
  end
end

.use_me?Boolean

Returns:

  • (Boolean)


8
9
10
# File 'lib/lockdown/frameworks/rails.rb', line 8

def use_me?
  Object.const_defined?("ActionController") && ActionController.const_defined?("Base")
end