summaryrefslogtreecommitdiffstats
path: root/app/controllers
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2011-01-16 15:23:11 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2011-01-16 15:23:11 +0000
commite9f62d1209bfa81df33bcb390eb67ba4cab90c0a (patch)
tree40dff8ceb02a30dce788799904d4a8c145d0d6e2 /app/controllers
parent0e3017dc62c672a291cda6053aaba6bda39b2de4 (diff)
downloadredmine-e9f62d1209bfa81df33bcb390eb67ba4cab90c0a.tar.gz
redmine-e9f62d1209bfa81df33bcb390eb67ba4cab90c0a.zip
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
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/users_controller.rb13
1 files changed, 11 insertions, 2 deletions
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb
index 2a213f5e8..c7f9dcf1b 100644
--- a/app/controllers/users_controller.rb
+++ b/app/controllers/users_controller.rb
@@ -19,8 +19,8 @@ class UsersController < ApplicationController
layout 'admin'
before_filter :require_admin, :except => :show
- before_filter :find_user, :only => [:show, :edit, :update, :edit_membership, :destroy_membership]
- accept_key_auth :index, :show, :create, :update
+ before_filter :find_user, :only => [:show, :edit, :update, :destroy, :edit_membership, :destroy_membership]
+ accept_key_auth :index, :show, :create, :update, :destroy
helper :sort
include SortHelper
@@ -177,6 +177,15 @@ class UsersController < ApplicationController
redirect_to :controller => 'users', :action => 'edit', :id => @user
end
+ verify :method => :delete, :only => :destroy, :render => {:nothing => true, :status => :method_not_allowed }
+ def destroy
+ @user.destroy
+ respond_to do |format|
+ format.html { redirect_to(users_url) }
+ format.api { head :ok }
+ end
+ end
+
def edit_membership
@membership = Member.edit_membership(params[:membership_id], params[:membership], @user)
@membership.save if request.post?