Module: Hydra::RoleManagement::UserRolesBehavior
- Extended by:
- ActiveSupport::Concern
- Included in:
- UserRolesController
- Defined in:
- app/controllers/concerns/hydra/role_management/user_roles_behavior.rb
Overview
Module defining Controller actions for adding and managing Roles for Users
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'app/controllers/concerns/hydra/role_management/user_roles_behavior.rb', line 13 def create :add_user, @role u = find_user if u u.roles << @role u.save! redirect_to role_management.role_path(@role) else redirect_to role_management.role_path(@role), flash: { error: "Invalid user #{params[:user_key]}" } end end |
#destroy ⇒ Object
26 27 28 29 30 |
# File 'app/controllers/concerns/hydra/role_management/user_roles_behavior.rb', line 26 def destroy :remove_user, @role @role.users.delete(::User.find(params[:id])) redirect_to role_management.role_path(@role) end |