You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
520 B
24 lines
520 B
5 years ago
|
class Admins::BaseController < ApplicationController
|
||
|
include Admins::PaginateHelper
|
||
|
include Admins::RenderHelper
|
||
|
include Admins::ErrorRescueHandler
|
||
|
|
||
|
layout 'admin'
|
||
|
|
||
|
before_action :require_login, :require_admin!
|
||
|
|
||
|
private
|
||
|
|
||
|
def require_login
|
||
|
return if User.current.logged?
|
||
|
|
||
|
redirect_to "/login?back_url=#{CGI::escape(request.fullpath)}"
|
||
|
end
|
||
|
|
||
|
def require_admin!
|
||
|
return if current_user.blank? || !current_user.logged?
|
||
|
return if current_user.admin_or_business?
|
||
|
|
||
|
render_forbidden
|
||
|
end
|
||
|
end
|