another big commit :D

This commit is contained in:
jomo
2013-10-07 04:59:21 +02:00
parent 2761387703
commit 5fac505a31
74 changed files with 1003 additions and 357 deletions

View File

@@ -1,9 +1,19 @@
class ApplicationController < ActionController::Base
protect_from_forgery
# force_ssl
helper :all
include UsersHelper
include ApplicationHelper
helper_method :current_user
helper_method :disabled?
helper_method :banned?
helper_method :confirmed?
helper_method :unconfirmed?
helper_method :default?
helper_method :donor?
helper_method :mod?
helper_method :admin?
helper_method :superadmin?
@@ -14,16 +24,42 @@ class ApplicationController < ActionController::Base
@current_user ||= User.find_by_id(session[:user_id])
end
#roles
def disabled?
!!(current_user && current_user.disabled?)
end
def banned?
!!(current_user && current_user.banned?)
end
def unconfirmed?
!!(current_user && current_user.unconfirmed?)
end
#special one
def confirmed?
!!(current_user && current_user.confirmed?)
end
def default?
!!(current_user && current_user.default?)
end
def donor?
!!(current_user && current_user.donor?)
end
def mod?
!!(current_user && current_user.rank >= rank_to_int("mod"))
!!(current_user && current_user.mod?)
end
def admin?
!!(current_user && current_user.rank >= rank_to_int("admin"))
!!(current_user && current_user.admin?)
end
def superadmin?
!!(current_user && current_user.rank >= rank_to_int("superadmin"))
!!(current_user && current_user.superadmin?)
end
end