Sha256: b60b2ac1949d021610ae3ae2b2850be730ed0dd02bd71f1aef3740be4d6e278f

Contents?: true

Size: 731 Bytes

Versions: 5

Compression:

Stored size: 731 Bytes

Contents

# frozen_string_literal: true

require_relative "../application_controller"

module Admin
  class DashboardController < ::ApplicationController
    before_action :require_logged_admin, only: "index"

    def index
      head :ok
    end

    def log_in_as_user
      user = User.create!(password: "test")
      user_session.record = user
      head :ok
    end

    def log_in_as_admin
      user = User.create!(password: "test")
      admin_session.record = user
      head :ok
    end

    def log_in_with_admin_flag
      user = User.create!(admin: true, password: "test")
      user_session.record = user
      head :ok
    end

    private def authorized?
      current_admin.present? || current_user.admin?
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
simple_auth-3.1.4 test/support/dummy/app/controllers/admin/dashboard_controller.rb
simple_auth-3.1.3 test/support/dummy/app/controllers/admin/dashboard_controller.rb
simple_auth-3.1.2 test/support/dummy/app/controllers/admin/dashboard_controller.rb
simple_auth-3.1.1 test/support/dummy/app/controllers/admin/dashboard_controller.rb
simple_auth-3.1.0 test/support/dummy/app/controllers/admin/dashboard_controller.rb