Allow non admin users to add subprojects (#2963).
Subprojects can be added to the projects for which the user has add_project permission. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3059 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -26,6 +26,7 @@ class ProjectTest < ActiveSupport::TestCase
|
||||
def setup
|
||||
@ecookbook = Project.find(1)
|
||||
@ecookbook_sub1 = Project.find(3)
|
||||
User.current = nil
|
||||
end
|
||||
|
||||
should_validate_presence_of :name
|
||||
@@ -236,6 +237,14 @@ class ProjectTest < ActiveSupport::TestCase
|
||||
assert_equal [5, 6, 3, 4], d.collect(&:id)
|
||||
end
|
||||
|
||||
def test_allowed_parents_should_be_empty_for_non_member_user
|
||||
Role.non_member.add_permission!(:add_project)
|
||||
user = User.find(9)
|
||||
assert user.memberships.empty?
|
||||
User.current = user
|
||||
assert Project.new.allowed_parents.empty?
|
||||
end
|
||||
|
||||
def test_users_by_role
|
||||
users_by_role = Project.find(1).users_by_role
|
||||
assert_kind_of Hash, users_by_role
|
||||
|
||||
Reference in New Issue
Block a user