Sha256: f7c1a978b7ec77b297a72a3f1c04046b957f1421a23d860c657ec83c165c8e85

Contents?: true

Size: 538 Bytes

Versions: 5

Compression:

Stored size: 538 Bytes

Contents

class ApplicationController < ActionController::Base
  before_action :authenticate_user!
  include Authz::Controllers::AuthorizationManager
  rescue_from Authz::Controllers::AuthorizationManager::NotAuthorized, with: :unauthorized_handler


  private
  def unauthorized_handler
    msg = 'Ooops! It seems that you are not authorized to do that!'
    respond_to do |format|
      format.html { redirect_back fallback_location: main_app.root_url, flash: { error: msg } }
      format.js{ render(js: "alert('#{msg}');") }
    end
  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
authz-0.0.5 spec/dummy/app/controllers/application_controller.rb
authz-0.0.4 spec/dummy/app/controllers/application_controller.rb
authz-0.0.3 spec/dummy/app/controllers/application_controller.rb
authz-0.0.2 spec/dummy/app/controllers/application_controller.rb
authz-0.0.1 spec/dummy/app/controllers/application_controller.rb