client_management/app/controllers/c_panel_controller.rb

22 lines
522 B
Ruby
Raw Normal View History

2017-03-07 09:37:28 +00:00
class CPanelController < ApplicationController
layout "cpanel"
helper_method :current_cpanel_user
def is_user_authorized?
redirect_to :cpanel_login if current_cpanel_user.nil?
end
def create_cpanel_session(user=nil)
if !user.nil? and current_cpanel_user.nil?
session[:cpanel_user_id] = user.id
end
end
def destroy_cpanel_session
session.delete(:cpanel_user_id)
end
def current_cpanel_user
@current_cpanel_user = CPanelUser.find(session[:cpanel_user_id]) rescue nil
end
end