Module: Sentinel::Controller

Defined in:
lib/sentinel/controller.rb

Defined Under Namespace

Modules: ClassMethods, InstanceMethods

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/sentinel/controller.rb', line 4

def self.included(base)
  base.send :include, InstanceMethods
  base.extend ClassMethods
  
  base.class_eval do
    helper_method :sentinel
  end
  
  base.class_inheritable_accessor :sentinel, :access_denied, :access_granted
  
  base.on_denied_with do
    respond_to do |format|
      format.html { render :text => "You do not have the proper privileges to access this page.", :status => :unauthorized }
      format.any  { head :unauthorized }
    end
  end
  
  base.with_access do
    true
  end
end