这是基于vue-vben-admin 模板适用于abp Vnext的前端管理项目
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.
 
 
 
 
 
 
feijie d6c254fea6 feat(docs): 添加数据权限模块文档 1 year ago
..
LINGYUN/Abp/DataProtection feat(data-protection): 增加客户端数据规则主体 1 year ago
System feat(data-protection): 增加本地化文档 1 year ago
FodyWeavers.xml upgrade(abp): upgrade abp framework to 7.4.0 2 years ago
FodyWeavers.xsd upgrade(abp): upgrade abp framework to 7.4.0 2 years ago
LINGYUN.Abp.DataProtection.csproj upgrade abp framework to 8.2.0 1 year ago
README.EN.md feat(docs): 添加数据权限模块文档 1 year ago
README.md feat(docs): 添加数据权限模块文档 1 year ago

README.md

LINGYUN.Abp.DataProtection

数据权限实现模块,提供数据权限的核心实现。

功能

  • 数据权限拦截器 - 自动拦截标记了数据权限特性的方法
  • 数据权限验证服务 - 提供数据权限验证功能
  • 数据权限资源存储 - 提供数据权限资源的内存存储实现

配置项

public class AbpDataProtectionOptions
{
    /// <summary>
    /// 是否启用数据权限
    /// 默认: true
    /// </summary>
    public bool IsEnabled { get; set; }

    /// <summary>
    /// 数据权限主体提供者列表
    /// </summary>
    public IList<IDataAccessSubjectContributor> SubjectContributors { get; }

    /// <summary>
    /// 数据权限关键字提供者字典
    /// </summary>
    public IDictionary<string, IDataAccessKeywordContributor> KeywordContributors { get; }

    /// <summary>
    /// 数据权限操作提供者字典
    /// </summary>
    public IDictionary<DataAccessFilterOperate, IDataAccessOperateContributor> OperateContributors { get; }

    /// <summary>
    /// 忽略审计属性列表
    /// 默认包含:Id, LastModifierId, LastModificationTime, CreatorId, CreationTime, 
    /// IsDeleted, DeleterId, DeletionTime, TenantId, EntityVersion, 
    /// ConcurrencyStamp, ExtraProperties
    /// </summary>
    public IList<string> IgnoreAuditedProperties { get; }
}

使用方式

  1. 配置模块
[DependsOn(typeof(AbpDataProtectionModule))]
public class YourModule : AbpModule
{
    public override void ConfigureServices(ServiceConfigurationContext context)
    {
        Configure<AbpDataProtectionOptions>(options =>
        {
            // 配置数据权限选项
            options.IsEnabled = true;
            
            // 添加自定义主体提供者
            options.SubjectContributors.Add(new YourSubjectContributor());
            
            // 添加自定义关键字提供者
            options.KeywordContributors.Add("your-keyword", new YourKeywordContributor());
            
            // 添加自定义操作提供者
            options.OperateContributors.Add(DataAccessFilterOperate.Equal, new YourOperateContributor());
            
            // 添加忽略的审计属性
            options.IgnoreAuditedProperties.Add("YourProperty");
        });
    }
}
  1. 使用数据权限特性
// 类级别的数据权限控制
[DataProtected]
public class YourService
{
    // 方法级别的数据权限控制
    [DataProtected]
    public virtual Task<YourEntity> GetAsync(Guid id)
    {
        // ...
    }

    // 禁用数据权限控制
    [DisableDataProtected]
    public virtual Task<YourEntity> GetWithoutProtectionAsync(Guid id)
    {
        // ...
    }
}

相关链接