diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index cffe2df15..23b3f02f8 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -258,6 +258,8 @@ class ApplicationController < ActionController::Base end def user_setup + # reacct静态资源加载不需要走这一步 + return if params[:controller] == "main" # Find the current user User.current = find_current_user uid_logger("user_step: " + (User.current.logged? ? "#{User.current.try(:login)} (id=#{User.current.try(:id)})" : "anonymous")) diff --git a/app/controllers/shixuns_controller.rb b/app/controllers/shixuns_controller.rb index 00ae559b1..32a314c54 100644 --- a/app/controllers/shixuns_controller.rb +++ b/app/controllers/shixuns_controller.rb @@ -1,5 +1,5 @@ class ShixunsController < ApplicationController - before_action :require_login, except: [:download_file, :index] + before_action :require_login, except: [:download_file, :index, :menus] # before_action :check_auth, except: [:download_file, :index] before_action :find_shixun, except: [:index, :new, :create, :menus, :get_recommend_shixuns, :propaedeutics, diff --git a/app/models/user.rb b/app/models/user.rb index 60765b852..ece69dc02 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -388,10 +388,10 @@ class User < ApplicationRecord # 用户是否有权限查看实训 def shixun_permission(shixun) # 性能优化:先处理不需要权限的实训(已发布并且没有单位权限限制的实训) - return true if manager_of_shixun?(shixun) # 实训管理员 return false if shixun.status != 2 || shixun.hidden # 隐藏或者未发布的实训:false return true if shixun.use_scope == 0 # 对所有学校公开 - return true if shixun.use_scope == 1 && shixun.shixun_schools.exists?(school_id: school_id) # 对部分高校公开 + return true if shixun.use_scope == 1 && (manager_of_shixun?(shixun) || shixun.shixun_schools.exists?(school_id: school_id)) # 对部分高校公开 + # return true if manager_of_shixun?(shixun) # 实训管理员 return false end