Sha256: 71c6062dfeb02be9627fccae9a7aff837adefa7edb2a707f51c42ca25da6f46b
Contents?: true
Size: 768 Bytes
Versions: 4
Compression:
Stored size: 768 Bytes
Contents
module Spina module Admin class AdminController < ActionController::Base include Spina::CurrentMethods helper Spina::Engine.helpers before_action :set_admin_locale before_action :authorize_spina_user def current_admin_path request.fullpath[%r{/#{ Spina.config.backend_path }(.*)}, 1] end helper_method :current_admin_path private def set_admin_locale I18n.locale = I18n.default_locale end def authorize_spina_user redirect_to admin_login_path, flash: {information: I18n.t('spina.notifications.login')} unless current_spina_user end def authorize_admin render status: 401 unless current_spina_user.admin? end end end end
Version data entries
4 entries across 4 versions & 1 rubygems