Sha256: 6da21630e9eb4c9ca1a328971877364f3491cf1089eea3e982ab7c49231115c6

Contents?: true

Size: 430 Bytes

Versions: 6

Compression:

Stored size: 430 Bytes

Contents

module Tang
  class Admin::ApplicationController < ApplicationController
    before_action :ensure_admin

    layout Tang.admin_layout

    def ensure_admin
      authenticate_user! if self.respond_to?(:authenticate_user!)
      unless current_user.present? && current_user.respond_to?(:admin?) && current_user.admin?
        redirect_to Tang.unauthorized_url, alert: 'You do not have access to that.'
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
tang-0.2.2 app/controllers/tang/admin/application_controller.rb
tang-0.2.1 app/controllers/tang/admin/application_controller.rb
tang-0.2.0 app/controllers/tang/admin/application_controller.rb
tang-0.1.0 app/controllers/tang/admin/application_controller.rb
tang-0.0.9 app/controllers/tang/admin/application_controller.rb
tang-0.0.8 app/controllers/tang/admin/application_controller.rb