Adds buit-in groups to give specific permissions to anonymous and non members users per project (#17976).

git-svn-id: http://svn.redmine.org/redmine/trunk@13417 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang
2014-09-28 14:51:08 +00:00
parent 9a7fb0ad7b
commit 7e7ac5340a
33 changed files with 430 additions and 69 deletions

View File

@@ -29,12 +29,13 @@ class Redmine::ApiTest::GroupsTest < Redmine::ApiTest::Base
assert_response 401
end
test "GET /groups.xml should return groups" do
test "GET /groups.xml should return givable groups" do
get '/groups.xml', {}, credentials('admin')
assert_response :success
assert_equal 'application/xml', response.content_type
assert_select 'groups' do
assert_select 'group', Group.givable.count
assert_select 'group' do
assert_select 'name', :text => 'A Team'
assert_select 'id', :text => '10'
@@ -42,6 +43,24 @@ class Redmine::ApiTest::GroupsTest < Redmine::ApiTest::Base
end
end
test "GET /groups.xml?builtin=1 should return all groups" do
get '/groups.xml?builtin=1', {}, credentials('admin')
assert_response :success
assert_equal 'application/xml', response.content_type
assert_select 'groups' do
assert_select 'group', Group.givable.count + 2
assert_select 'group' do
assert_select 'builtin', :text => 'non_member'
assert_select 'id', :text => '12'
end
assert_select 'group' do
assert_select 'builtin', :text => 'anonymous'
assert_select 'id', :text => '13'
end
end
end
test "GET /groups.json should require authentication" do
get '/groups.json'
assert_response 401
@@ -60,7 +79,7 @@ class Redmine::ApiTest::GroupsTest < Redmine::ApiTest::Base
assert_equal({'id' => 10, 'name' => 'A Team'}, group)
end
test "GET /groups/:id.xml should return the group with its users" do
test "GET /groups/:id.xml should return the group" do
get '/groups/10.xml', {}, credentials('admin')
assert_response :success
assert_equal 'application/xml', response.content_type
@@ -71,6 +90,17 @@ class Redmine::ApiTest::GroupsTest < Redmine::ApiTest::Base
end
end
test "GET /groups/:id.xml should return the builtin group" do
get '/groups/12.xml', {}, credentials('admin')
assert_response :success
assert_equal 'application/xml', response.content_type
assert_select 'group' do
assert_select 'builtin', :text => 'non_member'
assert_select 'id', :text => '12'
end
end
test "GET /groups/:id.xml should include users if requested" do
get '/groups/10.xml?include=users', {}, credentials('admin')
assert_response :success