]> source.dussan.org Git - redmine.git/commitdiff
Make sure we don't build an empty IN () statement (#11662).
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Mon, 27 Aug 2012 10:09:08 +0000 (10:09 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Mon, 27 Aug 2012 10:09:08 +0000 (10:09 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@10241 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/models/project.rb

index e9525ec60571c5d75dd2adaecf2176cc9810fb17..92af86f124ffebc76701caccaf5f63bc221e8857 100644 (file)
@@ -187,7 +187,7 @@ class Project < ActiveRecord::Base
       end
       if user.logged?
         user.projects_by_role.each do |role, projects|
-          if role.allowed_to?(permission)
+          if role.allowed_to?(permission) && projects.any?
             statement_by_role[role] = "#{Project.table_name}.id IN (#{projects.collect(&:id).join(',')})"
           end
         end