summaryrefslogtreecommitdiff
path: root/users/app/controllers/users_controller.rb
diff options
context:
space:
mode:
Diffstat (limited to 'users/app/controllers/users_controller.rb')
-rw-r--r--users/app/controllers/users_controller.rb16
1 files changed, 14 insertions, 2 deletions
diff --git a/users/app/controllers/users_controller.rb b/users/app/controllers/users_controller.rb
index 38a69e3..189e7d4 100644
--- a/users/app/controllers/users_controller.rb
+++ b/users/app/controllers/users_controller.rb
@@ -1,10 +1,10 @@
class UsersController < ApplicationController
before_filter :authorize, :only => [:show, :edit, :destroy, :update]
- before_filter :fetch_user, :only => [:show, :edit, :update, :destroy]
+ before_filter :fetch_user, :only => [:show, :edit, :update, :destroy, :deactivate, :enable]
before_filter :authorize_self, :only => [:update]
before_filter :set_anchor, :only => [:edit, :update]
- before_filter :authorize_admin, :only => [:index]
+ before_filter :authorize_admin, :only => [:index, :deactivate, :enable]
respond_to :json, :html
@@ -41,6 +41,18 @@ class UsersController < ApplicationController
respond_with @user, :location => edit_user_path(@user, :anchor => @anchor)
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_path : root_path