Sha256: ccb4433b824fb7923600b4f803c2b6544fcf43072ddb4f058c6c07f3ccdbe5fb

Contents?: true

Size: 772 Bytes

Versions: 22

Compression:

Stored size: 772 Bytes

Contents

class HomeController < ApplicationController
  before_action :require_permission, except: %i[index quick_sign_in]

  def index
  end

  def quick_sign_in
    user = User.find(params[:user_id])
    sign_in(user)
    redirect_to root_path
  end

  def bossy_boots
  end

  def use_in_moderation
  end

  def use_me
  end

  def super_hero
  end

  def require_permission
    return if current_user&.is_super_user?
    return if current_user&.is_admin?           && action_name == "bossy_boots"
    return if current_user&.is_moderator?       && action_name == "use_in_moderation"
    return if current_user&.is_user?            && action_name == "use_me"

    flash.alert = "You do not have permission to access #{action_name.titleize}"

    redirect_to root_path
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
rails_app_generator-0.3.6 after_templates/addons/rolify/app/controllers/home_controller.rb
rails_app_generator-0.3.5 after_templates/addons/rolify/app/controllers/home_controller.rb
rails_app_generator-0.3.4 after_templates/addons/rolify/app/controllers/home_controller.rb
rails_app_generator-0.3.3 after_templates/addons/rolify/app/controllers/home_controller.rb
rails_app_generator-0.3.2 after_templates/addons/rolify/app/controllers/home_controller.rb
rails_app_generator-0.3.1 after_templates/addons/rolify/app/controllers/home_controller.rb
rails_app_generator-0.3.0 after_templates/addons/rolify/app/controllers/home_controller.rb
rails_app_generator-0.2.43 after_templates/addons/rolify/app/controllers/home_controller.rb
rails_app_generator-0.2.42 after_templates/addons/rolify/app/controllers/home_controller.rb
rails_app_generator-0.2.41 after_templates/addons/rolify/app/controllers/home_controller.rb
rails_app_generator-0.2.40 after_templates/addons/rolify/app/controllers/home_controller.rb
rails_app_generator-0.2.39 after_templates/addons/rolify/app/controllers/home_controller.rb
rails_app_generator-0.2.38 after_templates/addons/rolify/app/controllers/home_controller.rb
rails_app_generator-0.2.37 after_templates/addons/rolify/app/controllers/home_controller.rb
rails_app_generator-0.2.36 after_templates/addons/rolify/app/controllers/home_controller.rb
rails_app_generator-0.2.35 after_templates/addons/rolify/app/controllers/home_controller.rb
rails_app_generator-0.2.34 after_templates/addons/rolify/app/controllers/home_controller.rb
rails_app_generator-0.2.33 after_templates/addons/rolify/app/controllers/home_controller.rb
rails_app_generator-0.2.32 after_templates/addons/rolify/app/controllers/home_controller.rb
rails_app_generator-0.2.31 after_templates/addons/rolify/app/controllers/home_controller.rb