#195 logging bad behaviour api

This commit is contained in:
Hamid Reza Mohammadi 2021-08-30 19:44:25 +04:30
parent 3f09895234
commit dd3fc288db

View File

@ -1127,6 +1127,25 @@ namespace RSecurityBackend.Controllers
return Ok(result.Result);
}
/// <summary>
/// get user behaviour logs
/// </summary>
/// <param name="userId"></param>
/// <returns></returns>
[HttpGet]
[Authorize(Policy = SecurableItem.UserEntityShortName + ":" + SecurableItem.Administer)]
[Route("behaviour/log/{userId}")]
[ProducesResponseType((int)HttpStatusCode.OK, Type = typeof(RUserBehaviourLog[]))]
[ProducesResponseType((int)HttpStatusCode.BadRequest, Type = typeof(string))]
[ProducesResponseType((int)HttpStatusCode.NotFound)]
public async Task<IActionResult> GetUserBehaviourLogsAsync(Guid userId)
{
RServiceResult<RUserBehaviourLog[]> result = await _appUserService.GetUserBehaviourLogsAsync(userId);
if (!string.IsNullOrEmpty(result.ExceptionString))
return BadRequest(result.ExceptionString);
return Ok(result.Result);
}
/// <summary>
/// kick out a user
/// </summary>