mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-09-24 05:55:53 +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|
|
scope :visible_to, (lambda do |user, team|
|
||||||
unless user.is_admin_of_team?(team)
|
unless user.is_admin_of_team?(team)
|
||||||
left_outer_joins(:user_assignments)
|
left_outer_joins(user_assignments: :user_role)
|
||||||
.where('visibility = 1 OR user_assignments.user_id = :id', id: user.id)
|
.where(user_assignments: { user: user })
|
||||||
.group(:id)
|
.where('? = ANY(user_roles.permissions)', ProjectPermissions::READ)
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue