From 2e5d11f9bddab7f36418510398c6f719cb1cfd17 Mon Sep 17 00:00:00 2001 From: bohung Date: Tue, 15 Nov 2022 16:42:26 +0800 Subject: [PATCH] Fix bug. --- app/controllers/site_menu_widgets_controller.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/controllers/site_menu_widgets_controller.rb b/app/controllers/site_menu_widgets_controller.rb index 32d8518..56bcbf2 100644 --- a/app/controllers/site_menu_widgets_controller.rb +++ b/app/controllers/site_menu_widgets_controller.rb @@ -5,7 +5,7 @@ class SiteMenuWidgetsController < ApplicationController item = {} item["obj"] = page is_ip = (page.access_level == 'ip') - next if !page.user_can_access?(current_user) && !is_ip + next if !page.user_can_access?(@current_user) if page.child_page.size > 0 item["page_name"] = page.name item['dropdown'] = 'dropdown-menu' @@ -37,6 +37,7 @@ class SiteMenuWidgetsController < ApplicationController item = {} item["obj"] = page next if !page.user_can_access?(current_user) + next if page.access_level == 'ip' && !@need_process_ip if page.child_page.size > 0 item["page_name"] = page.name item['dropdown'] = 'dropdown-menu' @@ -92,8 +93,9 @@ class SiteMenuWidgetsController < ApplicationController @need_process_ip = (@site.need_process_ip rescue false) @has_privileged_page = (@site.has_privileged_page rescue false) @process_ip_later = false + @current_user = OrbitHelper.current_user if @need_process_ip - @process_ip_later = OrbitHelper.current_user.nil? && @site.enable_cache unless @no_cache_for_this_request + @process_ip_later = @current_user.nil? && @site.enable_cache unless @no_cache_for_this_request unless @process_ip_later @need_process_ip = @site.check_ip_is_privileged?((OrbitHelper.request.remote_ip rescue "")) end