首页 > 其他 > 详细

审计模块

时间:2019-07-25 11:07:49      阅读:114      评论:0      收藏:0      [点我收藏+]

1、模块配置

 类型是否定义了AuditedAttribute,DisableAuditingAttribute,或派生于IAuditingEnabled,2)类型方法定义AuditedAttribute

添加Auditing的拦截器

[DependsOn(
        typeof(AbpDataModule),
        typeof(AbpJsonModule),
        typeof(AbpTimingModule),
        typeof(AbpSecurityModule),
        typeof(AbpThreadingModule),
        typeof(AbpMultiTenancyModule)
        )]
    public class AbpAuditingModule : AbpModule
    {
        public override void PreConfigureServices(ServiceConfigurationContext context)
        {
            context.Services.OnRegistred(AuditingInterceptorRegistrar.RegisterIfNeeded);
        }
    }

2、审计的配置信息AbpAuditingOptions

HideErrors:默认为true,auditing will not throw an exceptions and it will log it when an error occurred while saving AuditLog.

IsEnabled: 默认为true

ApplicationName;IsEnabledForAnonymousUsers;List<AuditLogContributor>;List<Type> IgnoredType;IEntityHistorySelectorList EntityHistorySelectors

3、Info信息

1)AuditLogInfo 应用名称,用户Id,用户名,租户Id,租户名,扮演Id,扮演名,执行时间,客户端信息,AuditLogActionInfo列表,Exception列表

2)AuditLogActionInfo

3)EntityChangeInfo

4)EntityPropertyChangeInfo

4)审计类接口

IMayHaveCreator;IMustHaveCreator;IHasModificationTime;IHasCreationTime;IHasCreationTime;IHasDeletionTime

ICreationAuditedObject(IHasCreationTime,IMayHaveCreator)

IModificationAuditedObject(IHasModificationTime)

IDeletionAuditedObject(IHasDeletionTime)

IAuditedObject(ICreationAuditedObject,IModificationAuditedObject)

IFullAuditedObject(IAuditedObject,IDeletionAuditedObject)

  public interface IAuditPropertySetter
    {
        void SetCreationProperties(object targetObject);

        void SetModificationProperties(object targetObject);

        void SetDeletionProperties(object targetObject);
    }

5)IAuditingManager

  public interface IAuditingManager
    {
        [CanBeNull]
        IAuditLogScope Current { get; }

        IAuditLogSaveHandle BeginScope();
    }

保存AuditLogInfo

    protected virtual async Task SaveAsync(DisposableSaveHandle saveHandle)
        {
            BeforeSave(saveHandle);

            if (ShouldSave(saveHandle.AuditLog))
            {
                await _auditingStore.SaveAsync(saveHandle.AuditLog);
            }
        }

6、IAuditingStore 存储  AuditLogInfo

审计模块

原文:https://www.cnblogs.com/cloudsu/p/11190576.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!