diff options
Diffstat (limited to 'users/app/controllers')
-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 |