47 lines
794 B
Ruby
47 lines
794 B
Ruby
# -*- encoding : utf-8 -*-
|
|
|
|
class ApplicationController < ActionController::Base
|
|
protect_from_forgery
|
|
|
|
helper_method :has_permission?
|
|
|
|
|
|
|
|
|
|
def has_permission?(text)
|
|
true
|
|
end
|
|
|
|
|
|
def auth_fuser
|
|
if !current_fuser
|
|
redirect_to new_forum_auth_path
|
|
end
|
|
|
|
|
|
end
|
|
|
|
|
|
private
|
|
|
|
def current_fuser
|
|
|
|
@current_fuser ||= ForumUser.find_by_auth_token!(cookies[:forum_auth_token]) if cookies[:forum_auth_token]
|
|
|
|
|
|
#if session[:forum_user_id] and ForumUser.exists?(session[:forum_user_id])
|
|
# @current_fuser = ForumUser.find(session[:forum_user_id])
|
|
#else
|
|
# nil
|
|
#end
|
|
|
|
end
|
|
|
|
def moderator?
|
|
true if current_admin
|
|
end
|
|
|
|
|
|
helper_method :current_fuser, :moderator?
|
|
end
|