-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* move user security log to account
- Loading branch information
Showing
10 changed files
with
93 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
...ccount/src/Passingwind.Abp.Account.Application.Contracts/IAccountSecurityLogAppService.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
using System.Threading.Tasks; | ||
using Passingwind.Abp.Identity; | ||
using Volo.Abp.Application.Dtos; | ||
|
||
namespace Passingwind.Abp.Account; | ||
|
||
public interface IAccountSecurityLogAppService | ||
{ | ||
Task<PagedResultDto<IdentitySecurityLogDto>> GetListAsync(IdentitySecurityLogPagedListRequestDto input); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
modules/account/src/Passingwind.Abp.Account.Application/AccountSecurityLogAppService.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
using System.Collections.Generic; | ||
using System.Threading.Tasks; | ||
using Microsoft.AspNetCore.Authorization; | ||
using Passingwind.Abp.Identity; | ||
using Volo.Abp.Application.Dtos; | ||
using Volo.Abp.Identity; | ||
|
||
namespace Passingwind.Abp.Account; | ||
|
||
[Authorize] | ||
public class AccountSecurityLogAppService : AccountAppBaseService, IAccountSecurityLogAppService | ||
{ | ||
protected IIdentitySecurityLogRepository SecurityLogRepository { get; } | ||
|
||
public AccountSecurityLogAppService(IIdentitySecurityLogRepository securityLogRepository) | ||
{ | ||
SecurityLogRepository = securityLogRepository; | ||
} | ||
|
||
public virtual async Task<PagedResultDto<IdentitySecurityLogDto>> GetListAsync(IdentitySecurityLogPagedListRequestDto input) | ||
{ | ||
input.UserId = CurrentUser.Id; | ||
|
||
var count = await SecurityLogRepository.GetCountAsync( | ||
input.StartTime, | ||
input.EndTime, | ||
input.ApplicationName, | ||
input.Identity, | ||
input.Action, | ||
input.UserId, | ||
input.UserName, | ||
input.ClientId, | ||
input.CorrelationId); | ||
|
||
var list = await SecurityLogRepository.GetListAsync( | ||
input.Sorting ?? nameof(IdentitySecurityLog.CreationTime) + " desc", | ||
input.MaxResultCount, | ||
input.SkipCount, | ||
input.StartTime, | ||
input.EndTime, | ||
input.ApplicationName, | ||
input.Identity, | ||
input.Action, | ||
input.UserId, | ||
input.UserName, | ||
input.ClientId, | ||
input.CorrelationId); | ||
|
||
return new PagedResultDto<IdentitySecurityLogDto>(count, ObjectMapper.Map<List<IdentitySecurityLog>, List<IdentitySecurityLogDto>>(list)); | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
modules/account/src/Passingwind.Abp.Account.HttpApi/AccountSecurityLogController.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
using System.Threading.Tasks; | ||
using Microsoft.AspNetCore.Mvc; | ||
using Passingwind.Abp.Identity; | ||
using Volo.Abp; | ||
using Volo.Abp.Application.Dtos; | ||
|
||
namespace Passingwind.Abp.Account; | ||
|
||
[RemoteService(Name = AccountRemoteServiceConsts.RemoteServiceName)] | ||
[Area(AccountRemoteServiceConsts.ModuleName)] | ||
[Route("/api/account/security-logs")] | ||
public class AccountSecurityLogController : AccountBaseController, IAccountSecurityLogAppService | ||
{ | ||
private readonly IAccountSecurityLogAppService _service; | ||
|
||
public AccountSecurityLogController(IAccountSecurityLogAppService service) | ||
{ | ||
_service = service; | ||
} | ||
|
||
[HttpGet] | ||
public Task<PagedResultDto<IdentitySecurityLogDto>> GetListAsync(IdentitySecurityLogPagedListRequestDto input) | ||
{ | ||
return _service.GetListAsync(input); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters