forked from Gitlink/forgeplus
fixed 项目member增加bot访问
This commit is contained in:
parent
5fff8bc23d
commit
17c87f1043
|
@ -93,9 +93,14 @@ module ProjectOperable
|
|||
team_user.destroy! if team_user
|
||||
end
|
||||
|
||||
# 安装bot后的权限
|
||||
def is_install_bot?(user)
|
||||
user.platform == "bot" && BotInstall.joins(:bot).where(bot: { uid: user_id }).where(store_id: self.id).exists?
|
||||
end
|
||||
|
||||
def member?(user_id)
|
||||
if owner.is_a?(User)
|
||||
members.exists?(user_id: user_id) || (user.platform == "bot" && BotInstall.joins(:bot).where(bot: { uid: user_id }).where(store_id: self.id).exists?)
|
||||
members.exists?(user_id: user_id) || is_install_bot?(User.find_by(id: user_id))
|
||||
elsif owner.is_a?(Organization)
|
||||
members.exists?(user_id: user_id) || team_projects.joins(team: :team_users).where(team_users: {user_id: user_id}).present?
|
||||
else
|
||||
|
|
Loading…
Reference in New Issue