Module: Padrino::Admin::AccessControl

Defined in:
padrino-admin/lib/padrino-admin/access_control.rb

Overview

This module enables access control functionality within a Padrino application.

Defined Under Namespace

Classes: Authorization, Base, ProjectModule

Class Method Summary collapse

Class Method Details

.registered(app) ⇒ Object Also known as: included

Method used by Padrino::Application when we register the extension.



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'padrino-admin/lib/padrino-admin/access_control.rb', line 15

def registered(app)
  app.register Padrino::Admin unless app.extensions.include?(Padrino::Admin)
  app.set :session_id, "_padrino_#{File.basename(Padrino.root)}_#{app.app_name}".to_sym unless app.respond_to?(:session_id)
  app.set :admin_model, 'Account' unless app.respond_to?(:admin_model)
  app.helpers Padrino::Admin::Helpers::AuthenticationHelpers
  app.helpers Padrino::Admin::Helpers::ViewHelpers
  app.before {  }
  app.class_eval do
    def access_control
      @@access_control
    end
    def self.access_control
      @@access_control
    end
    def self.access_control=(control)
      @@access_control = control
    end
  end
  app.send(:access_control=, Padrino::Admin::AccessControl::Base.new)
end