diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2016-08-30 19:24:03 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2016-08-30 19:24:03 +0000 |
commit | d5ca4a3593de4f997c3caa10ed3cd74f95307571 (patch) | |
tree | 831ddded4e67987a0b6ecb042956bcc63baba249 /app/models/project.rb | |
parent | 650a64cb0020ac849eaefb20abbbb090abcb6b3d (diff) | |
download | redmine-d5ca4a3593de4f997c3caa10ed3cd74f95307571.tar.gz redmine-d5ca4a3593de4f997c3caa10ed3cd74f95307571.zip |
Fixed that restricted custom permissions on for non member/anonymous does not work (#23655).
git-svn-id: http://svn.redmine.org/redmine/trunk@15750 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/project.rb')
-rw-r--r-- | app/models/project.rb | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/app/models/project.rb b/app/models/project.rb index d5c826523..b6ca8a095 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 |