Browse Source

feat(audit-logging): add userId filter

pull/9245/head
PM Extra 5 years ago
parent
commit
38acc517a5
  1. 2
      modules/audit-logging/src/Volo.Abp.AuditLogging.Domain/Volo/Abp/AuditLogging/IAuditLogRepository.cs
  2. 6
      modules/audit-logging/src/Volo.Abp.AuditLogging.EntityFrameworkCore/Volo/Abp/AuditLogging/EntityFrameworkCore/EfCoreAuditLogRepository.cs
  3. 7
      modules/audit-logging/src/Volo.Abp.AuditLogging.MongoDB/Volo/Abp/AuditLogging/MongoDB/MongoAuditLogRepository.cs

2
modules/audit-logging/src/Volo.Abp.AuditLogging.Domain/Volo/Abp/AuditLogging/IAuditLogRepository.cs

@ -18,6 +18,7 @@ namespace Volo.Abp.AuditLogging
DateTime? endTime = null,
string httpMethod = null,
string url = null,
Guid? userId = null,
string userName = null,
string applicationName = null,
string correlationId = null,
@ -33,6 +34,7 @@ namespace Volo.Abp.AuditLogging
DateTime? endTime = null,
string httpMethod = null,
string url = null,
Guid? userId = null,
string userName = null,
string applicationName = null,
string correlationId = null,

6
modules/audit-logging/src/Volo.Abp.AuditLogging.EntityFrameworkCore/Volo/Abp/AuditLogging/EntityFrameworkCore/EfCoreAuditLogRepository.cs

@ -29,6 +29,7 @@ namespace Volo.Abp.AuditLogging.EntityFrameworkCore
DateTime? endTime = null,
string httpMethod = null,
string url = null,
Guid? userId = null,
string userName = null,
string applicationName = null,
string correlationId = null,
@ -44,6 +45,7 @@ namespace Volo.Abp.AuditLogging.EntityFrameworkCore
endTime,
httpMethod,
url,
userId,
userName,
applicationName,
correlationId,
@ -67,6 +69,7 @@ namespace Volo.Abp.AuditLogging.EntityFrameworkCore
DateTime? endTime = null,
string httpMethod = null,
string url = null,
Guid? userId = null,
string userName = null,
string applicationName = null,
string correlationId = null,
@ -81,6 +84,7 @@ namespace Volo.Abp.AuditLogging.EntityFrameworkCore
endTime,
httpMethod,
url,
userId,
userName,
applicationName,
correlationId,
@ -100,6 +104,7 @@ namespace Volo.Abp.AuditLogging.EntityFrameworkCore
DateTime? endTime = null,
string httpMethod = null,
string url = null,
Guid? userId = null,
string userName = null,
string applicationName = null,
string correlationId = null,
@ -118,6 +123,7 @@ namespace Volo.Abp.AuditLogging.EntityFrameworkCore
.WhereIf(hasException.HasValue && !hasException.Value, auditLog => auditLog.Exceptions == null || auditLog.Exceptions == "")
.WhereIf(httpMethod != null, auditLog => auditLog.HttpMethod == httpMethod)
.WhereIf(url != null, auditLog => auditLog.Url != null && auditLog.Url.Contains(url))
.WhereIf(userId != null, auditLog => auditLog.UserId == userId)
.WhereIf(userName != null, auditLog => auditLog.UserName == userName)
.WhereIf(applicationName != null, auditLog => auditLog.ApplicationName == applicationName)
.WhereIf(correlationId != null, auditLog => auditLog.CorrelationId == correlationId)

7
modules/audit-logging/src/Volo.Abp.AuditLogging.MongoDB/Volo/Abp/AuditLogging/MongoDB/MongoAuditLogRepository.cs

@ -30,6 +30,7 @@ namespace Volo.Abp.AuditLogging.MongoDB
DateTime? endTime = null,
string httpMethod = null,
string url = null,
Guid? userId = null,
string userName = null,
string applicationName = null,
string correlationId = null,
@ -45,6 +46,7 @@ namespace Volo.Abp.AuditLogging.MongoDB
endTime,
httpMethod,
url,
userId,
userName,
applicationName,
correlationId,
@ -68,6 +70,7 @@ namespace Volo.Abp.AuditLogging.MongoDB
DateTime? endTime = null,
string httpMethod = null,
string url = null,
Guid? userId = null,
string userName = null,
string applicationName = null,
string correlationId = null,
@ -82,6 +85,7 @@ namespace Volo.Abp.AuditLogging.MongoDB
endTime,
httpMethod,
url,
userId,
userName,
applicationName,
correlationId,
@ -103,6 +107,7 @@ namespace Volo.Abp.AuditLogging.MongoDB
DateTime? endTime = null,
string httpMethod = null,
string url = null,
Guid? userId = null,
string userName = null,
string applicationName = null,
string correlationId = null,
@ -120,6 +125,7 @@ namespace Volo.Abp.AuditLogging.MongoDB
.WhereIf(hasException.HasValue && !hasException.Value, auditLog => auditLog.Exceptions == null || auditLog.Exceptions == "")
.WhereIf(httpMethod != null, auditLog => auditLog.HttpMethod == httpMethod)
.WhereIf(url != null, auditLog => auditLog.Url != null && auditLog.Url.Contains(url))
.WhereIf(userId != null, auditLog => auditLog.UserId == userId)
.WhereIf(userName != null, auditLog => auditLog.UserName == userName)
.WhereIf(applicationName != null, auditLog => auditLog.ApplicationName == applicationName)
.WhereIf(correlationId != null, auditLog => auditLog.CorrelationId == correlationId)
@ -128,7 +134,6 @@ namespace Volo.Abp.AuditLogging.MongoDB
.WhereIf(minDuration != null && minDuration > 0, auditLog => auditLog.ExecutionDuration >= minDuration);
}
public virtual async Task<Dictionary<DateTime, double>> GetAverageExecutionDurationPerDayAsync(
DateTime startDate,
DateTime endDate,

Loading…
Cancel
Save