Sources/Api/Controllers/UsersController.cs
/// <summary>
/// unassigns a users from a specific role
/// </summary>
/// <param name="request">user role assignment request</param>
/// <returns></returns>
unassigns a users from a specific role
unassigns a users from a specific role
[HttpDelete("role")]
        [Authorize(AuthenticationSchemes = JwtBearerDefaults.AuthenticationScheme, Roles = "ADMINISTRATOR")]
        public async Task<IActionResult> UnassignRoleToUserAsync(UserRoleAssignmentRequest request)
        {
            if (request == null)
            {
                return BadRequest(new ResultMessage
                {
                    OperationStatus = false,
                    ErrorMessages = new List<string> { MessageResources.RoleUnassignmentRequestEmpty }
                });
            }
            try
            {
                ResultMessage result = await _identityService.UnassignRoleToUserAsync(request).ConfigureAwait(false);
                return Ok(result);
            }
            catch (Exception)
            {
                return StatusCode(500, new ResultMessage
                {
                    OperationStatus = false,
                    ErrorMessages = new List<string>
                    {
                        MessageResources.RoleUnassignmentRequestFailed
                    }
                });
            }
        }
[ HttpDelete ( " " ) ] [ Authorize ( AuthenticationSchemes = JwtBearerDefaults . AuthenticationScheme , Roles = " " ) ] public async Task < IActionResult > UnassignRoleToUserAsync ( UserRoleAssignmentRequest request ) { if ( request == null ) { return BadRequest ( new ResultMessage { OperationStatus = false , ErrorMessages = new List < string > { MessageResources . RoleUnassignmentRequestEmpty } } ) ; } try { ResultMessage result = await _identityService . UnassignRoleToUserAsync ( request ) . ConfigureAwait ( false ) ; return Ok ( result ) ; } catch ( Exception ) { return StatusCode ( 500 , new ResultMessage { OperationStatus = false , ErrorMessages = new List < string > { MessageResources . RoleUnassignmentRequestFailed } } ) ; } }
unassigns a users from a specific role
unassigns a users from a specific role
None
request
UserRoleAssignmentRequest
user role assignment request
user role assignment request