diff options
author | azul <azul@riseup.net> | 2013-07-11 00:37:45 -0700 |
---|---|---|
committer | azul <azul@riseup.net> | 2013-07-11 00:37:45 -0700 |
commit | 02b69c78eed7682c24cb8361da094bdac45a7749 (patch) | |
tree | a45ed7076a96ddb1601cf9a2e44ae37160f90319 /users/app/controllers/users_controller.rb | |
parent | 3113f8b814417a896ad5340fda88927733f8ab22 (diff) | |
parent | a40a83cb07d9aba8915cd2c4a25aa76e0cf6760e (diff) |
Merge pull request #56 from leapcode/feature/disable_account
Feature/disable account
Diffstat (limited to 'users/app/controllers/users_controller.rb')
-rw-r--r-- | users/app/controllers/users_controller.rb | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/users/app/controllers/users_controller.rb b/users/app/controllers/users_controller.rb index 4ce970b..f66277d 100644 --- a/users/app/controllers/users_controller.rb +++ b/users/app/controllers/users_controller.rb @@ -5,8 +5,8 @@ class UsersController < UsersBaseController before_filter :authorize, :only => [:show, :edit, :update, :destroy] - before_filter :fetch_user, :only => [:show, :edit, :update, :destroy] - before_filter :authorize_admin, :only => [:index] + before_filter :fetch_user, :only => [:show, :edit, :update, :destroy, :deactivate, :enable] + before_filter :authorize_admin, :only => [:index, :deactivate, :enable] respond_to :html @@ -34,6 +34,18 @@ class UsersController < UsersBaseController def edit end + def deactivate + @user.enabled = false + @user.save + respond_with @user + end + + def enable + @user.enabled = true + @user.save + respond_with @user + end + def destroy @user.destroy redirect_to admin? ? users_url : root_url |