summaryrefslogtreecommitdiffstats
path: root/app/models
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2016-08-31 16:51:20 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2016-08-31 16:51:20 +0000
commitd20f2a7def5c7e0ff51e2572ded520e493b698a7 (patch)
tree9c60bbb82f2097b3cf2e3200c0ebf330ccfd6ba2 /app/models
parent30223b3043e094fba9c12c0658b3c305abba309f (diff)
downloadredmine-d20f2a7def5c7e0ff51e2572ded520e493b698a7.tar.gz
redmine-d20f2a7def5c7e0ff51e2572ded520e493b698a7.zip
Merged r15750 (#23655).
git-svn-id: http://svn.redmine.org/redmine/branches/3.3-stable@15765 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 c48c54855..51531a5d9 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