|
|
|
@ -70,14 +70,17 @@ class ApplicationController < ActionController::Base
|
|
|
|
|
# 实训的访问权限
|
|
|
|
|
def shixun_access_allowed
|
|
|
|
|
if !current_user.shixun_permission(@shixun)
|
|
|
|
|
if @shixun.user_scope == 1
|
|
|
|
|
school_id = @shixun.shixun_schools.first&.school_id
|
|
|
|
|
name = School.find_by(id: school_id)&.name
|
|
|
|
|
tip_exception(-5, "当前实训只对#{name}等单位开放")
|
|
|
|
|
else
|
|
|
|
|
tip_exception(403, "..")
|
|
|
|
|
end
|
|
|
|
|
tip_exception(403, "..")
|
|
|
|
|
end
|
|
|
|
|
# if !current_user.shixun_permission(@shixun)
|
|
|
|
|
# if @shixun.user_scope == 1
|
|
|
|
|
# school_id = @shixun.shixun_schools.first&.school_id
|
|
|
|
|
# name = School.find_by(id: school_id)&.name
|
|
|
|
|
# tip_exception(-5, "当前实训只对#{name}等单位开放")
|
|
|
|
|
# else
|
|
|
|
|
# tip_exception(403, "..")
|
|
|
|
|
# end
|
|
|
|
|
# end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def admin_or_business?
|
|
|
|
|