From dd3fc288db79b2f1151e176d688b340a41df3936 Mon Sep 17 00:00:00 2001 From: Hamid Reza Mohammadi Date: Mon, 30 Aug 2021 19:44:25 +0430 Subject: [PATCH] #195 logging bad behaviour api --- .../Controllers/AppUserControllerBase.cs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/RSecurityBackend/Controllers/AppUserControllerBase.cs b/RSecurityBackend/Controllers/AppUserControllerBase.cs index b6fd6b45..d873296b 100644 --- a/RSecurityBackend/Controllers/AppUserControllerBase.cs +++ b/RSecurityBackend/Controllers/AppUserControllerBase.cs @@ -1127,6 +1127,25 @@ namespace RSecurityBackend.Controllers return Ok(result.Result); } + /// + /// get user behaviour logs + /// + /// + /// + [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 GetUserBehaviourLogsAsync(Guid userId) + { + RServiceResult result = await _appUserService.GetUserBehaviourLogsAsync(userId); + if (!string.IsNullOrEmpty(result.ExceptionString)) + return BadRequest(result.ExceptionString); + return Ok(result.Result); + } + /// /// kick out a user ///