mirror of
https://github.com/redmine/redmine.git
synced 2025-11-02 11:25:55 +01:00
Enable ability for administrators to delete users (#7296).
User's personal data (eg. preferences, tokens, private queries...) are deleted, public data (eg. issues, wiki edits, attachments...) are reassigned to the anonymous user. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4729 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -245,26 +245,36 @@ class ApiTest::UsersTest < ActionController::IntegrationTest
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context "DELETE /users/2" do
|
||||
context ".xml" do
|
||||
should "not be allowed" do
|
||||
assert_no_difference('User.count') do
|
||||
delete '/users/2.xml'
|
||||
end
|
||||
|
||||
assert_response :method_not_allowed
|
||||
end
|
||||
end
|
||||
context "DELETE /users/2" do
|
||||
context ".xml" do
|
||||
should_allow_api_authentication(:delete,
|
||||
'/users/2.xml',
|
||||
{},
|
||||
{:success_code => :ok})
|
||||
|
||||
context ".json" do
|
||||
should "not be allowed" do
|
||||
assert_no_difference('User.count') do
|
||||
delete '/users/2.json'
|
||||
end
|
||||
|
||||
assert_response :method_not_allowed
|
||||
should "delete user" do
|
||||
assert_difference('User.count', -1) do
|
||||
delete '/users/2.xml', {}, :authorization => credentials('admin')
|
||||
end
|
||||
|
||||
assert_response :ok
|
||||
end
|
||||
end
|
||||
|
||||
context ".json" do
|
||||
should_allow_api_authentication(:delete,
|
||||
'/users/2.xml',
|
||||
{},
|
||||
{:success_code => :ok})
|
||||
|
||||
should "delete user" do
|
||||
assert_difference('User.count', -1) do
|
||||
delete '/users/2.json', {}, :authorization => credentials('admin')
|
||||
end
|
||||
|
||||
assert_response :ok
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user