From f348108674e849f021a9a0b92d01ae611913e2d3 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Wed, 18 Dec 2019 11:03:03 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=9E=E8=AE=AD=E8=AF=BE=E7=A8=8B=E4=B8=AD?= =?UTF-8?q?=E7=9A=84=E5=AE=9E=E8=AE=AD=E8=AE=BF=E9=97=AE=E6=9D=83=E9=99=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/shixun.rb | 2 +- app/views/stages/_stage.json.jbuilder | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/app/models/shixun.rb b/app/models/shixun.rb index 404faff29..de014f87b 100644 --- a/app/models/shixun.rb +++ b/app/models/shixun.rb @@ -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 diff --git a/app/views/stages/_stage.json.jbuilder b/app/views/stages/_stage.json.jbuilder index 75d3a2d6c..a44e61bf3 100644 --- a/app/views/stages/_stage.json.jbuilder +++ b/app/views/stages/_stage.json.jbuilder @@ -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 \ No newline at end of file