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.



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

def registered(app)
  app.register Padrino::Admin unless app.extensions.include?(Padrino::Admin)
  app.set :session_id, "_padrino_#{Padrino.env}_#{app.app_name}" 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
    class << self
      attr_accessor :access_control
    end
    def access_control
      self.class.access_control
    end
  end

  app.send(:access_control=, Padrino::Admin::AccessControl::Base.new)
end