summaryrefslogtreecommitdiffstats
path: root/app/models
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2016-08-31 16:52:01 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2016-08-31 16:52:01 +0000
commit09cfa67f676c03078e3a65f4523cc203b4492661 (patch)
tree663588e91fd16d631db53d39310337d88c44ce7e /app/models
parent18537b419b8d0b48becb5564cbc9f59fa33c24ec (diff)
downloadredmine-09cfa67f676c03078e3a65f4523cc203b4492661.tar.gz
redmine-09cfa67f676c03078e3a65f4523cc203b4492661.zip
Merged r15750 (#23655).
git-svn-id: http://svn.redmine.org/redmine/branches/3.2-stable@15766 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models')
-rw-r--r--app/models/project.rb4
1 files changed, 3 insertions, 1 deletions
diff --git a/app/models/project.rb b/app/models/project.rb
index 197f45ec1..ee24056ed 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -197,7 +197,9 @@ class Project < ActiveRecord::Base
if role.allowed_to?(permission)
s = "#{Project.table_name}.is_public = #{connection.quoted_true}"
if user.id
- s = "(#{s} AND #{Project.table_name}.id NOT IN (SELECT project_id FROM #{Member.table_name} WHERE user_id = #{user.id}))"
+ group = role.anonymous? ? Group.anonymous : Group.non_member
+ principal_ids = [user.id, group.id].compact
+ s = "(#{s} AND #{Project.table_name}.id NOT IN (SELECT project_id FROM #{Member.table_name} WHERE user_id IN (#{principal_ids.join(',')})))"
end
statement_by_role[role] = s
end