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
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user