实训课程中的实训访问权限

chromesetting
cxt 5 years ago
parent fc89a45835
commit f348108674

@ -285,7 +285,7 @@ class Shixun < ApplicationRecord
end
def has_manager?(user)
return true if user.admin?
return true if user.admin? || user.business?
shixun_members.where(role: [1, 2]).exists?(user_id: user.id)
end

@ -18,5 +18,6 @@ json.shixuns_list do
json.challenges_count shixun.challenges_count
json.complete_status stage_myshixun_status(myshixuns.select{|ms| ms.shixun_id == shixun.id}.first)
json.shixun_status stage_shixun_status(subject.status, shixun.status, shixun.hidden)
json.allow_visit shixun.has_manager?(User.current)
end
end
Loading…
Cancel
Save