Sha256: 3a3b98652134a4bb92e6e0f55a77fad8d58c1c3b1caa1e9f20dc80c311752f36

Contents?: true

Size: 885 Bytes

Versions: 24

Compression:

Stored size: 885 Bytes

Contents

module Sunrise
  class ApplicationController < ::ApplicationController
    include ::PublicActivity::StoreController

    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

24 entries across 24 versions & 1 rubygems

Version Path
sunrise-cms-1.0.6 app/controllers/sunrise/application_controller.rb
sunrise-cms-1.0.5 app/controllers/sunrise/application_controller.rb
sunrise-cms-1.0.4 app/controllers/sunrise/application_controller.rb
sunrise-cms-1.0.3 app/controllers/sunrise/application_controller.rb
sunrise-cms-1.0.2 app/controllers/sunrise/application_controller.rb
sunrise-cms-1.0.1 app/controllers/sunrise/application_controller.rb
sunrise-cms-1.0.0 app/controllers/sunrise/application_controller.rb
sunrise-cms-1.0.0.rc3 app/controllers/sunrise/application_controller.rb
sunrise-cms-1.0.0.rc2 app/controllers/sunrise/application_controller.rb
sunrise-cms-1.0.0.rc1 app/controllers/sunrise/application_controller.rb
sunrise-cms-0.7.0.rc2 app/controllers/sunrise/application_controller.rb
sunrise-cms-0.7.0.rc1 app/controllers/sunrise/application_controller.rb
sunrise-cms-0.6.11 app/controllers/sunrise/application_controller.rb
sunrise-cms-0.6.10 app/controllers/sunrise/application_controller.rb
sunrise-cms-0.6.9 app/controllers/sunrise/application_controller.rb
sunrise-cms-0.6.8 app/controllers/sunrise/application_controller.rb
sunrise-cms-0.6.7 app/controllers/sunrise/application_controller.rb
sunrise-cms-0.6.6 app/controllers/sunrise/application_controller.rb
sunrise-cms-0.6.5 app/controllers/sunrise/application_controller.rb
sunrise-cms-0.6.4 app/controllers/sunrise/application_controller.rb