17 changed files with 879 additions and 0 deletions
@ -0,0 +1,30 @@ |
|||||
|
# LINGYUN.Abp.DataProtection.Abstractions |
||||
|
|
||||
|
Data protection abstraction module, providing interface definitions and basic types for data protection. |
||||
|
|
||||
|
## Features |
||||
|
|
||||
|
* `IDataProtected` - Data protection interface, marking entities that need data protection control |
||||
|
* `DataProtectedAttribute` - Data protection attribute, marking methods or classes that need data protection control |
||||
|
* `DisableDataProtectedAttribute` - Disable data protection attribute, marking methods or classes that don't need data protection control |
||||
|
|
||||
|
## Data Operation Types |
||||
|
|
||||
|
* `DataAccessOperation.Read` - Query operation |
||||
|
* `DataAccessOperation.Write` - Update operation |
||||
|
* `DataAccessOperation.Delete` - Delete operation |
||||
|
|
||||
|
## Data Filtering |
||||
|
|
||||
|
* `DataAccessFilterLogic` - Data filter logic |
||||
|
* `And` - Logical AND |
||||
|
* `Or` - Logical OR |
||||
|
* `DataAccessFilterRule` - Data filter rule |
||||
|
* `Field` - Field name |
||||
|
* `Value` - Field value |
||||
|
* `Operate` - Operator |
||||
|
* `IsLeft` - Is left parenthesis |
||||
|
|
||||
|
## Related Links |
||||
|
|
||||
|
* [中文文档](./README.md) |
||||
@ -0,0 +1,30 @@ |
|||||
|
# LINGYUN.Abp.DataProtection.Abstractions |
||||
|
|
||||
|
数据权限抽象模块,提供数据权限相关的接口定义和基础类型。 |
||||
|
|
||||
|
## 功能 |
||||
|
|
||||
|
* `IDataProtected` - 数据权限接口,标记实体需要进行数据权限控制 |
||||
|
* `DataProtectedAttribute` - 数据权限特性,标记方法或类需要进行数据权限控制 |
||||
|
* `DisableDataProtectedAttribute` - 禁用数据权限特性,标记方法或类不进行数据权限控制 |
||||
|
|
||||
|
## 数据操作类型 |
||||
|
|
||||
|
* `DataAccessOperation.Read` - 查询操作 |
||||
|
* `DataAccessOperation.Write` - 更新操作 |
||||
|
* `DataAccessOperation.Delete` - 删除操作 |
||||
|
|
||||
|
## 数据过滤 |
||||
|
|
||||
|
* `DataAccessFilterLogic` - 数据过滤逻辑 |
||||
|
* `And` - 且 |
||||
|
* `Or` - 或 |
||||
|
* `DataAccessFilterRule` - 数据过滤规则 |
||||
|
* `Field` - 字段名 |
||||
|
* `Value` - 字段值 |
||||
|
* `Operate` - 操作符 |
||||
|
* `IsLeft` - 是否左括号 |
||||
|
|
||||
|
## 相关链接 |
||||
|
|
||||
|
* [English document](./README.EN.md) |
||||
@ -0,0 +1,105 @@ |
|||||
|
# LINGYUN.Abp.DataProtection.EntityFrameworkCore |
||||
|
|
||||
|
Data protection EntityFramework Core implementation module |
||||
|
|
||||
|
## Interface Description |
||||
|
|
||||
|
* DisableDataProtectedAttribute: Automatically implements DataFilter.Disable<IDataProtected>() through interceptor, data filter will be disabled in the current scope |
||||
|
|
||||
|
## Important Notes |
||||
|
|
||||
|
* When using repository interfaces, try to avoid using *await GetDbSetAsync()* directly, use *await GetQueryableAsync()* instead, because due to the **DbSet** design pattern, it cannot be processed at the moment |
||||
|
* Your repository interface should inherit from **EfCoreDataProtectionRepository**, and your *DbContext* should inherit from **AbpDataProtectionDbContext** |
||||
|
|
||||
|
## Configuration and Usage |
||||
|
|
||||
|
```csharp |
||||
|
[DependsOn( |
||||
|
typeof(AbpDataProtectionEntityFrameworkCoreModule) |
||||
|
)] |
||||
|
public class YouProjectModule : AbpModule |
||||
|
{ |
||||
|
public override void ConfigureServices(ServiceConfigurationContext context) |
||||
|
{ |
||||
|
Configure<DataProtectionManagementOptions>(options => |
||||
|
{ |
||||
|
// Persist protected entity list |
||||
|
options.AddEntities(typeof(YouResource), new Type[] |
||||
|
{ |
||||
|
typeof(YouProtectionObject), |
||||
|
}); |
||||
|
|
||||
|
// Format as follows |
||||
|
// options.AddEntities(typeof(IdentityResource), new Type[] |
||||
|
// { |
||||
|
// typeof(IdentityUser), |
||||
|
// typeof(IdentityRole), |
||||
|
// typeof(OrganizationUnit), |
||||
|
// }); |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
public class YouDbContext : AbpDataProtectionDbContext<YouDbContext> |
||||
|
{ |
||||
|
public DbSet<YouProtectionObject> ProtectionObjects { get; set; } |
||||
|
public YouDbContext( |
||||
|
DbContextOptions<YouDbContext> options) : base(options) |
||||
|
{ |
||||
|
} |
||||
|
|
||||
|
protected override void OnModelCreating(ModelBuilder modelBuilder) |
||||
|
{ |
||||
|
base.OnModelCreating(modelBuilder); |
||||
|
modelBuilder.Entity<YouProtectionObject>(b => |
||||
|
{ |
||||
|
// ... |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
public class EfCoreYouProtectionObjectRepository : |
||||
|
EfCoreDataProtectionRepository<YouDbContext, YouProtectionObject, int>, |
||||
|
IYouProtectionObjectRepository |
||||
|
{ |
||||
|
protected IDataFilter DataFilter { get; } |
||||
|
public EfCoreYouProtectionObjectRepository( |
||||
|
[NotNull] IDbContextProvider<YouDbContext> dbContextProvider, |
||||
|
[NotNull] IDataAuthorizationService dataAuthorizationService, |
||||
|
[NotNull] IEntityTypeFilterBuilder entityTypeFilterBuilder, |
||||
|
IDataFilter dataFilter) |
||||
|
: base(dbContextProvider, dataAuthorizationService, entityTypeFilterBuilder) |
||||
|
{ |
||||
|
DataFilter = dataFilter; |
||||
|
} |
||||
|
|
||||
|
// Get protected data list |
||||
|
public async virtual Task<List<YouProtectionObject>> GetProtectedListAsync() |
||||
|
{ |
||||
|
return await (await GetQueryableAsync()) |
||||
|
.ToListAsync(); |
||||
|
} |
||||
|
|
||||
|
// Mark with DisableDataProtected to get all data list, automatically handle DataFilter.Disable<IDataProtected>() through interceptor |
||||
|
[DisableDataProtected] |
||||
|
public async virtual Task<List<YouProtectionObject>> GetUnProtectedListAsync() |
||||
|
{ |
||||
|
return await (await GetQueryableAsync()) |
||||
|
.ToListAsync(); |
||||
|
} |
||||
|
|
||||
|
// Disable IDataProtected filter to get all data list (can be used anywhere) |
||||
|
public async virtual Task<List<YouProtectionObject>> GetUnProtectedByFilterListAsync() |
||||
|
{ |
||||
|
using (DataFilter.Disable<IDataProtected>()) |
||||
|
{ |
||||
|
return await (await GetQueryableAsync()) |
||||
|
.ToListAsync(); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
## Related Links |
||||
|
|
||||
|
* [中文文档](./README.md) |
||||
@ -0,0 +1,103 @@ |
|||||
|
# LINGYUN.Abp.DataProtection |
||||
|
|
||||
|
Data protection implementation module, providing core implementation of data protection. |
||||
|
|
||||
|
## Features |
||||
|
|
||||
|
* Data Protection Interceptor - Automatically intercepts methods marked with data protection attributes |
||||
|
* Data Authorization Service - Provides data protection validation functionality |
||||
|
* Data Protection Resource Store - Provides in-memory storage implementation for data protection resources |
||||
|
|
||||
|
## Configuration |
||||
|
|
||||
|
```csharp |
||||
|
public class AbpDataProtectionOptions |
||||
|
{ |
||||
|
/// <summary> |
||||
|
/// Whether to enable data protection |
||||
|
/// Default: true |
||||
|
/// </summary> |
||||
|
public bool IsEnabled { get; set; } |
||||
|
|
||||
|
/// <summary> |
||||
|
/// List of data access subject contributors |
||||
|
/// </summary> |
||||
|
public IList<IDataAccessSubjectContributor> SubjectContributors { get; } |
||||
|
|
||||
|
/// <summary> |
||||
|
/// Dictionary of data access keyword contributors |
||||
|
/// </summary> |
||||
|
public IDictionary<string, IDataAccessKeywordContributor> KeywordContributors { get; } |
||||
|
|
||||
|
/// <summary> |
||||
|
/// Dictionary of data access operation contributors |
||||
|
/// </summary> |
||||
|
public IDictionary<DataAccessFilterOperate, IDataAccessOperateContributor> OperateContributors { get; } |
||||
|
|
||||
|
/// <summary> |
||||
|
/// List of ignored audit properties |
||||
|
/// Default includes: Id, LastModifierId, LastModificationTime, CreatorId, CreationTime, |
||||
|
/// IsDeleted, DeleterId, DeletionTime, TenantId, EntityVersion, |
||||
|
/// ConcurrencyStamp, ExtraProperties |
||||
|
/// </summary> |
||||
|
public IList<string> IgnoreAuditedProperties { get; } |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
## Usage |
||||
|
|
||||
|
1. Configure Module |
||||
|
|
||||
|
```csharp |
||||
|
[DependsOn(typeof(AbpDataProtectionModule))] |
||||
|
public class YourModule : AbpModule |
||||
|
{ |
||||
|
public override void ConfigureServices(ServiceConfigurationContext context) |
||||
|
{ |
||||
|
Configure<AbpDataProtectionOptions>(options => |
||||
|
{ |
||||
|
// Configure data protection options |
||||
|
options.IsEnabled = true; |
||||
|
|
||||
|
// Add custom subject contributor |
||||
|
options.SubjectContributors.Add(new YourSubjectContributor()); |
||||
|
|
||||
|
// Add custom keyword contributor |
||||
|
options.KeywordContributors.Add("your-keyword", new YourKeywordContributor()); |
||||
|
|
||||
|
// Add custom operation contributor |
||||
|
options.OperateContributors.Add(DataAccessFilterOperate.Equal, new YourOperateContributor()); |
||||
|
|
||||
|
// Add ignored audit property |
||||
|
options.IgnoreAuditedProperties.Add("YourProperty"); |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
2. Use Data Protection Attributes |
||||
|
|
||||
|
```csharp |
||||
|
// Class level data protection control |
||||
|
[DataProtected] |
||||
|
public class YourService |
||||
|
{ |
||||
|
// Method level data protection control |
||||
|
[DataProtected] |
||||
|
public virtual Task<YourEntity> GetAsync(Guid id) |
||||
|
{ |
||||
|
// ... |
||||
|
} |
||||
|
|
||||
|
// Disable data protection control |
||||
|
[DisableDataProtected] |
||||
|
public virtual Task<YourEntity> GetWithoutProtectionAsync(Guid id) |
||||
|
{ |
||||
|
// ... |
||||
|
} |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
## Related Links |
||||
|
|
||||
|
* [中文文档](./README.md) |
||||
@ -0,0 +1,103 @@ |
|||||
|
# LINGYUN.Abp.DataProtection |
||||
|
|
||||
|
数据权限实现模块,提供数据权限的核心实现。 |
||||
|
|
||||
|
## 功能 |
||||
|
|
||||
|
* 数据权限拦截器 - 自动拦截标记了数据权限特性的方法 |
||||
|
* 数据权限验证服务 - 提供数据权限验证功能 |
||||
|
* 数据权限资源存储 - 提供数据权限资源的内存存储实现 |
||||
|
|
||||
|
## 配置项 |
||||
|
|
||||
|
```csharp |
||||
|
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. 配置模块 |
||||
|
|
||||
|
```csharp |
||||
|
[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"); |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
2. 使用数据权限特性 |
||||
|
|
||||
|
```csharp |
||||
|
// 类级别的数据权限控制 |
||||
|
[DataProtected] |
||||
|
public class YourService |
||||
|
{ |
||||
|
// 方法级别的数据权限控制 |
||||
|
[DataProtected] |
||||
|
public virtual Task<YourEntity> GetAsync(Guid id) |
||||
|
{ |
||||
|
// ... |
||||
|
} |
||||
|
|
||||
|
// 禁用数据权限控制 |
||||
|
[DisableDataProtected] |
||||
|
public virtual Task<YourEntity> GetWithoutProtectionAsync(Guid id) |
||||
|
{ |
||||
|
// ... |
||||
|
} |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
## 相关链接 |
||||
|
|
||||
|
* [English document](./README.EN.md) |
||||
@ -0,0 +1,36 @@ |
|||||
|
# LINGYUN.Abp.DataProtectionManagement.Application.Contracts |
||||
|
|
||||
|
Data protection management application service contracts module, providing application service interfaces and DTOs for data protection management. |
||||
|
|
||||
|
## Features |
||||
|
|
||||
|
* Data Protection Management Application Service Interfaces |
||||
|
* Data Protection DTO Definitions |
||||
|
* Data Protection Query Definitions |
||||
|
|
||||
|
## Application Service Interfaces |
||||
|
|
||||
|
* `IDataProtectionAppService` - Data Protection Application Service Interface |
||||
|
* `GetAsync` - Get Data Protection |
||||
|
* `GetListAsync` - Get Data Protection List |
||||
|
* `CreateAsync` - Create Data Protection |
||||
|
* `UpdateAsync` - Update Data Protection |
||||
|
* `DeleteAsync` - Delete Data Protection |
||||
|
|
||||
|
## DTO Definitions |
||||
|
|
||||
|
* `DataProtectionDto` - Data Protection DTO |
||||
|
* `Id` - Primary Key |
||||
|
* `Name` - Name |
||||
|
* `DisplayName` - Display Name |
||||
|
* `Description` - Description |
||||
|
* `AllowProperties` - List of Allowed Properties |
||||
|
* `FilterGroup` - Filter Rule Group |
||||
|
|
||||
|
* `DataProtectionCreateDto` - Create Data Protection DTO |
||||
|
* `DataProtectionUpdateDto` - Update Data Protection DTO |
||||
|
* `DataProtectionGetListInput` - Get Data Protection List Input DTO |
||||
|
|
||||
|
## Related Links |
||||
|
|
||||
|
* [中文文档](./README.md) |
||||
@ -0,0 +1,36 @@ |
|||||
|
# LINGYUN.Abp.DataProtectionManagement.Application.Contracts |
||||
|
|
||||
|
数据权限管理应用服务契约模块,提供数据权限管理的应用服务接口和DTO。 |
||||
|
|
||||
|
## 功能 |
||||
|
|
||||
|
* 数据权限管理应用服务接口 |
||||
|
* 数据权限DTO定义 |
||||
|
* 数据权限查询定义 |
||||
|
|
||||
|
## 应用服务接口 |
||||
|
|
||||
|
* `IDataProtectionAppService` - 数据权限应用服务接口 |
||||
|
* `GetAsync` - 获取数据权限 |
||||
|
* `GetListAsync` - 获取数据权限列表 |
||||
|
* `CreateAsync` - 创建数据权限 |
||||
|
* `UpdateAsync` - 更新数据权限 |
||||
|
* `DeleteAsync` - 删除数据权限 |
||||
|
|
||||
|
## DTO定义 |
||||
|
|
||||
|
* `DataProtectionDto` - 数据权限DTO |
||||
|
* `Id` - 主键 |
||||
|
* `Name` - 名称 |
||||
|
* `DisplayName` - 显示名称 |
||||
|
* `Description` - 描述 |
||||
|
* `AllowProperties` - 允许的属性列表 |
||||
|
* `FilterGroup` - 过滤规则组 |
||||
|
|
||||
|
* `DataProtectionCreateDto` - 创建数据权限DTO |
||||
|
* `DataProtectionUpdateDto` - 更新数据权限DTO |
||||
|
* `DataProtectionGetListInput` - 获取数据权限列表输入DTO |
||||
|
|
||||
|
## 相关链接 |
||||
|
|
||||
|
* [English document](./README.EN.md) |
||||
@ -0,0 +1,39 @@ |
|||||
|
# LINGYUN.Abp.DataProtectionManagement.Application |
||||
|
|
||||
|
Data protection management application service module, providing application service implementation for data protection management. |
||||
|
|
||||
|
## Features |
||||
|
|
||||
|
* Data Protection Management Application Service |
||||
|
* Create Data Protection |
||||
|
* Update Data Protection |
||||
|
* Delete Data Protection |
||||
|
* Query Data Protection |
||||
|
* Auto Mapping Configuration |
||||
|
* Permission Validation |
||||
|
|
||||
|
## Application Service Implementation |
||||
|
|
||||
|
* `DataProtectionAppService` - Data Protection Application Service |
||||
|
* Implements `IDataProtectionAppService` interface |
||||
|
* Provides CRUD operations for data protection |
||||
|
* Includes permission validation |
||||
|
* Includes data validation |
||||
|
|
||||
|
## Auto Mapping Configuration |
||||
|
|
||||
|
* `DataProtectionManagementApplicationAutoMapperProfile` - Auto Mapping Configuration Profile |
||||
|
* `DataProtection` -> `DataProtectionDto` |
||||
|
* `DataProtectionCreateDto` -> `DataProtection` |
||||
|
* `DataProtectionUpdateDto` -> `DataProtection` |
||||
|
|
||||
|
## Permission Validation |
||||
|
|
||||
|
* Creating data protection requires `DataProtectionManagement.DataProtection.Create` permission |
||||
|
* Updating data protection requires `DataProtectionManagement.DataProtection.Update` permission |
||||
|
* Deleting data protection requires `DataProtectionManagement.DataProtection.Delete` permission |
||||
|
* Querying data protection requires `DataProtectionManagement.DataProtection` permission |
||||
|
|
||||
|
## Related Links |
||||
|
|
||||
|
* [中文文档](./README.md) |
||||
@ -0,0 +1,39 @@ |
|||||
|
# LINGYUN.Abp.DataProtectionManagement.Application |
||||
|
|
||||
|
数据权限管理应用服务模块,提供数据权限管理的应用服务实现。 |
||||
|
|
||||
|
## 功能 |
||||
|
|
||||
|
* 数据权限管理应用服务 |
||||
|
* 创建数据权限 |
||||
|
* 更新数据权限 |
||||
|
* 删除数据权限 |
||||
|
* 查询数据权限 |
||||
|
* 自动映射配置 |
||||
|
* 权限验证 |
||||
|
|
||||
|
## 应用服务实现 |
||||
|
|
||||
|
* `DataProtectionAppService` - 数据权限应用服务 |
||||
|
* 实现 `IDataProtectionAppService` 接口 |
||||
|
* 提供数据权限的CRUD操作 |
||||
|
* 包含权限验证 |
||||
|
* 包含数据验证 |
||||
|
|
||||
|
## 自动映射配置 |
||||
|
|
||||
|
* `DataProtectionManagementApplicationAutoMapperProfile` - 自动映射配置文件 |
||||
|
* `DataProtection` -> `DataProtectionDto` |
||||
|
* `DataProtectionCreateDto` -> `DataProtection` |
||||
|
* `DataProtectionUpdateDto` -> `DataProtection` |
||||
|
|
||||
|
## 权限验证 |
||||
|
|
||||
|
* 创建数据权限需要 `DataProtectionManagement.DataProtection.Create` 权限 |
||||
|
* 更新数据权限需要 `DataProtectionManagement.DataProtection.Update` 权限 |
||||
|
* 删除数据权限需要 `DataProtectionManagement.DataProtection.Delete` 权限 |
||||
|
* 查询数据权限需要 `DataProtectionManagement.DataProtection` 权限 |
||||
|
|
||||
|
## 相关链接 |
||||
|
|
||||
|
* [English document](./README.EN.md) |
||||
@ -0,0 +1,26 @@ |
|||||
|
# LINGYUN.Abp.DataProtectionManagement.Domain.Shared |
||||
|
|
||||
|
Data protection management domain shared module, providing constants, enums, and other shared types for data protection management. |
||||
|
|
||||
|
## Features |
||||
|
|
||||
|
* Localization Resources |
||||
|
* Permission Definitions |
||||
|
* Setting Definitions |
||||
|
|
||||
|
## Permission Definitions |
||||
|
|
||||
|
* DataProtectionManagement.DataProtection - Data Protection Management |
||||
|
* DataProtectionManagement.DataProtection.Create - Create Data Protection |
||||
|
* DataProtectionManagement.DataProtection.Update - Update Data Protection |
||||
|
* DataProtectionManagement.DataProtection.Delete - Delete Data Protection |
||||
|
|
||||
|
## Setting Definitions |
||||
|
|
||||
|
* DataProtectionManagement.EnabledDataProtection - Whether to enable data protection management |
||||
|
* Default value: true |
||||
|
* Can be modified through configuration file or management interface |
||||
|
|
||||
|
## Related Links |
||||
|
|
||||
|
* [中文文档](./README.md) |
||||
@ -0,0 +1,26 @@ |
|||||
|
# LINGYUN.Abp.DataProtectionManagement.Domain.Shared |
||||
|
|
||||
|
数据权限管理领域共享模块,提供数据权限管理的常量、枚举和其他共享类型。 |
||||
|
|
||||
|
## 功能 |
||||
|
|
||||
|
* 本地化资源 |
||||
|
* 权限定义 |
||||
|
* 设置定义 |
||||
|
|
||||
|
## 权限定义 |
||||
|
|
||||
|
* DataProtectionManagement.DataProtection - 数据权限管理 |
||||
|
* DataProtectionManagement.DataProtection.Create - 创建数据权限 |
||||
|
* DataProtectionManagement.DataProtection.Update - 更新数据权限 |
||||
|
* DataProtectionManagement.DataProtection.Delete - 删除数据权限 |
||||
|
|
||||
|
## 设置定义 |
||||
|
|
||||
|
* DataProtectionManagement.EnabledDataProtection - 是否启用数据权限管理 |
||||
|
* 默认值: true |
||||
|
* 可以通过配置文件或管理界面修改 |
||||
|
|
||||
|
## 相关链接 |
||||
|
|
||||
|
* [English document](./README.EN.md) |
||||
@ -0,0 +1,49 @@ |
|||||
|
# LINGYUN.Abp.DataProtectionManagement.Domain |
||||
|
|
||||
|
Data protection management domain module, providing core business logic for data protection management. |
||||
|
|
||||
|
## Features |
||||
|
|
||||
|
* Data Protection Management |
||||
|
* Create Data Protection |
||||
|
* Update Data Protection |
||||
|
* Delete Data Protection |
||||
|
* Query Data Protection |
||||
|
* Data Protection Resource Management |
||||
|
* Resource Definition |
||||
|
* Resource Grouping |
||||
|
* Resource Properties |
||||
|
* Data Protection Rule Management |
||||
|
* Rule Definition |
||||
|
* Rule Grouping |
||||
|
* Rule Operators |
||||
|
|
||||
|
## Domain Services |
||||
|
|
||||
|
* `IDataProtectionManager` - Data Protection Management Service |
||||
|
* `CreateAsync` - Create Data Protection |
||||
|
* `UpdateAsync` - Update Data Protection |
||||
|
* `DeleteAsync` - Delete Data Protection |
||||
|
* `GetAsync` - Get Data Protection |
||||
|
* `GetListAsync` - Get Data Protection List |
||||
|
|
||||
|
## Entities |
||||
|
|
||||
|
* `DataProtection` - Data Protection Entity |
||||
|
* `Id` - Primary Key |
||||
|
* `Name` - Name |
||||
|
* `DisplayName` - Display Name |
||||
|
* `Description` - Description |
||||
|
* `AllowProperties` - List of Allowed Properties |
||||
|
* `FilterGroup` - Filter Rule Group |
||||
|
|
||||
|
## Repositories |
||||
|
|
||||
|
* `IDataProtectionRepository` - Data Protection Repository Interface |
||||
|
* `GetListAsync` - Get Data Protection List |
||||
|
* `FindByNameAsync` - Find Data Protection by Name |
||||
|
* `GetCountAsync` - Get Data Protection Count |
||||
|
|
||||
|
## Related Links |
||||
|
|
||||
|
* [中文文档](./README.md) |
||||
@ -0,0 +1,49 @@ |
|||||
|
# LINGYUN.Abp.DataProtectionManagement.Domain |
||||
|
|
||||
|
数据权限管理领域模块,提供数据权限管理的核心业务逻辑。 |
||||
|
|
||||
|
## 功能 |
||||
|
|
||||
|
* 数据权限管理 |
||||
|
* 创建数据权限 |
||||
|
* 更新数据权限 |
||||
|
* 删除数据权限 |
||||
|
* 查询数据权限 |
||||
|
* 数据权限资源管理 |
||||
|
* 资源定义 |
||||
|
* 资源分组 |
||||
|
* 资源属性 |
||||
|
* 数据权限规则管理 |
||||
|
* 规则定义 |
||||
|
* 规则分组 |
||||
|
* 规则操作符 |
||||
|
|
||||
|
## 领域服务 |
||||
|
|
||||
|
* `IDataProtectionManager` - 数据权限管理服务 |
||||
|
* `CreateAsync` - 创建数据权限 |
||||
|
* `UpdateAsync` - 更新数据权限 |
||||
|
* `DeleteAsync` - 删除数据权限 |
||||
|
* `GetAsync` - 获取数据权限 |
||||
|
* `GetListAsync` - 获取数据权限列表 |
||||
|
|
||||
|
## 实体 |
||||
|
|
||||
|
* `DataProtection` - 数据权限实体 |
||||
|
* `Id` - 主键 |
||||
|
* `Name` - 名称 |
||||
|
* `DisplayName` - 显示名称 |
||||
|
* `Description` - 描述 |
||||
|
* `AllowProperties` - 允许的属性列表 |
||||
|
* `FilterGroup` - 过滤规则组 |
||||
|
|
||||
|
## 仓储 |
||||
|
|
||||
|
* `IDataProtectionRepository` - 数据权限仓储接口 |
||||
|
* `GetListAsync` - 获取数据权限列表 |
||||
|
* `FindByNameAsync` - 根据名称查找数据权限 |
||||
|
* `GetCountAsync` - 获取数据权限数量 |
||||
|
|
||||
|
## 相关链接 |
||||
|
|
||||
|
* [English document](./README.EN.md) |
||||
@ -0,0 +1,72 @@ |
|||||
|
# LINGYUN.Abp.DataProtectionManagement.EntityFrameworkCore |
||||
|
|
||||
|
Data protection management EntityFrameworkCore module, providing data access implementation for data protection management. |
||||
|
|
||||
|
## Features |
||||
|
|
||||
|
* Data Protection Management Repository Implementation |
||||
|
* Database Mapping Configuration |
||||
|
* Database Migration |
||||
|
|
||||
|
## Repository Implementation |
||||
|
|
||||
|
* `EfCoreDataProtectionRepository` - Data Protection Repository EF Core Implementation |
||||
|
* Implements `IDataProtectionRepository` interface |
||||
|
* Provides CRUD operations for data protection |
||||
|
* Supports data filtering |
||||
|
|
||||
|
## Database Mapping Configuration |
||||
|
|
||||
|
```csharp |
||||
|
public static class DataProtectionDbContextModelCreatingExtensions |
||||
|
{ |
||||
|
public static void ConfigureDataProtectionManagement( |
||||
|
this ModelBuilder builder, |
||||
|
Action<DataProtectionModelBuilderConfigurationOptions> optionsAction = null) |
||||
|
{ |
||||
|
builder.Entity<DataProtection>(b => |
||||
|
{ |
||||
|
b.ToTable(options.TablePrefix + "DataProtections", options.Schema); |
||||
|
|
||||
|
b.ConfigureByConvention(); |
||||
|
|
||||
|
b.Property(x => x.Name).IsRequired().HasMaxLength(DataProtectionConsts.MaxNameLength); |
||||
|
b.Property(x => x.DisplayName).HasMaxLength(DataProtectionConsts.MaxDisplayNameLength); |
||||
|
b.Property(x => x.Description).HasMaxLength(DataProtectionConsts.MaxDescriptionLength); |
||||
|
|
||||
|
b.HasIndex(x => x.Name); |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
## Configuration and Usage |
||||
|
|
||||
|
1. Add Module Dependency |
||||
|
|
||||
|
```csharp |
||||
|
[DependsOn(typeof(AbpDataProtectionManagementEntityFrameworkCoreModule))] |
||||
|
public class YourModule : AbpModule |
||||
|
{ |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
2. Configure DbContext |
||||
|
|
||||
|
```csharp |
||||
|
public class YourDbContext : AbpDbContext<YourDbContext>, IDataProtectionManagementDbContext |
||||
|
{ |
||||
|
public DbSet<DataProtection> DataProtections { get; set; } |
||||
|
|
||||
|
protected override void OnModelCreating(ModelBuilder builder) |
||||
|
{ |
||||
|
base.OnModelCreating(builder); |
||||
|
|
||||
|
builder.ConfigureDataProtectionManagement(); |
||||
|
} |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
## Related Links |
||||
|
|
||||
|
* [中文文档](./README.md) |
||||
@ -0,0 +1,72 @@ |
|||||
|
# LINGYUN.Abp.DataProtectionManagement.EntityFrameworkCore |
||||
|
|
||||
|
数据权限管理EntityFrameworkCore模块,提供数据权限管理的数据访问实现。 |
||||
|
|
||||
|
## 功能 |
||||
|
|
||||
|
* 数据权限管理仓储实现 |
||||
|
* 数据库映射配置 |
||||
|
* 数据库迁移 |
||||
|
|
||||
|
## 仓储实现 |
||||
|
|
||||
|
* `EfCoreDataProtectionRepository` - 数据权限仓储EF Core实现 |
||||
|
* 实现 `IDataProtectionRepository` 接口 |
||||
|
* 提供数据权限的CRUD操作 |
||||
|
* 支持数据过滤 |
||||
|
|
||||
|
## 数据库映射配置 |
||||
|
|
||||
|
```csharp |
||||
|
public static class DataProtectionDbContextModelCreatingExtensions |
||||
|
{ |
||||
|
public static void ConfigureDataProtectionManagement( |
||||
|
this ModelBuilder builder, |
||||
|
Action<DataProtectionModelBuilderConfigurationOptions> optionsAction = null) |
||||
|
{ |
||||
|
builder.Entity<DataProtection>(b => |
||||
|
{ |
||||
|
b.ToTable(options.TablePrefix + "DataProtections", options.Schema); |
||||
|
|
||||
|
b.ConfigureByConvention(); |
||||
|
|
||||
|
b.Property(x => x.Name).IsRequired().HasMaxLength(DataProtectionConsts.MaxNameLength); |
||||
|
b.Property(x => x.DisplayName).HasMaxLength(DataProtectionConsts.MaxDisplayNameLength); |
||||
|
b.Property(x => x.Description).HasMaxLength(DataProtectionConsts.MaxDescriptionLength); |
||||
|
|
||||
|
b.HasIndex(x => x.Name); |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
## 配置使用 |
||||
|
|
||||
|
1. 添加模块依赖 |
||||
|
|
||||
|
```csharp |
||||
|
[DependsOn(typeof(AbpDataProtectionManagementEntityFrameworkCoreModule))] |
||||
|
public class YourModule : AbpModule |
||||
|
{ |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
2. 配置DbContext |
||||
|
|
||||
|
```csharp |
||||
|
public class YourDbContext : AbpDbContext<YourDbContext>, IDataProtectionManagementDbContext |
||||
|
{ |
||||
|
public DbSet<DataProtection> DataProtections { get; set; } |
||||
|
|
||||
|
protected override void OnModelCreating(ModelBuilder builder) |
||||
|
{ |
||||
|
base.OnModelCreating(builder); |
||||
|
|
||||
|
builder.ConfigureDataProtectionManagement(); |
||||
|
} |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
## 相关链接 |
||||
|
|
||||
|
* [English document](./README.EN.md) |
||||
@ -0,0 +1,32 @@ |
|||||
|
# LINGYUN.Abp.DataProtectionManagement.HttpApi |
||||
|
|
||||
|
Data protection management HTTP API module, providing REST API interfaces for data protection management. |
||||
|
|
||||
|
## Features |
||||
|
|
||||
|
* Data Protection Management REST API |
||||
|
* Create Data Protection |
||||
|
* Update Data Protection |
||||
|
* Delete Data Protection |
||||
|
* Query Data Protection |
||||
|
|
||||
|
## API Controllers |
||||
|
|
||||
|
* `DataProtectionController` - Data Protection Controller |
||||
|
* `GET /api/data-protection-management/data-protection/{id}` - Get Specific Data Protection |
||||
|
* `GET /api/data-protection-management/data-protection` - Get Data Protection List |
||||
|
* `POST /api/data-protection-management/data-protection` - Create Data Protection |
||||
|
* `PUT /api/data-protection-management/data-protection/{id}` - Update Data Protection |
||||
|
* `DELETE /api/data-protection-management/data-protection/{id}` - Delete Data Protection |
||||
|
|
||||
|
## Permission Validation |
||||
|
|
||||
|
* All APIs require authentication |
||||
|
* Creating data protection requires `DataProtectionManagement.DataProtection.Create` permission |
||||
|
* Updating data protection requires `DataProtectionManagement.DataProtection.Update` permission |
||||
|
* Deleting data protection requires `DataProtectionManagement.DataProtection.Delete` permission |
||||
|
* Querying data protection requires `DataProtectionManagement.DataProtection` permission |
||||
|
|
||||
|
## Related Links |
||||
|
|
||||
|
* [中文文档](./README.md) |
||||
@ -0,0 +1,32 @@ |
|||||
|
# LINGYUN.Abp.DataProtectionManagement.HttpApi |
||||
|
|
||||
|
数据权限管理HTTP API模块,提供数据权限管理的REST API接口。 |
||||
|
|
||||
|
## 功能 |
||||
|
|
||||
|
* 数据权限管理REST API |
||||
|
* 创建数据权限 |
||||
|
* 更新数据权限 |
||||
|
* 删除数据权限 |
||||
|
* 查询数据权限 |
||||
|
|
||||
|
## API控制器 |
||||
|
|
||||
|
* `DataProtectionController` - 数据权限控制器 |
||||
|
* `GET /api/data-protection-management/data-protection/{id}` - 获取指定数据权限 |
||||
|
* `GET /api/data-protection-management/data-protection` - 获取数据权限列表 |
||||
|
* `POST /api/data-protection-management/data-protection` - 创建数据权限 |
||||
|
* `PUT /api/data-protection-management/data-protection/{id}` - 更新数据权限 |
||||
|
* `DELETE /api/data-protection-management/data-protection/{id}` - 删除数据权限 |
||||
|
|
||||
|
## 权限验证 |
||||
|
|
||||
|
* 所有API都需要认证 |
||||
|
* 创建数据权限需要 `DataProtectionManagement.DataProtection.Create` 权限 |
||||
|
* 更新数据权限需要 `DataProtectionManagement.DataProtection.Update` 权限 |
||||
|
* 删除数据权限需要 `DataProtectionManagement.DataProtection.Delete` 权限 |
||||
|
* 查询数据权限需要 `DataProtectionManagement.DataProtection` 权限 |
||||
|
|
||||
|
## 相关链接 |
||||
|
|
||||
|
* [English document](./README.EN.md) |
||||
Loading…
Reference in new issue