This commit is contained in:
BoHung Chiu 2022-11-15 16:42:26 +08:00
parent 5b54171b32
commit 2e5d11f9bd
1 changed files with 4 additions and 2 deletions

View File

@ -5,7 +5,7 @@ class SiteMenuWidgetsController < ApplicationController
item = {} item = {}
item["obj"] = page item["obj"] = page
is_ip = (page.access_level == 'ip') 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 if page.child_page.size > 0
item["page_name"] = page.name item["page_name"] = page.name
item['dropdown'] = 'dropdown-menu' item['dropdown'] = 'dropdown-menu'
@ -37,6 +37,7 @@ class SiteMenuWidgetsController < ApplicationController
item = {} item = {}
item["obj"] = page item["obj"] = page
next if !page.user_can_access?(current_user) next if !page.user_can_access?(current_user)
next if page.access_level == 'ip' && !@need_process_ip
if page.child_page.size > 0 if page.child_page.size > 0
item["page_name"] = page.name item["page_name"] = page.name
item['dropdown'] = 'dropdown-menu' item['dropdown'] = 'dropdown-menu'
@ -92,8 +93,9 @@ class SiteMenuWidgetsController < ApplicationController
@need_process_ip = (@site.need_process_ip rescue false) @need_process_ip = (@site.need_process_ip rescue false)
@has_privileged_page = (@site.has_privileged_page rescue false) @has_privileged_page = (@site.has_privileged_page rescue false)
@process_ip_later = false @process_ip_later = false
@current_user = OrbitHelper.current_user
if @need_process_ip 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 unless @process_ip_later
@need_process_ip = @site.check_ip_is_privileged?((OrbitHelper.request.remote_ip rescue "")) @need_process_ip = @site.check_ip_is_privileged?((OrbitHelper.request.remote_ip rescue ""))
end end