summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2008-12-20 14:48:59 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2008-12-20 14:48:59 +0000
commit7353a628bf4f831d413586e5bd864712a03c84d9 (patch)
tree0d4b8b6d53ca5c115d12fdfd1f63b84655a2a401
parent76462d76b59df6f21a465f2aa04e6126493011d3 (diff)
downloadredmine-7353a628bf4f831d413586e5bd864712a03c84d9.tar.gz
redmine-7353a628bf4f831d413586e5bd864712a03c84d9.zip
Makes Project.allowed_to_condition actually works with nested sets.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/work@2153 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r--nested_projects/app/models/project.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/nested_projects/app/models/project.rb b/nested_projects/app/models/project.rb
index c4ea19d96..ab2a5f982 100644
--- a/nested_projects/app/models/project.rb
+++ b/nested_projects/app/models/project.rb
@@ -119,7 +119,7 @@ class Project < ActiveRecord::Base
end
if options[:project]
project_statement = "#{Project.table_name}.id = #{options[:project].id}"
- project_statement << " OR #{Project.table_name}.parent_id = #{options[:project].id}" if options[:with_subprojects]
+ project_statement << " OR (#{Project.table_name}.lft > #{options[:project].lft} AND #{Project.table_name}.rgt < #{options[:project].rgt})" if options[:with_subprojects]
base_statement = "(#{project_statement}) AND (#{base_statement})"
end
if user.admin?