mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-12-25 09:13:05 +08:00
Remove visibility condition from projects scope [SCI-6188] (#3667)
Co-authored-by: Anton <anton@scinote.net>
This commit is contained in:
parent
8609b84131
commit
4b79ba209d
1 changed files with 3 additions and 3 deletions
|
@ -62,9 +62,9 @@ class Project < ApplicationRecord
|
|||
|
||||
scope :visible_to, (lambda do |user, team|
|
||||
unless user.is_admin_of_team?(team)
|
||||
left_outer_joins(:user_assignments)
|
||||
.where('visibility = 1 OR user_assignments.user_id = :id', id: user.id)
|
||||
.group(:id)
|
||||
left_outer_joins(user_assignments: :user_role)
|
||||
.where(user_assignments: { user: user })
|
||||
.where('? = ANY(user_roles.permissions)', ProjectPermissions::READ)
|
||||
end
|
||||
end)
|
||||
|
||||
|
|
Loading…
Reference in a new issue