summaryrefslogtreecommitdiff
path: root/users/app/controllers
diff options
context:
space:
mode:
authorjessib <jessib@leap.se>2013-07-03 14:07:59 -0700
committerjessib <jessib@leap.se>2013-07-03 14:07:59 -0700
commit6c413d3b0c4f9343fe35dbd6ad65b87dca4b4831 (patch)
tree115808c1aa70bb7a3257bbc15779b9b942950c27 /users/app/controllers
parent3ead553bdd6b28c8210d9dcb764db407ba580c23 (diff)
Accounts can be enabled or not. Admins can edit this property.
Diffstat (limited to 'users/app/controllers')
-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