Browse Source

Merge pull request #3935 from abpframework/maliming/audit-patch

Check whether MethodInfo's DeclaringType has auditing disabled.
pull/3970/head
Halil İbrahim Kalkan 6 years ago
committed by GitHub
parent
commit
1da901ee15
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      framework/src/Volo.Abp.Auditing/Volo/Abp/Auditing/AuditingHelper.cs
  2. 6
      framework/src/Volo.Abp.Auditing/Volo/Abp/Auditing/AuditingInterceptorRegistrar.cs

5
framework/src/Volo.Abp.Auditing/Volo/Abp/Auditing/AuditingHelper.cs

@ -77,9 +77,10 @@ namespace Volo.Abp.Auditing
var classType = methodInfo.DeclaringType; var classType = methodInfo.DeclaringType;
if (classType != null) if (classType != null)
{ {
if (AuditingInterceptorRegistrar.ShouldAuditTypeByDefault(classType)) var shouldAudit = AuditingInterceptorRegistrar.ShouldAuditTypeByDefaultOrNull(classType);
if (shouldAudit != null)
{ {
return true; return shouldAudit.Value;
} }
} }

6
framework/src/Volo.Abp.Auditing/Volo/Abp/Auditing/AuditingInterceptorRegistrar.cs

@ -22,7 +22,7 @@ namespace Volo.Abp.Auditing
return false; return false;
} }
if (ShouldAuditTypeByDefault(type)) if (ShouldAuditTypeByDefaultOrNull(type) == true)
{ {
return true; return true;
} }
@ -36,7 +36,7 @@ namespace Volo.Abp.Auditing
} }
//TODO: Move to a better place //TODO: Move to a better place
public static bool ShouldAuditTypeByDefault(Type type) public static bool? ShouldAuditTypeByDefaultOrNull(Type type)
{ {
//TODO: In an inheritance chain, it would be better to check the attributes on the top class first. //TODO: In an inheritance chain, it would be better to check the attributes on the top class first.
@ -55,7 +55,7 @@ namespace Volo.Abp.Auditing
return true; return true;
} }
return false; return null;
} }
} }
} }
Loading…
Cancel
Save