You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
58 lines
2.2 KiB
58 lines
2.2 KiB
3 years ago
|
using Microsoft.AspNetCore.Authorization;
|
||
|
using Sanhe.Abp.Auditing.Features;
|
||
|
using Sanhe.Abp.Auditing.Permissions;
|
||
|
using Sanhe.Abp.AuditLogging;
|
||
|
using System;
|
||
|
using System.Collections.Generic;
|
||
|
using System.Threading.Tasks;
|
||
|
using Volo.Abp.Application.Dtos;
|
||
|
using Volo.Abp.Features;
|
||
|
|
||
|
namespace Sanhe.Abp.Auditing.SecurityLogs
|
||
|
{
|
||
|
[Authorize(AuditingPermissionNames.SecurityLog.Default)]
|
||
|
[RequiresFeature(AuditingFeatureNames.Logging.SecurityLog)]
|
||
|
public class SecurityLogAppService : AuditingApplicationServiceBase, ISecurityLogAppService
|
||
|
{
|
||
|
protected ISecurityLogManager SecurityLogManager { get; }
|
||
|
|
||
|
public SecurityLogAppService(ISecurityLogManager securityLogManager)
|
||
|
{
|
||
|
SecurityLogManager = securityLogManager;
|
||
|
}
|
||
|
|
||
|
public virtual async Task<SecurityLogDto> GetAsync(Guid id)
|
||
|
{
|
||
|
var securityLog = await SecurityLogManager.GetAsync(id, includeDetails: true);
|
||
|
|
||
|
return ObjectMapper.Map<SecurityLog, SecurityLogDto>(securityLog);
|
||
|
}
|
||
|
|
||
|
public virtual async Task<PagedResultDto<SecurityLogDto>> GetListAsync(SecurityLogGetByPagedDto input)
|
||
|
{
|
||
|
var securityLogCount = await SecurityLogManager
|
||
|
.GetCountAsync(input.StartTime, input.EndTime,
|
||
|
input.ApplicationName, input.Identity, input.ActionName,
|
||
|
input.UserId, input.UserName, input.ClientId, input.CorrelationId
|
||
|
);
|
||
|
|
||
|
var securityLogs = await SecurityLogManager
|
||
|
.GetListAsync(input.Sorting, input.MaxResultCount, input.SkipCount,
|
||
|
input.StartTime, input.EndTime,
|
||
|
input.ApplicationName, input.Identity, input.ActionName,
|
||
|
input.UserId, input.UserName, input.ClientId, input.CorrelationId,
|
||
|
includeDetails: false
|
||
|
);
|
||
|
|
||
|
return new PagedResultDto<SecurityLogDto>(securityLogCount,
|
||
|
ObjectMapper.Map<List<SecurityLog>, List<SecurityLogDto>>(securityLogs));
|
||
|
}
|
||
|
|
||
|
[Authorize(AuditingPermissionNames.SecurityLog.Delete)]
|
||
|
public virtual async Task DeleteAsync(Guid id)
|
||
|
{
|
||
|
await SecurityLogManager.DeleteAsync(id);
|
||
|
}
|
||
|
}
|
||
|
}
|