summaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2007-05-29 19:48:50 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2007-05-29 19:48:50 +0000
commit97f6315bd0c321ebaa2e8ec9d26344405f5e0e39 (patch)
tree3ce097875f92e0712d3c3d2aa30a3f98d235e73a /app
parente7ff47cff565f9eaa08a95196ef834081105045f (diff)
downloadredmine-97f6315bd0c321ebaa2e8ec9d26344405f5e0e39.tar.gz
redmine-97f6315bd0c321ebaa2e8ec9d26344405f5e0e39.zip
Fixed: SQL error when a non-admin user displays the project list
git-svn-id: http://redmine.rubyforge.org/svn/trunk@555 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app')
-rw-r--r--app/models/project.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/app/models/project.rb b/app/models/project.rb
index bf83c1389..d1504ab80 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -77,7 +77,7 @@ class Project < ActiveRecord::Base
def self.visible_by(user=nil)
if user && user.admin?
return ["#{Project.table_name}.status=#{Project::STATUS_ACTIVE}"]
- elsif user && !user.memberships.empty?
+ elsif user && !user.memberships.any?
return ["#{Project.table_name}.status=#{Project::STATUS_ACTIVE} AND (#{Project.table_name}.is_public = ? or #{Project.table_name}.id IN (#{user.memberships.collect{|m| m.project_id}.join(',')}))", true]
else
return ["#{Project.table_name}.status=#{Project::STATUS_ACTIVE} AND #{Project.table_name}.is_public = ?", true]