This repository has been archived on 2024-08-27. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
redstoner.com/app/controllers/application_controller.rb
2013-07-28 02:47:10 +02:00

29 lines
593 B
Ruby

class ApplicationController < ActionController::Base
protect_from_forgery
# force_ssl
helper :all
include UsersHelper
helper_method :current_user
helper_method :mod?
helper_method :admin?
helper_method :superadmin?
private
def current_user
@current_user ||= User.find_by_id(session[:user_id])
end
def mod?
!!(current_user && current_user.rank >= rank_to_int("mod"))
end
def admin?
!!(current_user && current_user.rank >= rank_to_int("admin"))
end
def superadmin?
!!(current_user && current_user.rank >= rank_to_int("superadmin"))
end
end