From c56f0ca7fc6d59a65aeadac0ae24e9a5defcf00b Mon Sep 17 00:00:00 2001 From: jasder Date: Thu, 29 Apr 2021 23:17:55 +0800 Subject: [PATCH] =?UTF-8?q?FIX=20=E8=A7=A3=E5=86=B3=E5=90=88=E5=B9=B6?= =?UTF-8?q?=E8=AF=B7=E6=B1=82=E7=9A=84=E6=9D=83=E9=99=90=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/organization.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/models/organization.rb b/app/models/organization.rb index fbf3def79..b4ebc59a2 100644 --- a/app/models/organization.rb +++ b/app/models/organization.rb @@ -108,6 +108,10 @@ class Organization < Owner team_users.joins(:team).where(user_id: user_id, teams: {authorize: %w(read write admin owner)}).present? end + def is_only_read?(user_id) + team_users.joins(:team).where(user_id: user_id, teams: {authorize: %w(read)}).present? + end + # 是不是所有者团队的最后一个成员 def is_owner_team_last_one?(user_id) owner_team_users = team_users.joins(:team).where(teams: {authorize: %w(owner)})