summaryrefslogtreecommitdiff
path: root/app/controllers
diff options
context:
space:
mode:
authorelijah <elijah@riseup.net>2014-11-10 00:04:52 -0800
committerelijah <elijah@riseup.net>2014-11-10 00:04:52 -0800
commitfec5cf6955898b170683677b172ac99a6475d491 (patch)
tree246fe05053060d47928479f6c7fbc43510f37315 /app/controllers
parent6714b257880a393994e58922f8959eecdf7615c5 (diff)
added destroy user to api
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/v1/users_controller.rb12
1 files changed, 10 insertions, 2 deletions
diff --git a/app/controllers/v1/users_controller.rb b/app/controllers/v1/users_controller.rb
index bfa04fc..d57db6f 100644
--- a/app/controllers/v1/users_controller.rb
+++ b/app/controllers/v1/users_controller.rb
@@ -2,9 +2,9 @@ module V1
class UsersController < ApiController
include ControllerExtension::FetchUser
- before_filter :fetch_user, :only => [:update]
+ before_filter :fetch_user, :only => [:update, :destroy]
before_filter :require_admin, :only => [:index]
- before_filter :require_login, :only => [:index, :update]
+ before_filter :require_login, :only => [:index, :update, :destroy]
before_filter :require_registration_allowed, only: :create
respond_to :json
@@ -29,6 +29,14 @@ module V1
respond_with @user
end
+ def destroy
+ @user.account.destroy
+ if @user == current_user
+ logout
+ end
+ render :json => {'success' => 'user deleted'}
+ end
+
protected
def require_registration_allowed