bunch of stuffs

This commit is contained in:
jomo
2013-07-28 02:47:10 +02:00
parent c00532aff2
commit 2699751d86
19 changed files with 299 additions and 54 deletions

View File

@@ -4,9 +4,26 @@ class ApplicationController < ActionController::Base
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