Merge pull request #1190 from okriuchykhin/ok_SCI_2478

Fix project_tree for non admin users [SCI-2478]
This commit is contained in:
okriuchykhin 2018-06-01 16:40:05 +02:00 committed by GitHub
commit 04accc8fc8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -342,8 +342,8 @@ class User < ApplicationRecord
result = team.projects.includes(active_experiments: :active_my_modules)
unless is_admin_of_team?(team)
# Only admins see all projects of the team
result = result.includes(:user_projects).where(
'visibility = 1 OR user_projects.user_id=:user_id)', user_id: id
result = result.joins(:user_projects).where(
'visibility=1 OR user_projects.user_id=:user_id', user_id: id
)
end