Class: Dscf::Core::UserRolesController
- Inherits:
-
ApplicationController
- Object
- ActionController::API
- ApplicationController
- Dscf::Core::UserRolesController
- Defined in:
- app/controllers/dscf/core/user_roles_controller.rb
Instance Method Summary collapse
Methods included from Authorizable
#authorize, #authorize_action!, #policy_scope, #pundit_user
Methods included from JsonResponse
#render_error, #render_success, #serialize
Methods included from TokenAuthenticatable
#require_valid_refresh_token, #validate_device_consistency, #validate_token_expiry
Methods included from Authenticatable
#authenticate_user, #authenticate_user!, #current_user, #refresh_token, #sign_in, #sign_out
Instance Method Details
#create ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'app/controllers/dscf/core/user_roles_controller.rb', line 14 def create @clazz = Dscf::Core::UserRole user_role = Dscf::Core::UserRole.new( user: @target_user, role_id: params[:role_id], assigned_by: current_user ) if user_role.save render_success(data: user_role, status: :created) else render_error(errors: user_role.errors.[0], status: :unprocessable_entity) end end |