From be6aa8c70ed7381dedeeccfe591bceed8fb8e0d8 Mon Sep 17 00:00:00 2001 From: sk821 Date: Thu, 27 Sep 2018 13:20:00 +0800 Subject: [PATCH] fix manager can view --- app/controllers/recruitments_controller.rb | 24 ++++++++++++++-------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/app/controllers/recruitments_controller.rb b/app/controllers/recruitments_controller.rb index 761aeaa..dac9679 100644 --- a/app/controllers/recruitments_controller.rb +++ b/app/controllers/recruitments_controller.rb @@ -141,17 +141,23 @@ class RecruitmentsController < PseudoSessionController def check_session page = Page.where(:module => "pseudo_member").first - session = OrbitHelper.request.session - available = session[:current_pseudo_user_id].present? && !session[:current_pseudo_user_id].nil? ? true : false - if !OrbitHelper.current_user.nil? - available = OrbitHelper.current_user.is_admin? - end - if available || available == "true" - pu = PseudoUser.find(session[:current_pseudo_user_id]) - enabled = RecruitProfile.where(:pseudo_member_id => pu.user_name).first.enabled + if OrbitHelper.current_user.is_admin? + available = true + enabled = true + else + available = false + enabled = false + end else - enabled = false + session = OrbitHelper.request.session + available = session[:current_pseudo_user_id].present? && !session[:current_pseudo_user_id].nil? ? true : false + if available || available == "true" + pu = PseudoUser.find(session[:current_pseudo_user_id]) + enabled = RecruitProfile.where(:pseudo_member_id => pu.user_name).first.enabled + else + enabled = false + end end { "session" => available,