Sha256: 42eaf21c4c5f73f6aeb75943a262b63e38431867a4c7f3fc45505045e9401fed

Contents?: true

Size: 838 Bytes

Versions: 18

Compression:

Stored size: 838 Bytes

Contents

module Sunrise
  class ApplicationController < ::ApplicationController
    prepend_before_filter :authenticate_user!
    check_authorization
    
    respond_to :html
    
    protected
          
      def current_ability
        @current_ability ||= ::Ability.new(current_user, :sunrise)
      end
      
      rescue_from ::CanCan::AccessDenied do |exception|
        Rails.logger.debug "Access denied on #{exception.action} #{exception.subject.inspect}, context: #{current_ability.context}, user: #{current_user.try(:id)}"
        
        flash[:failure] = I18n.t(:access_denied, :scope => [:flash, :users])
              
        respond_to do |format|
          format.html { redirect_to(user_signed_in? ? main_app.root_path : new_session_path(:user)) }
          format.any  { head :unauthorized }
        end
      end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
sunrise-cms-0.5.3 app/controllers/sunrise/application_controller.rb
sunrise-cms-0.5.2 app/controllers/sunrise/application_controller.rb
sunrise-cms-0.5.1 app/controllers/sunrise/application_controller.rb
sunrise-cms-0.5.0 app/controllers/sunrise/application_controller.rb
sunrise-cms-0.5.0.rc5 app/controllers/sunrise/application_controller.rb
sunrise-cms-0.5.0.rc4 app/controllers/sunrise/application_controller.rb
sunrise-cms-0.5.0.rc3 app/controllers/sunrise/application_controller.rb
sunrise-cms-0.5.0.rc2 app/controllers/sunrise/application_controller.rb
sunrise-cms-0.5.0.rc1 app/controllers/sunrise/application_controller.rb
sunrise-cms-0.4.2 app/controllers/sunrise/application_controller.rb
sunrise-cms-0.4.1 app/controllers/sunrise/application_controller.rb
sunrise-cms-0.4.0 app/controllers/sunrise/application_controller.rb
sunrise-cms-0.3.3 app/controllers/sunrise/application_controller.rb
sunrise-cms-0.3.2 app/controllers/sunrise/application_controller.rb
sunrise-cms-0.3.1 app/controllers/sunrise/application_controller.rb
sunrise-cms-0.3.0 app/controllers/sunrise/application_controller.rb
sunrise-cms-0.3.0.rc2 app/controllers/sunrise/application_controller.rb
sunrise-cms-0.3.0.rc app/controllers/sunrise/application_controller.rb