Sha256: fd86d7b0d8dc5fa85bb90715fff976f50b26549ec7b7114b8b783a4d0dfd2792

Contents?: true

Size: 994 Bytes

Versions: 3

Compression:

Stored size: 994 Bytes

Contents

# Filters added to this controller apply to all controllers in the application.
# Likewise, all the methods added will be available for all controllers.

class Adminsite::AdminApplicationController < ActionController::Base
  helper :all, "admin/adminsite_application"
  layout 'adminsite/admin'

  before_filter :authenticate_adminsite_admin_user!

  include ::CanCan::ControllerAdditions
  authorize_resource class: lambda { |context| context.authorize_resource_class }
  # check_authorization

  rescue_from CanCan::AccessDenied do |exception|
    render text: exception.message
  end

  def authorize!(action, subject, *args)
    subject = subject.call(self) if subject.is_a?(Proc)
    puts "#{self}#authorize!(#{action}, #{subject}, #{args.inspect})" if Rails.env.development?
    super(action, subject, *args)
  end

  def authorize_resource_class
    self
  end

  protected

  def current_ability
    @current_ability ||= ::Adminsite::Ability.new(current_adminsite_admin_user)
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
adminsite-3.1.2 app/controllers/adminsite/admin_application_controller.rb
adminsite-3.1.1 app/controllers/adminsite/admin_application_controller.rb
adminsite-3.1.0 app/controllers/adminsite/admin_application_controller.rb