summaryrefslogtreecommitdiffstats
path: root/app/models/project.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2009-12-24 16:18:15 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2009-12-24 16:18:15 +0000
commit62c83bdd2e1b06fcd873ba6d638c0bf59e390958 (patch)
treecfff2b493b317d0b870ce1499725e008f1b85ff1 /app/models/project.rb
parent24fde6f1096074cc596a3fbab0165f682a554e82 (diff)
downloadredmine-62c83bdd2e1b06fcd873ba6d638c0bf59e390958.tar.gz
redmine-62c83bdd2e1b06fcd873ba6d638c0bf59e390958.zip
Adds a 'Add subprojects' permission.
* 'Add project' permission will let user create a root project * 'Add subprojects' permission will let project members create subprojects git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3238 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/project.rb')
-rw-r--r--app/models/project.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/app/models/project.rb b/app/models/project.rb
index d6526100f..3f34393b3 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -246,7 +246,11 @@ class Project < ActiveRecord::Base
# by the current user
def allowed_parents
return @allowed_parents if @allowed_parents
- @allowed_parents = (Project.find(:all, :conditions => Project.allowed_to_condition(User.current, :add_project, :member => true)) - self_and_descendants)
+ @allowed_parents = Project.find(:all, :conditions => Project.allowed_to_condition(User.current, :add_subprojects))
+ @allowed_parents = @allowed_parents - self_and_descendants
+ if User.current.allowed_to?(:add_project, nil, :global => true)
+ @allowed_parents << nil
+ end
unless parent.nil? || @allowed_parents.empty? || @allowed_parents.include?(parent)
@allowed_parents << parent
end