Class: UsersController
- Inherits:
-
AuthorizedController
- Object
- InheritedResources::Base
- AuthorizedController
- UsersController
- Defined in:
- app/controllers/users_controller.rb
Overview
Users Controller
Provides a user/account management interface.
Instance Method Summary collapse
Methods inherited from AuthorizedController
Instance Method Details
#current ⇒ Object
43 44 45 |
# File 'app/controllers/users_controller.rb', line 43 def current redirect_to current_user end |
#lock ⇒ Object
35 36 37 38 39 40 41 |
# File 'app/controllers/users_controller.rb', line 35 def lock @user = resource @user.lock_access! redirect_to users_path, :notice => t('crud.flash.locked', :user => @user.to_s) end |
#unlock ⇒ Object
27 28 29 30 31 32 33 |
# File 'app/controllers/users_controller.rb', line 27 def unlock @user = resource @user.unlock_access! redirect_to users_path, :notice => t('crud.flash.unlocked', :user => @user.to_s) end |
#update ⇒ Object
Actions
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'app/controllers/users_controller.rb', line 10 def update @user = resource # Preset role_texts to ensure it clears roles. params[:user][:role_texts] ||= [] # Test if user is allowed to change roles params[:user].delete(:role_texts) unless can? :manage, Role # Don't try to update password if not provided if params[:user][:password].blank? [:password, :password_confirmation, :current_password].collect{|p| params[:user].delete(p) } end update! end |