diff --git a/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection.Abstractions/LINGYUN/Abp/DataProtection/DataAccessFilterGroup.cs b/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection.Abstractions/LINGYUN/Abp/DataProtection/DataAccessFilterGroup.cs
index 31cbecc58..b7319930d 100644
--- a/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection.Abstractions/LINGYUN/Abp/DataProtection/DataAccessFilterGroup.cs
+++ b/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection.Abstractions/LINGYUN/Abp/DataProtection/DataAccessFilterGroup.cs
@@ -32,8 +32,13 @@ public class DataAccessFilterGroup
return this;
}
- public DataAccessFilterGroup AddRule(string field, object value, DataAccessFilterOperate operate = DataAccessFilterOperate.Equal)
+ public DataAccessFilterGroup AddRule(
+ string field,
+ object value,
+ string typeFullName,
+ string javaScriptType,
+ DataAccessFilterOperate operate = DataAccessFilterOperate.Equal)
{
- return AddRule(new DataAccessFilterRule(field, value, operate));
+ return AddRule(new DataAccessFilterRule(field, value, typeFullName, javaScriptType, operate));
}
}
\ No newline at end of file
diff --git a/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection.Abstractions/LINGYUN/Abp/DataProtection/DataAccessFilterRule.cs b/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection.Abstractions/LINGYUN/Abp/DataProtection/DataAccessFilterRule.cs
index 868e72bb1..eddbffc76 100644
--- a/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection.Abstractions/LINGYUN/Abp/DataProtection/DataAccessFilterRule.cs
+++ b/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection.Abstractions/LINGYUN/Abp/DataProtection/DataAccessFilterRule.cs
@@ -14,6 +14,14 @@ public class DataAccessFilterRule
///
public object Value { get; set; }
///
+ /// 类型全名
+ ///
+ public string TypeFullName { get; set; }
+ ///
+ /// Js类型
+ ///
+ public string JavaScriptType { get; set; }
+ ///
/// 操作类型
///
public DataAccessFilterOperate Operate { get; set; }
@@ -27,10 +35,18 @@ public class DataAccessFilterRule
}
- public DataAccessFilterRule(string field, object value, DataAccessFilterOperate operate = DataAccessFilterOperate.Equal, bool isLeft = false)
+ public DataAccessFilterRule(
+ string field,
+ object value,
+ string typeFullName,
+ string javaScriptType,
+ DataAccessFilterOperate operate = DataAccessFilterOperate.Equal,
+ bool isLeft = false)
{
Field = field;
Value = value;
+ TypeFullName = typeFullName;
+ JavaScriptType = javaScriptType;
Operate = operate;
IsLeft = isLeft;
}
diff --git a/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection.Abstractions/LINGYUN/Abp/DataProtection/DataAccessResource.cs b/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection.Abstractions/LINGYUN/Abp/DataProtection/DataAccessResource.cs
index 27959a51b..786887299 100644
--- a/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection.Abstractions/LINGYUN/Abp/DataProtection/DataAccessResource.cs
+++ b/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection.Abstractions/LINGYUN/Abp/DataProtection/DataAccessResource.cs
@@ -34,7 +34,7 @@ public class DataAccessResource
///
/// 允许操作的属性列表
///
- public List AllowProperties { get; set; }
+ public List AccessedProperties { get; set; }
public DataAccessResource()
{
@@ -53,6 +53,6 @@ public class DataAccessResource
EntityTypeFullName = entityTypeFullName;
Operation = operation;
FilterGroup = filterGroup;
- AllowProperties = new List();
+ AccessedProperties = new List();
}
}
diff --git a/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection.Abstractions/LINGYUN/Abp/DataProtection/DataAccessResourceChangeEvent.cs b/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection.Abstractions/LINGYUN/Abp/DataProtection/DataAccessResourceChangeEvent.cs
new file mode 100644
index 000000000..c2df4141a
--- /dev/null
+++ b/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection.Abstractions/LINGYUN/Abp/DataProtection/DataAccessResourceChangeEvent.cs
@@ -0,0 +1,20 @@
+using System;
+using Volo.Abp.EventBus;
+
+namespace LINGYUN.Abp.DataProtection;
+
+[Serializable]
+[EventName("abp.data_protection.resource_changed")]
+public class DataAccessResourceChangeEvent
+{
+ public DataAccessResource Resource { get; set; }
+ public DataAccessResourceChangeEvent()
+ {
+
+ }
+
+ public DataAccessResourceChangeEvent(DataAccessResource resource)
+ {
+ Resource = resource;
+ }
+}
diff --git a/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection.Abstractions/LINGYUN/Abp/DataProtection/DisableDataProtectedAttribute.cs b/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection.Abstractions/LINGYUN/Abp/DataProtection/DisableDataProtectedAttribute.cs
index 9c8731596..052d53fea 100644
--- a/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection.Abstractions/LINGYUN/Abp/DataProtection/DisableDataProtectedAttribute.cs
+++ b/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection.Abstractions/LINGYUN/Abp/DataProtection/DisableDataProtectedAttribute.cs
@@ -5,4 +5,13 @@ namespace LINGYUN.Abp.DataProtection;
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Method, AllowMultiple = false)]
public class DisableDataProtectedAttribute : Attribute
{
+ public DataAccessOperation? Operation { get; }
+ public DisableDataProtectedAttribute()
+ {
+ }
+
+ public DisableDataProtectedAttribute(DataAccessOperation operation)
+ {
+ Operation = operation;
+ }
}
diff --git a/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection.Abstractions/LINGYUN/Abp/DataProtection/Localization/Resources/en.json b/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection.Abstractions/LINGYUN/Abp/DataProtection/Localization/Resources/en.json
index ff637aac0..a07a45eff 100644
--- a/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection.Abstractions/LINGYUN/Abp/DataProtection/Localization/Resources/en.json
+++ b/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection.Abstractions/LINGYUN/Abp/DataProtection/Localization/Resources/en.json
@@ -1,6 +1,10 @@
{
"culture": "en",
"texts": {
- "DataProtection:010001": "Data access permission not granted to protected resources!"
+ "DataProtection:010001": "Data access permission not granted to protected resources!",
+ "DisplayName:LastModifierId": "Last Modifier Id",
+ "DisplayName:LastModificationTime": "Last Modification Time",
+ "DisplayName:CreatorId": "Creator Id",
+ "DisplayName:CreationTime": "Creation Time"
}
}
\ No newline at end of file
diff --git a/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection.Abstractions/LINGYUN/Abp/DataProtection/Localization/Resources/zh-Hans.json b/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection.Abstractions/LINGYUN/Abp/DataProtection/Localization/Resources/zh-Hans.json
index 964c7ab93..5e719bf94 100644
--- a/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection.Abstractions/LINGYUN/Abp/DataProtection/Localization/Resources/zh-Hans.json
+++ b/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection.Abstractions/LINGYUN/Abp/DataProtection/Localization/Resources/zh-Hans.json
@@ -1,6 +1,10 @@
{
"culture": "zh-Hans",
"texts": {
- "DataProtection:010001": "未授予受保护资源的数据访问权限!"
+ "DataProtection:010001": "未授予受保护资源的数据访问权限!",
+ "DisplayName:LastModifierId": "上次修改人",
+ "DisplayName:LastModificationTime": "上次修改时间",
+ "DisplayName:CreatorId": "创建人",
+ "DisplayName:CreationTime": "创建时间"
}
}
\ No newline at end of file
diff --git a/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection.Abstractions/LINGYUN/Abp/DataProtection/Models/EntityEnumInfoModel.cs b/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection.Abstractions/LINGYUN/Abp/DataProtection/Models/EntityEnumInfoModel.cs
new file mode 100644
index 000000000..efd2e2bc7
--- /dev/null
+++ b/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection.Abstractions/LINGYUN/Abp/DataProtection/Models/EntityEnumInfoModel.cs
@@ -0,0 +1,7 @@
+namespace LINGYUN.Abp.DataProtection.Models;
+
+public class EntityEnumInfoModel
+{
+ public string Key { get; set; }
+ public object Value { get; set; }
+}
diff --git a/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection.Abstractions/LINGYUN/Abp/DataProtection/Models/EntityPropertyInfoModel.cs b/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection.Abstractions/LINGYUN/Abp/DataProtection/Models/EntityPropertyInfoModel.cs
new file mode 100644
index 000000000..522338a16
--- /dev/null
+++ b/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection.Abstractions/LINGYUN/Abp/DataProtection/Models/EntityPropertyInfoModel.cs
@@ -0,0 +1,33 @@
+namespace LINGYUN.Abp.DataProtection.Models;
+
+public class EntityPropertyInfoModel
+{
+ ///
+ /// 名称
+ ///
+ public string Name { get; set; }
+ ///
+ /// 显示名称
+ ///
+ public string DisplayName { get; set; }
+ ///
+ /// 类型全名
+ ///
+ public string TypeFullName { get; set; }
+ ///
+ /// JavaScript类型
+ ///
+ public string JavaScriptType { get; set; }
+ ///
+ /// JavaScript名称
+ ///
+ public string JavaScriptName { get; set; }
+ ///
+ /// 枚举列表
+ ///
+ public EntityEnumInfoModel[] Enums { get; set; }
+ ///
+ /// 允许的过滤操作列表
+ ///
+ public DataAccessFilterOperate[] Operates { get; set; }
+}
diff --git a/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection.Abstractions/LINGYUN/Abp/DataProtection/Models/EntityTypeInfoGetModel.cs b/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection.Abstractions/LINGYUN/Abp/DataProtection/Models/EntityTypeInfoGetModel.cs
new file mode 100644
index 000000000..44c38a5a3
--- /dev/null
+++ b/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection.Abstractions/LINGYUN/Abp/DataProtection/Models/EntityTypeInfoGetModel.cs
@@ -0,0 +1,9 @@
+using System.ComponentModel.DataAnnotations;
+
+namespace LINGYUN.Abp.DataProtection.Models;
+
+public class EntityTypeInfoGetModel
+{
+ [Required]
+ public DataAccessOperation Operation { get; set; }
+}
diff --git a/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection.Abstractions/LINGYUN/Abp/DataProtection/Models/EntityTypeInfoModel.cs b/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection.Abstractions/LINGYUN/Abp/DataProtection/Models/EntityTypeInfoModel.cs
new file mode 100644
index 000000000..84d1f30c3
--- /dev/null
+++ b/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection.Abstractions/LINGYUN/Abp/DataProtection/Models/EntityTypeInfoModel.cs
@@ -0,0 +1,19 @@
+using System.Collections.Generic;
+
+namespace LINGYUN.Abp.DataProtection.Models;
+
+public class EntityTypeInfoModel
+{
+ ///
+ /// 实体名称
+ ///
+ public string Name { get; set; }
+ ///
+ /// 显示名称
+ ///
+ public string DisplayName { get; set; }
+ ///
+ /// 可访问属性列表
+ ///
+ public List Properties { get; set; } = new List();
+}
diff --git a/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection.Application.Contracts/FodyWeavers.xml b/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection.Application.Contracts/FodyWeavers.xml
new file mode 100644
index 000000000..1715698cc
--- /dev/null
+++ b/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection.Application.Contracts/FodyWeavers.xml
@@ -0,0 +1,3 @@
+
+
+
\ No newline at end of file
diff --git a/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection.Application.Contracts/LINGYUN.Abp.DataProtection.Application.Contracts.csproj b/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection.Application.Contracts/LINGYUN.Abp.DataProtection.Application.Contracts.csproj
new file mode 100644
index 000000000..5fb9d1dc9
--- /dev/null
+++ b/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection.Application.Contracts/LINGYUN.Abp.DataProtection.Application.Contracts.csproj
@@ -0,0 +1,24 @@
+
+
+
+
+
+
+ netstandard2.0;netstandard2.1;net8.0;net9.0
+ LINGYUN.Abp.DataProtection.Application.Contracts
+ LINGYUN.Abp.DataProtection.Application.Contracts
+ false
+ false
+ false
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection.Application.Contracts/LINGYUN/Abp/DataProtection/AbpDataProtectionApplicationContractsModule.cs b/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection.Application.Contracts/LINGYUN/Abp/DataProtection/AbpDataProtectionApplicationContractsModule.cs
new file mode 100644
index 000000000..c15e35b94
--- /dev/null
+++ b/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection.Application.Contracts/LINGYUN/Abp/DataProtection/AbpDataProtectionApplicationContractsModule.cs
@@ -0,0 +1,12 @@
+using Volo.Abp.Application;
+using Volo.Abp.Modularity;
+
+namespace LINGYUN.Abp.DataProtection;
+
+[DependsOn(
+ typeof(AbpDataProtectionAbstractionsModule),
+ typeof(AbpDddApplicationContractsModule))]
+public class AbpDataProtectionApplicationContractsModule : AbpModule
+{
+
+}
diff --git a/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection.Application.Contracts/LINGYUN/Abp/DataProtection/EntityEnumInfoDto.cs b/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection.Application.Contracts/LINGYUN/Abp/DataProtection/EntityEnumInfoDto.cs
new file mode 100644
index 000000000..58d981ca3
--- /dev/null
+++ b/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection.Application.Contracts/LINGYUN/Abp/DataProtection/EntityEnumInfoDto.cs
@@ -0,0 +1,7 @@
+namespace LINGYUN.Abp.DataProtection;
+
+public class EntityEnumInfoDto
+{
+ public string Key { get; set; }
+ public object Value { get; set; }
+}
diff --git a/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection.Application.Contracts/LINGYUN/Abp/DataProtection/EntityPropertyInfoDto.cs b/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection.Application.Contracts/LINGYUN/Abp/DataProtection/EntityPropertyInfoDto.cs
new file mode 100644
index 000000000..74af75176
--- /dev/null
+++ b/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection.Application.Contracts/LINGYUN/Abp/DataProtection/EntityPropertyInfoDto.cs
@@ -0,0 +1,29 @@
+namespace LINGYUN.Abp.DataProtection;
+
+public class EntityPropertyInfoDto
+{
+ ///
+ /// 名称
+ ///
+ public string Name { get; set; }
+ ///
+ /// 显示名称
+ ///
+ public string DisplayName { get; set; }
+ ///
+ /// 类型全名
+ ///
+ public string TypeFullName { get; set; }
+ ///
+ /// JavaScript类型
+ ///
+ public string JavaScriptType { get; set; }
+ ///
+ /// 枚举列表
+ ///
+ public EntityEnumInfoDto[] Enums { get; set; } = new EntityEnumInfoDto[0];
+ ///
+ /// 允许的过滤操作列表
+ ///
+ public DataAccessFilterOperate[] Operates { get; set; }
+}
diff --git a/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection.Application.Contracts/LINGYUN/Abp/DataProtection/EntityTypeInfoDto.cs b/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection.Application.Contracts/LINGYUN/Abp/DataProtection/EntityTypeInfoDto.cs
new file mode 100644
index 000000000..faf3f2937
--- /dev/null
+++ b/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection.Application.Contracts/LINGYUN/Abp/DataProtection/EntityTypeInfoDto.cs
@@ -0,0 +1,17 @@
+namespace LINGYUN.Abp.DataProtection;
+
+public class EntityTypeInfoDto
+{
+ ///
+ /// 实体名称
+ ///
+ public string Name { get; set; }
+ ///
+ /// 显示名称
+ ///
+ public string DisplayName { get; set; }
+ ///
+ /// 可访问属性列表
+ ///
+ public EntityPropertyInfoDto[] Properties { get; set; } = new EntityPropertyInfoDto[0];
+}
diff --git a/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection.Application.Contracts/LINGYUN/Abp/DataProtection/EntityTypeInfoGetInput.cs b/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection.Application.Contracts/LINGYUN/Abp/DataProtection/EntityTypeInfoGetInput.cs
new file mode 100644
index 000000000..c6653682e
--- /dev/null
+++ b/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection.Application.Contracts/LINGYUN/Abp/DataProtection/EntityTypeInfoGetInput.cs
@@ -0,0 +1,6 @@
+namespace LINGYUN.Abp.DataProtection;
+
+public class EntityTypeInfoGetInput
+{
+ public DataAccessOperation Operation { get; set; }
+}
diff --git a/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection.Application.Contracts/LINGYUN/Abp/DataProtection/IEntityTypeInfoAppService.cs b/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection.Application.Contracts/LINGYUN/Abp/DataProtection/IEntityTypeInfoAppService.cs
new file mode 100644
index 000000000..4ac0b4fc5
--- /dev/null
+++ b/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection.Application.Contracts/LINGYUN/Abp/DataProtection/IEntityTypeInfoAppService.cs
@@ -0,0 +1,14 @@
+using System.Threading.Tasks;
+using Volo.Abp.Application.Services;
+
+namespace LINGYUN.Abp.DataProtection;
+
+public interface IEntityTypeInfoAppService : IApplicationService
+{
+ ///
+ /// 获取实体可访问规则
+ ///
+ ///
+ ///
+ Task GetEntityRuleAsync(EntityTypeInfoGetInput input);
+}
diff --git a/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection.Application/FodyWeavers.xml b/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection.Application/FodyWeavers.xml
new file mode 100644
index 000000000..1715698cc
--- /dev/null
+++ b/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection.Application/FodyWeavers.xml
@@ -0,0 +1,3 @@
+
+
+
\ No newline at end of file
diff --git a/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection.Application/LINGYUN.Abp.DataProtection.Application.csproj b/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection.Application/LINGYUN.Abp.DataProtection.Application.csproj
new file mode 100644
index 000000000..632de70bd
--- /dev/null
+++ b/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection.Application/LINGYUN.Abp.DataProtection.Application.csproj
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+ netstandard2.0;netstandard2.1;net8.0;net9.0
+ LINGYUN.Abp.DataProtection.Application
+ LINGYUN.Abp.DataProtection.Application
+ false
+ false
+ false
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection.Application/LINGYUN/Abp/DataProtection/AbpDataProtectionApplicationModule.cs b/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection.Application/LINGYUN/Abp/DataProtection/AbpDataProtectionApplicationModule.cs
new file mode 100644
index 000000000..f5bcff996
--- /dev/null
+++ b/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection.Application/LINGYUN/Abp/DataProtection/AbpDataProtectionApplicationModule.cs
@@ -0,0 +1,13 @@
+using Volo.Abp.Application;
+using Volo.Abp.Modularity;
+
+namespace LINGYUN.Abp.DataProtection;
+
+[DependsOn(
+ typeof(AbpDataProtectionApplicationContractsModule),
+ typeof(AbpDataProtectionModule),
+ typeof(AbpDddApplicationModule))]
+public class AbpDataProtectionApplicationModule : AbpModule
+{
+
+}
diff --git a/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection.Application/LINGYUN/Abp/DataProtection/EntityTypeInfoAppService.cs b/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection.Application/LINGYUN/Abp/DataProtection/EntityTypeInfoAppService.cs
new file mode 100644
index 000000000..393c9b345
--- /dev/null
+++ b/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection.Application/LINGYUN/Abp/DataProtection/EntityTypeInfoAppService.cs
@@ -0,0 +1,47 @@
+using Microsoft.AspNetCore.Authorization;
+using Microsoft.Extensions.DependencyInjection;
+using System.Linq;
+using System.Threading.Tasks;
+using Volo.Abp.Application.Services;
+using Volo.Abp.Localization;
+
+namespace LINGYUN.Abp.DataProtection;
+
+public abstract class EntityTypeInfoAppService : ApplicationService, IEntityTypeInfoAppService
+{
+ protected IDataAccessEntityTypeInfoProvider EntityTypeInfoProvider => LazyServiceProvider.GetRequiredService();
+
+ [Authorize]
+ public virtual async Task GetEntityRuleAsync(EntityTypeInfoGetInput input)
+ {
+ var entityType = typeof(TEntity);
+ var resourceType = LocalizationResource ?? typeof(DefaultResource);
+
+ var context = new DataAccessEntitTypeInfoContext(
+ entityType,
+ resourceType,
+ input.Operation,
+ LazyServiceProvider);
+
+ var model = await EntityTypeInfoProvider.GetEntitTypeInfoAsync(context);
+
+ return new EntityTypeInfoDto
+ {
+ Name = model.Name,
+ DisplayName = model.DisplayName,
+ Properties = model.Properties.Select(prop => new EntityPropertyInfoDto
+ {
+ Name = prop.Name,
+ DisplayName = prop.DisplayName,
+ TypeFullName = prop.TypeFullName,
+ JavaScriptType = prop.JavaScriptType,
+ Operates = prop.Operates,
+ Enums = prop.Enums.Select(em => new EntityEnumInfoDto
+ {
+ Key = em.Key,
+ Value = em.Value,
+ }).ToArray()
+ }).ToArray(),
+ };
+ }
+}
diff --git a/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection.Application/System/NullableTypeExtensions.cs b/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection.Application/System/NullableTypeExtensions.cs
new file mode 100644
index 000000000..1d650f831
--- /dev/null
+++ b/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection.Application/System/NullableTypeExtensions.cs
@@ -0,0 +1,10 @@
+namespace System;
+
+internal static class NullableTypeExtensions
+{
+ public static bool IsNullableType(this Type theType) =>
+ theType.IsGenericType(typeof(Nullable<>));
+
+ public static bool IsGenericType(this Type type, Type genericType) =>
+ type.IsGenericType && type.GetGenericTypeDefinition() == genericType;
+}
diff --git a/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection.EntityFrameworkCore/LINGYUN/Abp/DataProtection/EntityFrameworkCore/AbpDataProtectedReadEntityInterceptor.cs b/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection.EntityFrameworkCore/LINGYUN/Abp/DataProtection/EntityFrameworkCore/AbpDataProtectedReadEntityInterceptor.cs
deleted file mode 100644
index b1f3e5b5f..000000000
--- a/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection.EntityFrameworkCore/LINGYUN/Abp/DataProtection/EntityFrameworkCore/AbpDataProtectedReadEntityInterceptor.cs
+++ /dev/null
@@ -1,64 +0,0 @@
-using Microsoft.EntityFrameworkCore.Diagnostics;
-using Microsoft.Extensions.Options;
-using System;
-using System.Linq;
-using System.Linq.Expressions;
-using System.Reflection;
-using Volo.Abp.Data;
-using Volo.Abp.DependencyInjection;
-using Volo.Abp.Domain.Entities;
-using Volo.Abp.Users;
-
-namespace LINGYUN.Abp.DataProtection.EntityFrameworkCore;
-public class AbpDataProtectedReadEntityInterceptor : IQueryExpressionInterceptor, ITransientDependency
-{
- public IAbpLazyServiceProvider LazyServiceProvider { get; set; } = default!;
- public IOptions DataProtectionOptions => LazyServiceProvider.LazyGetRequiredService>();
- public ICurrentUser CurrentUser => LazyServiceProvider.LazyGetRequiredService();
- public IDataFilter DataFilter => LazyServiceProvider.LazyGetRequiredService();
- public IEntityTypeFilterBuilder EntityTypeFilterBuilder => LazyServiceProvider.LazyGetRequiredService();
-
- private static readonly MethodInfo WhereMethodInfo = typeof(Queryable).GetMethods().First(m => m.Name == nameof(Queryable.Where));
-
- public Expression QueryCompilationStarting(Expression queryExpression, QueryExpressionEventData eventData)
- {
- if (DataFilter.IsEnabled() && queryExpression.Type.GenericTypeArguments.Length > 0)
- {
- var entityType = queryExpression.Type.GenericTypeArguments[0];
- var exp = EntityTypeFilterBuilder.Build(entityType, DataAccessOperation.Read);
-
- return Expression.Call(
- method: WhereMethodInfo.MakeGenericMethod(entityType),
- arg0: queryExpression,
- arg1: exp);
- }
-
- return queryExpression;
- }
-
- public class DataProtectedExpressionVisitor : ExpressionVisitor
- {
- private readonly Type _entityType;
- private readonly IEntityTypeFilterBuilder _entityTypeFilterBuilder;
-
- public DataProtectedExpressionVisitor(Type entityType, IEntityTypeFilterBuilder entityTypeFilterBuilder)
- {
- _entityType = entityType;
- _entityTypeFilterBuilder = entityTypeFilterBuilder;
- }
-
- private static readonly MethodInfo WhereMethodInfo = typeof(Queryable).GetMethods().First(m => m.Name == nameof(Queryable.Where));
-
- protected override Expression VisitMethodCall(MethodCallExpression methodCallExpression)
- {
- var method = WhereMethodInfo.MakeGenericMethod(_entityType);
- var args0 = base.VisitMethodCall(methodCallExpression);
- var args1 = _entityTypeFilterBuilder.Build(_entityType, DataAccessOperation.Read);
-
- return Expression.Call(
- method: method,
- arg0: args0,
- arg1: args1);
- }
- }
-}
diff --git a/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection.EntityFrameworkCore/LINGYUN/Abp/DataProtection/EntityFrameworkCore/AbpDataProtectedWritePropertiesInterceptor.cs b/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection.EntityFrameworkCore/LINGYUN/Abp/DataProtection/EntityFrameworkCore/AbpDataProtectedWritePropertiesInterceptor.cs
index fd64ab0c5..b375afc9c 100644
--- a/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection.EntityFrameworkCore/LINGYUN/Abp/DataProtection/EntityFrameworkCore/AbpDataProtectedWritePropertiesInterceptor.cs
+++ b/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection.EntityFrameworkCore/LINGYUN/Abp/DataProtection/EntityFrameworkCore/AbpDataProtectedWritePropertiesInterceptor.cs
@@ -28,14 +28,20 @@ public class AbpDataProtectedWritePropertiesInterceptor : SaveChangesInterceptor
{
var allowProperties = new List();
var entity = entry.Entity;
- var subjectContext = new DataAccessSubjectContributorContext(entity.GetType().FullName, DataAccessOperation.Write, LazyServiceProvider);
+ var entityType = entry.Entity.GetType();
+ var subjectContext = new DataAccessSubjectContributorContext(entityType.FullName, DataAccessOperation.Write, LazyServiceProvider);
foreach (var contributor in DataProtectionOptions.Value.SubjectContributors)
{
- var properties = contributor.GetAllowProperties(subjectContext);
+ var properties = await contributor.GetAccessdProperties(subjectContext);
allowProperties.AddIfNotContains(properties);
}
- allowProperties.AddIfNotContains(DataProtectionOptions.Value.IgnoreAuditedProperties);
+ if (DataProtectionOptions.Value.EntityIgnoreProperties.TryGetValue(entityType, out var entityIgnoreProps))
+ {
+ allowProperties.AddIfNotContains(entityIgnoreProps);
+ }
+
+ allowProperties.AddIfNotContains(DataProtectionOptions.Value.GlobalIgnoreProperties);
foreach (var property in entry.Properties)
{
diff --git a/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection.EntityFrameworkCore/LINGYUN/Abp/DataProtection/EntityFrameworkCore/AbpDataProtectionDbContext.cs b/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection.EntityFrameworkCore/LINGYUN/Abp/DataProtection/EntityFrameworkCore/AbpDataProtectionDbContext.cs
index 0a1517128..3b9d309a6 100644
--- a/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection.EntityFrameworkCore/LINGYUN/Abp/DataProtection/EntityFrameworkCore/AbpDataProtectionDbContext.cs
+++ b/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection.EntityFrameworkCore/LINGYUN/Abp/DataProtection/EntityFrameworkCore/AbpDataProtectionDbContext.cs
@@ -27,7 +27,6 @@ public abstract class AbpDataProtectionDbContext : AbpDbContext());
//optionsBuilder.AddInterceptors(LazyServiceProvider.GetRequiredService());
optionsBuilder.AddInterceptors(LazyServiceProvider.GetRequiredService());
}
diff --git a/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection.EntityFrameworkCore/LINGYUN/Abp/DataProtection/EntityFrameworkCore/EfCoreDataProtectionRepository.cs b/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection.EntityFrameworkCore/LINGYUN/Abp/DataProtection/EntityFrameworkCore/EfCoreDataProtectionRepository.cs
index b8617070c..7a002be8c 100644
--- a/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection.EntityFrameworkCore/LINGYUN/Abp/DataProtection/EntityFrameworkCore/EfCoreDataProtectionRepository.cs
+++ b/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection.EntityFrameworkCore/LINGYUN/Abp/DataProtection/EntityFrameworkCore/EfCoreDataProtectionRepository.cs
@@ -21,23 +21,28 @@ public abstract class EfCoreDataProtectionRepository
{
private readonly IDataAuthorizationService _dataAuthorizationService;
private readonly IEntityTypeFilterBuilder _entityTypeFilterBuilder;
+ private readonly IEntityPropertyResultBuilder _entityPropertyResultBuilder;
protected EfCoreDataProtectionRepository(
[NotNull] IDbContextProvider dbContextProvider,
[NotNull] IDataAuthorizationService dataAuthorizationService,
- [NotNull] IEntityTypeFilterBuilder entityTypeFilterBuilder)
+ [NotNull] IEntityTypeFilterBuilder entityTypeFilterBuilder,
+ [NotNull] IEntityPropertyResultBuilder entityPropertyResultBuilder)
: base(dbContextProvider)
{
_dataAuthorizationService = dataAuthorizationService;
_entityTypeFilterBuilder = entityTypeFilterBuilder;
+ _entityPropertyResultBuilder = entityPropertyResultBuilder;
}
public async override Task> GetQueryableAsync()
{
var queryable = await base.GetQueryableAsync();
- var dataAccessFilterExp = _entityTypeFilterBuilder.Build(DataAccessOperation.Read);
- queryable = queryable.Where(dataAccessFilterExp);
+ var dataAccessFilterExp = await _entityTypeFilterBuilder.Build(DataAccessOperation.Read);
+ var accessFieldExp = await _entityPropertyResultBuilder.Build(DataAccessOperation.Read);
+
+ queryable = queryable.Where(dataAccessFilterExp).Select(accessFieldExp);
return queryable;
}
@@ -91,23 +96,28 @@ public abstract class EfCoreDataProtectionRepository : EfCo
{
private readonly IDataAuthorizationService _dataAuthorizationService;
private readonly IEntityTypeFilterBuilder _entityTypeFilterBuilder;
+ private readonly IEntityPropertyResultBuilder _entityPropertyResultBuilder;
protected EfCoreDataProtectionRepository(
[NotNull] IDbContextProvider dbContextProvider,
[NotNull] IDataAuthorizationService dataAuthorizationService,
- [NotNull] IEntityTypeFilterBuilder entityTypeFilterBuilder)
+ [NotNull] IEntityTypeFilterBuilder entityTypeFilterBuilder,
+ [NotNull] IEntityPropertyResultBuilder entityPropertyResultBuilder)
: base(dbContextProvider)
{
_dataAuthorizationService = dataAuthorizationService;
_entityTypeFilterBuilder = entityTypeFilterBuilder;
+ _entityPropertyResultBuilder = entityPropertyResultBuilder;
}
public async override Task> GetQueryableAsync()
{
var queryable = await base.GetQueryableAsync();
- var dataAccessFilterExp = _entityTypeFilterBuilder.Build(DataAccessOperation.Read);
- queryable = queryable.Where(dataAccessFilterExp);
+ var dataAccessFilterExp = await _entityTypeFilterBuilder.Build(DataAccessOperation.Read);
+ var accessFieldExp = await _entityPropertyResultBuilder.Build(DataAccessOperation.Read);
+
+ queryable = queryable.Where(dataAccessFilterExp).Select(accessFieldExp);
return queryable;
}
diff --git a/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection/LINGYUN/Abp/DataProtection/AbpDataProtectionOptions.cs b/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection/LINGYUN/Abp/DataProtection/AbpDataProtectionOptions.cs
index a27a4f65d..90bd5c877 100644
--- a/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection/LINGYUN/Abp/DataProtection/AbpDataProtectionOptions.cs
+++ b/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection/LINGYUN/Abp/DataProtection/AbpDataProtectionOptions.cs
@@ -31,9 +31,17 @@ public class AbpDataProtectionOptions
///
public IDictionary> DefaultEntityFilters { get; }
///
- /// 忽略审计字段列表
+ /// 实体忽略字段
///
- public IList IgnoreAuditedProperties { get; set; }
+ public IDictionary EntityIgnoreProperties { get; }
+ ///
+ /// 全局忽略字段列表(不参与字段级权限校验)
+ ///
+ public IList GlobalIgnoreProperties { get; set; }
+ ///
+ /// 审计字段列表(这些字段写入受保护实体的属性列表中,用于前端过滤)
+ ///
+ public IList AuditedObjectProperties { get; set; }
public AbpDataProtectionOptions()
{
IsEnabled = true;
@@ -41,8 +49,9 @@ public class AbpDataProtectionOptions
KeywordContributors = new Dictionary();
OperateContributors = new Dictionary();
DefaultEntityFilters = new Dictionary>();
+ EntityIgnoreProperties = new Dictionary();
- IgnoreAuditedProperties = new List
+ GlobalIgnoreProperties = new List
{
nameof(IEntity.Id),
nameof(IAuditedObject.LastModifierId),
@@ -57,5 +66,13 @@ public class AbpDataProtectionOptions
nameof(IHasConcurrencyStamp.ConcurrencyStamp),
nameof(IHasExtraProperties.ExtraProperties),
};
+
+ AuditedObjectProperties = new List
+ {
+ nameof(IAuditedObject.LastModifierId),
+ nameof(IAuditedObject.LastModificationTime),
+ nameof(IAuditedObject.CreatorId),
+ nameof(IAuditedObject.CreationTime),
+ };
}
}
diff --git a/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection/LINGYUN/Abp/DataProtection/DataAccessEntitTypeInfoContext.cs b/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection/LINGYUN/Abp/DataProtection/DataAccessEntitTypeInfoContext.cs
new file mode 100644
index 000000000..0b215563b
--- /dev/null
+++ b/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection/LINGYUN/Abp/DataProtection/DataAccessEntitTypeInfoContext.cs
@@ -0,0 +1,22 @@
+using System;
+
+namespace LINGYUN.Abp.DataProtection;
+
+public class DataAccessEntitTypeInfoContext
+{
+ public Type EntityType { get; }
+ public Type ResourceType { get; }
+ public DataAccessOperation Operation { get; }
+ public IServiceProvider ServiceProvider { get; }
+ public DataAccessEntitTypeInfoContext(
+ Type entityType,
+ Type resourceType,
+ DataAccessOperation operation,
+ IServiceProvider serviceProvider)
+ {
+ EntityType = entityType;
+ ResourceType = resourceType;
+ Operation = operation;
+ ServiceProvider = serviceProvider;
+ }
+}
diff --git a/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection/LINGYUN/Abp/DataProtection/DataAccessEntityTypeInfoProvider.cs b/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection/LINGYUN/Abp/DataProtection/DataAccessEntityTypeInfoProvider.cs
new file mode 100644
index 000000000..7d283e80c
--- /dev/null
+++ b/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection/LINGYUN/Abp/DataProtection/DataAccessEntityTypeInfoProvider.cs
@@ -0,0 +1,103 @@
+using LINGYUN.Abp.DataProtection.Models;
+using Microsoft.Extensions.DependencyInjection;
+using Microsoft.Extensions.Localization;
+using Microsoft.Extensions.Options;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Reflection;
+using System.Threading.Tasks;
+using Volo.Abp.DependencyInjection;
+
+namespace LINGYUN.Abp.DataProtection;
+
+public class DataAccessEntityTypeInfoProvider : IDataAccessEntityTypeInfoProvider, ISingletonDependency
+{
+ public async virtual Task GetEntitTypeInfoAsync(DataAccessEntitTypeInfoContext context)
+ {
+ var allowProperties = new List();
+
+ var dataProtectionOptions = context.ServiceProvider.GetRequiredService>().Value;
+ var javaScriptTypeConvert = context.ServiceProvider.GetRequiredService();
+ var localizerFactory = context.ServiceProvider.GetRequiredService();
+ var stringLozalizer = localizerFactory.Create(context.ResourceType);
+
+ var entityTypeRuleModel = new EntityTypeInfoModel
+ {
+ Name = context.EntityType.Name,
+ DisplayName = stringLozalizer[$"DisplayName:{context.EntityType.Name}"].Value ?? context.EntityType.Name
+ };
+
+ var subjectContext = new DataAccessSubjectContributorContext(
+ context.EntityType.FullName,
+ context.Operation,
+ context.ServiceProvider);
+
+ foreach (var subjectContributor in dataProtectionOptions.SubjectContributors)
+ {
+ var subjectAllowProperties = await subjectContributor.GetAccessdProperties(subjectContext);
+
+ allowProperties.AddIfNotContains(subjectAllowProperties);
+ }
+
+ IEnumerable entityPropeties = context.EntityType.GetProperties();
+
+ if (allowProperties.Count > 0)
+ {
+ if (dataProtectionOptions.EntityIgnoreProperties.TryGetValue(context.EntityType, out var entityIgnoreProps))
+ {
+ allowProperties.AddIfNotContains(entityIgnoreProps);
+ }
+
+ allowProperties.AddIfNotContains(dataProtectionOptions.GlobalIgnoreProperties);
+
+ entityPropeties = entityPropeties.Where(x => allowProperties.Contains(x.Name));
+ }
+
+ foreach (var propertyInfo in entityPropeties)
+ {
+ // 字段本地化描述规则
+ // 在本地化文件中定义 DisplayName:PropertyName
+ var localizedProp = stringLozalizer[$"DisplayName:{propertyInfo.Name}"];
+ var propertyInfoResult = javaScriptTypeConvert.Convert(propertyInfo.PropertyType);
+ var entityPropertyInfo = new EntityPropertyInfoModel
+ {
+ Name = propertyInfo.Name,
+ TypeFullName = propertyInfo.PropertyType.FullName,
+ DisplayName = localizedProp.Value ?? propertyInfo.Name,
+ JavaScriptType = propertyInfoResult.Type,
+ JavaScriptName = propertyInfo.Name.ToCamelCase(),
+ Operates = propertyInfoResult.AllowOperates
+ };
+
+ var propertyType = propertyInfo.PropertyType;
+ if (propertyType.IsNullableType())
+ {
+ propertyType = propertyType.GetGenericArguments().FirstOrDefault();
+ }
+
+ if (typeof(Enum).IsAssignableFrom(propertyType))
+ {
+ var enumNames = Enum.GetNames(propertyType);
+ var enumValues = Enum.GetValues(propertyType);
+ var paramterOptions = new EntityEnumInfoModel[enumNames.Length];
+ for (var index = 0; index < enumNames.Length; index++)
+ {
+ var enumName = enumNames[index];
+ var localizerEnumKey = $"{propertyInfo.Name}:{enumName}";
+ var localizerEnumName = stringLozalizer[localizerEnumKey];
+ paramterOptions[index] = new EntityEnumInfoModel
+ {
+ Key = localizerEnumName.ResourceNotFound ? enumName : localizerEnumName.Value,
+ Value = enumValues.GetValue(index),
+ };
+ }
+ entityPropertyInfo.Enums = paramterOptions;
+ }
+
+ entityTypeRuleModel.Properties.Add(entityPropertyInfo);
+ }
+
+ return entityTypeRuleModel;
+ }
+}
diff --git a/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection/LINGYUN/Abp/DataProtection/DataAccessResourceCacheInvalidator.cs b/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection/LINGYUN/Abp/DataProtection/DataAccessResourceCacheInvalidator.cs
new file mode 100644
index 000000000..58050d9f9
--- /dev/null
+++ b/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection/LINGYUN/Abp/DataProtection/DataAccessResourceCacheInvalidator.cs
@@ -0,0 +1,18 @@
+using System.Threading.Tasks;
+using Volo.Abp.DependencyInjection;
+using Volo.Abp.EventBus.Distributed;
+
+namespace LINGYUN.Abp.DataProtection;
+
+public class DataAccessResourceCacheInvalidator : IDistributedEventHandler, ITransientDependency
+{
+ private readonly IDataProtectedResourceStore _resourceStore;
+ public DataAccessResourceCacheInvalidator(IDataProtectedResourceStore resourceStore)
+ {
+ _resourceStore = resourceStore;
+ }
+ public async virtual Task HandleEventAsync(DataAccessResourceChangeEvent eventData)
+ {
+ await _resourceStore.SetAsync(eventData.Resource);
+ }
+}
diff --git a/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection/LINGYUN/Abp/DataProtection/DataAuthorizationService.cs b/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection/LINGYUN/Abp/DataProtection/DataAuthorizationService.cs
index cda1d8878..15e9723c7 100644
--- a/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection/LINGYUN/Abp/DataProtection/DataAuthorizationService.cs
+++ b/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection/LINGYUN/Abp/DataProtection/DataAuthorizationService.cs
@@ -17,15 +17,15 @@ public class DataAuthorizationService : IDataAuthorizationService, ITransientDep
_entityTypeFilterBuilder = entityTypeFilterBuilder;
}
- public virtual Task AuthorizeAsync(DataAccessOperation operation, IEnumerable entities)
+ public async virtual Task AuthorizeAsync(DataAccessOperation operation, IEnumerable entities)
{
if (!entities.Any())
{
- return Task.FromResult(AuthorizationResult.Success());
+ return AuthorizationResult.Success();
}
- var exp = _entityTypeFilterBuilder.Build(operation);
+ var exp = await _entityTypeFilterBuilder.Build(operation);
- return Task.FromResult(entities.All(exp.Compile()) ? AuthorizationResult.Success() : AuthorizationResult.Failed());
+ return entities.All(exp.Compile()) ? AuthorizationResult.Success() : AuthorizationResult.Failed();
}
}
\ No newline at end of file
diff --git a/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection/LINGYUN/Abp/DataProtection/DataProtectedInterceptor.cs b/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection/LINGYUN/Abp/DataProtection/DataProtectedInterceptor.cs
index 850796ee4..679e43a7a 100644
--- a/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection/LINGYUN/Abp/DataProtection/DataProtectedInterceptor.cs
+++ b/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection/LINGYUN/Abp/DataProtection/DataProtectedInterceptor.cs
@@ -38,6 +38,7 @@ public class DataProtectedInterceptor : AbpInterceptor, ITransientDependency
return true;
}
+ // TODO: 使用一个范围标志来确定当前需要禁用的数据权限操作
if (invocation.Method.IsDefined(typeof(DisableDataProtectedAttribute), true))
{
return true;
diff --git a/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection/LINGYUN/Abp/DataProtection/EntityPropertyResultBuilder.cs b/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection/LINGYUN/Abp/DataProtection/EntityPropertyResultBuilder.cs
index 31fb45cdb..8689bcd3d 100644
--- a/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection/LINGYUN/Abp/DataProtection/EntityPropertyResultBuilder.cs
+++ b/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection/LINGYUN/Abp/DataProtection/EntityPropertyResultBuilder.cs
@@ -5,12 +5,8 @@ using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using System.Threading.Tasks;
-using Volo.Abp;
-using Volo.Abp.Auditing;
using Volo.Abp.Data;
using Volo.Abp.DependencyInjection;
-using Volo.Abp.Domain.Entities;
-using Volo.Abp.MultiTenancy;
namespace LINGYUN.Abp.DataProtection;
public class EntityPropertyResultBuilder : IEntityPropertyResultBuilder, ITransientDependency
@@ -29,7 +25,7 @@ public class EntityPropertyResultBuilder : IEntityPropertyResultBuilder, ITransi
_serviceProvider = serviceProvider;
}
- public virtual LambdaExpression Build(Type entityType, DataAccessOperation operation)
+ public async virtual Task Build(Type entityType, DataAccessOperation operation)
{
// Func
var func = typeof(Func<,>).MakeGenericType(entityType, entityType);
@@ -45,18 +41,23 @@ public class EntityPropertyResultBuilder : IEntityPropertyResultBuilder, ITransi
var subjectContext = new DataAccessSubjectContributorContext(typeName, operation, _serviceProvider);
foreach (var contributor in _options.SubjectContributors)
{
- var properties = contributor.GetAllowProperties(subjectContext);
+ var properties = await contributor.GetAccessdProperties(subjectContext);
allowProperties.AddIfNotContains(properties);
}
-
- // 默认实体相关标识需要带上, 否则无法返回查询结果
- allowProperties.AddIfNotContains(_options.IgnoreAuditedProperties);
-
+
if (!allowProperties.Any())
{
return selector;
}
+ if (_options.EntityIgnoreProperties.TryGetValue(entityType, out var entityIgnoreProps))
+ {
+ allowProperties.AddIfNotContains(entityIgnoreProps);
+ }
+
+ // 默认实体相关标识需要带上, 否则无法返回查询结果
+ allowProperties.AddIfNotContains(_options.GlobalIgnoreProperties);
+
var memberBindings = new List();
foreach (var propertyName in allowProperties)
{
@@ -73,7 +74,7 @@ public class EntityPropertyResultBuilder : IEntityPropertyResultBuilder, ITransi
return Expression.Lambda(func, memberInitExpression, param);
}
- public virtual Expression> Build(DataAccessOperation operation)
+ public async virtual Task>> Build(DataAccessOperation operation)
{
var entityType = typeof(TEntity);
Expression> selector = e => e;
@@ -88,18 +89,23 @@ public class EntityPropertyResultBuilder : IEntityPropertyResultBuilder, ITransi
var subjectContext = new DataAccessSubjectContributorContext(typeName, operation, _serviceProvider);
foreach (var contributor in _options.SubjectContributors)
{
- var properties = contributor.GetAllowProperties(subjectContext);
+ var properties = await contributor.GetAccessdProperties(subjectContext);
allowProperties.AddIfNotContains(properties);
}
-
- // 默认实体相关标识需要带上, 否则无法返回查询结果
- allowProperties.AddIfNotContains(_options.IgnoreAuditedProperties);
-
+
if (!allowProperties.Any())
{
return selector;
}
+ if (_options.EntityIgnoreProperties.TryGetValue(entityType, out var entityIgnoreProps))
+ {
+ allowProperties.AddIfNotContains(entityIgnoreProps);
+ }
+
+ // 默认实体相关标识需要带上, 否则无法返回查询结果
+ allowProperties.AddIfNotContains(_options.GlobalIgnoreProperties);
+
var param = Expression.Parameter(typeof(TEntity), "e");
var memberBindings = new List();
foreach (var propertyName in allowProperties)
@@ -119,13 +125,20 @@ public class EntityPropertyResultBuilder : IEntityPropertyResultBuilder, ITransi
private bool ShouldApplyFilter(Type entityType, DataAccessOperation operation)
{
+ // TODO: 使用一个范围标志来确定当前需要禁用的数据权限操作
if (!_dataFilter.IsEnabled())
{
return false;
}
- if (entityType.IsDefined(typeof(DisableDataProtectedAttribute), true))
+ var disableAttr = entityType.GetCustomAttribute();
+ if (disableAttr != null)
{
+ if (disableAttr.Operation.HasValue && disableAttr.Operation != operation)
+ {
+ return true;
+ }
+
return false;
}
diff --git a/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection/LINGYUN/Abp/DataProtection/EntityTypeFilterBuilder.cs b/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection/LINGYUN/Abp/DataProtection/EntityTypeFilterBuilder.cs
index 0d5e358ff..1351f63a1 100644
--- a/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection/LINGYUN/Abp/DataProtection/EntityTypeFilterBuilder.cs
+++ b/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection/LINGYUN/Abp/DataProtection/EntityTypeFilterBuilder.cs
@@ -7,7 +7,7 @@ using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using System.Text.Json;
-using System.Text.Json.Nodes;
+using System.Threading.Tasks;
using Volo.Abp;
using Volo.Abp.Data;
using Volo.Abp.DependencyInjection;
@@ -30,7 +30,7 @@ public class EntityTypeFilterBuilder : IEntityTypeFilterBuilder, ITransientDepen
_serviceProvider = serviceProvider;
}
- public virtual LambdaExpression Build(Type entityType, DataAccessOperation operation, DataAccessFilterGroup group = null)
+ public async virtual Task Build(Type entityType, DataAccessOperation operation, DataAccessFilterGroup group = null)
{
// Func
var func = typeof(Func<,>).MakeGenericType(entityType, typeof(bool));
@@ -56,7 +56,7 @@ public class EntityTypeFilterBuilder : IEntityTypeFilterBuilder, ITransientDepen
var subjectContext = new DataAccessSubjectContributorContext(typeName, operation, _serviceProvider);
foreach (var contributor in _options.SubjectContributors)
{
- var subjectFilterGroup = contributor.GetFilterGroups(subjectContext);
+ var subjectFilterGroup = await contributor.GetFilterGroups(subjectContext);
subjectFilterGroups.AddRange(subjectFilterGroup);
}
@@ -87,7 +87,7 @@ public class EntityTypeFilterBuilder : IEntityTypeFilterBuilder, ITransientDepen
return exp;
}
- public virtual Expression> Build(DataAccessOperation operation, DataAccessFilterGroup group = null)
+ public async virtual Task>> Build(DataAccessOperation operation, DataAccessFilterGroup group = null)
{
var entityType = typeof(TEntity);
Expression> exp = _ => true;
@@ -107,7 +107,7 @@ public class EntityTypeFilterBuilder : IEntityTypeFilterBuilder, ITransientDepen
var subjectContext = new DataAccessSubjectContributorContext(typeName, operation, _serviceProvider);
foreach (var contributor in _options.SubjectContributors)
{
- var subjectFilterGroup = contributor.GetFilterGroups(subjectContext);
+ var subjectFilterGroup = await contributor.GetFilterGroups(subjectContext);
subjectFilterGroups.AddRange(subjectFilterGroup);
}
@@ -284,13 +284,20 @@ public class EntityTypeFilterBuilder : IEntityTypeFilterBuilder, ITransientDepen
private bool ShouldApplyFilter(Type entityType, DataAccessOperation operation)
{
+ // TODO: 使用一个范围标志来确定当前需要禁用的数据权限操作
if (!_dataFilter.IsEnabled())
{
return false;
}
- if (entityType.IsDefined(typeof(DisableDataProtectedAttribute), true))
+ var disableAttr = entityType.GetCustomAttribute();
+ if (disableAttr != null)
{
+ if (disableAttr.Operation.HasValue && disableAttr.Operation != operation)
+ {
+ return true;
+ }
+
return false;
}
diff --git a/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection/LINGYUN/Abp/DataProtection/IDataAccessEntityTypeInfoProvider.cs b/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection/LINGYUN/Abp/DataProtection/IDataAccessEntityTypeInfoProvider.cs
new file mode 100644
index 000000000..1fbcfbd45
--- /dev/null
+++ b/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection/LINGYUN/Abp/DataProtection/IDataAccessEntityTypeInfoProvider.cs
@@ -0,0 +1,9 @@
+using LINGYUN.Abp.DataProtection.Models;
+using System.Threading.Tasks;
+
+namespace LINGYUN.Abp.DataProtection;
+
+public interface IDataAccessEntityTypeInfoProvider
+{
+ Task GetEntitTypeInfoAsync(DataAccessEntitTypeInfoContext context);
+}
diff --git a/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection/LINGYUN/Abp/DataProtection/IDataAccessSubjectContributor.cs b/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection/LINGYUN/Abp/DataProtection/IDataAccessSubjectContributor.cs
index 828c71cba..120141ee3 100644
--- a/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection/LINGYUN/Abp/DataProtection/IDataAccessSubjectContributor.cs
+++ b/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection/LINGYUN/Abp/DataProtection/IDataAccessSubjectContributor.cs
@@ -1,9 +1,10 @@
using System.Collections.Generic;
+using System.Threading.Tasks;
namespace LINGYUN.Abp.DataProtection;
public interface IDataAccessSubjectContributor
{
string Name { get; }
- List GetFilterGroups(DataAccessSubjectContributorContext context);
- List GetAllowProperties(DataAccessSubjectContributorContext context);
+ Task> GetFilterGroups(DataAccessSubjectContributorContext context);
+ Task> GetAccessdProperties(DataAccessSubjectContributorContext context);
}
diff --git a/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection/LINGYUN/Abp/DataProtection/IDataProtectedResourceStore.cs b/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection/LINGYUN/Abp/DataProtection/IDataProtectedResourceStore.cs
index b047482e9..b01b4f2c1 100644
--- a/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection/LINGYUN/Abp/DataProtection/IDataProtectedResourceStore.cs
+++ b/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection/LINGYUN/Abp/DataProtection/IDataProtectedResourceStore.cs
@@ -1,9 +1,11 @@
-namespace LINGYUN.Abp.DataProtection;
+using System.Threading.Tasks;
+
+namespace LINGYUN.Abp.DataProtection;
public interface IDataProtectedResourceStore
{
- void Set(DataAccessResource resource);
+ Task SetAsync(DataAccessResource resource);
- void Remove(DataAccessResource resource);
+ Task RemoveAsync(DataAccessResource resource);
- DataAccessResource Get(string subjectName, string subjectId, string entityTypeFullName, DataAccessOperation operation);
+ Task GetAsync(string subjectName, string subjectId, string entityTypeFullName, DataAccessOperation operation);
}
diff --git a/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection/LINGYUN/Abp/DataProtection/IEntityPropertyResultBuilder.cs b/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection/LINGYUN/Abp/DataProtection/IEntityPropertyResultBuilder.cs
index f80a72b30..2a4e4668c 100644
--- a/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection/LINGYUN/Abp/DataProtection/IEntityPropertyResultBuilder.cs
+++ b/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection/LINGYUN/Abp/DataProtection/IEntityPropertyResultBuilder.cs
@@ -1,5 +1,6 @@
using System;
using System.Linq.Expressions;
+using System.Threading.Tasks;
namespace LINGYUN.Abp.DataProtection;
///
@@ -13,12 +14,12 @@ public interface IEntityPropertyResultBuilder
/// 实体类型
/// 数据操作方式
///
- Expression> Build(DataAccessOperation operation);
+ Task>> Build(DataAccessOperation operation);
///
/// 获取实体的属性返回值过滤表达式
///
/// 实体类型
/// 数据操作方式
///
- LambdaExpression Build(Type entityType, DataAccessOperation operation);
+ Task Build(Type entityType, DataAccessOperation operation);
}
diff --git a/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection/LINGYUN/Abp/DataProtection/IEntityTypeFilterBuilder.cs b/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection/LINGYUN/Abp/DataProtection/IEntityTypeFilterBuilder.cs
index 01b54a625..897554635 100644
--- a/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection/LINGYUN/Abp/DataProtection/IEntityTypeFilterBuilder.cs
+++ b/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection/LINGYUN/Abp/DataProtection/IEntityTypeFilterBuilder.cs
@@ -1,5 +1,6 @@
using System;
using System.Linq.Expressions;
+using System.Threading.Tasks;
namespace LINGYUN.Abp.DataProtection;
///
@@ -14,7 +15,7 @@ public interface IEntityTypeFilterBuilder
/// 查询条件组
/// 实体类型
///
- Expression> Build(DataAccessOperation operation, DataAccessFilterGroup group = null);
+ Task>> Build(DataAccessOperation operation, DataAccessFilterGroup group = null);
- LambdaExpression Build(Type entityType, DataAccessOperation operation, DataAccessFilterGroup group = null);
+ Task Build(Type entityType, DataAccessOperation operation, DataAccessFilterGroup group = null);
}
\ No newline at end of file
diff --git a/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection/LINGYUN/Abp/DataProtection/IJavaScriptTypeConvert.cs b/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection/LINGYUN/Abp/DataProtection/IJavaScriptTypeConvert.cs
new file mode 100644
index 000000000..23d4866ba
--- /dev/null
+++ b/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection/LINGYUN/Abp/DataProtection/IJavaScriptTypeConvert.cs
@@ -0,0 +1,8 @@
+using System;
+
+namespace LINGYUN.Abp.DataProtection;
+
+public interface IJavaScriptTypeConvert
+{
+ JavaScriptTypeConvertResult Convert(Type propertyType);
+}
diff --git a/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection/LINGYUN/Abp/DataProtection/InMemoryDataProtectedResourceStore.cs b/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection/LINGYUN/Abp/DataProtection/InMemoryDataProtectedResourceStore.cs
index 91ad394dc..39b1c3149 100644
--- a/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection/LINGYUN/Abp/DataProtection/InMemoryDataProtectedResourceStore.cs
+++ b/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection/LINGYUN/Abp/DataProtection/InMemoryDataProtectedResourceStore.cs
@@ -1,5 +1,6 @@
using Microsoft.Extensions.DependencyInjection;
using System.Collections.Concurrent;
+using System.Threading.Tasks;
using Volo.Abp.DependencyInjection;
namespace LINGYUN.Abp.DataProtection;
@@ -34,4 +35,23 @@ public class InMemoryDataProtectedResourceStore : IDataProtectedResourceStore
{
return $"{subjectName}_{subjectId}_{entityTypeFullName}_{operation}";
}
+
+ public Task SetAsync(DataAccessResource resource)
+ {
+ Set(resource);
+
+ return Task.CompletedTask;
+ }
+
+ public Task RemoveAsync(DataAccessResource resource)
+ {
+ Remove(resource);
+
+ return Task.CompletedTask;
+ }
+
+ public Task GetAsync(string subjectName, string subjectId, string entityTypeFullName, DataAccessOperation operation)
+ {
+ return Task.FromResult(Get(subjectName, subjectId, entityTypeFullName, operation));
+ }
}
diff --git a/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection/LINGYUN/Abp/DataProtection/JavaScriptTypeConvert.cs b/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection/LINGYUN/Abp/DataProtection/JavaScriptTypeConvert.cs
new file mode 100644
index 000000000..f95b44fbf
--- /dev/null
+++ b/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection/LINGYUN/Abp/DataProtection/JavaScriptTypeConvert.cs
@@ -0,0 +1,132 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Reflection;
+using Volo.Abp.DependencyInjection;
+
+namespace LINGYUN.Abp.DataProtection;
+
+public class JavaScriptTypeConvert : IJavaScriptTypeConvert, ISingletonDependency
+{
+ public JavaScriptTypeConvertResult Convert(Type propertyType)
+ {
+ var (JavaScriptType, AccessOperates) = InnerConvert(propertyType);
+
+ return new JavaScriptTypeConvertResult(JavaScriptType, AccessOperates);
+ }
+
+ protected virtual (string JavaScriptType, DataAccessFilterOperate[] AccessFilterOperates) InnerConvert(Type propertyType)
+ {
+ var availableComparator = new List();
+ if (propertyType.IsNullableType())
+ {
+ propertyType = propertyType.GetGenericArguments().FirstOrDefault();
+ }
+
+ if (typeof(Enum).IsAssignableFrom(propertyType))
+ {
+ // 枚举类型只支持如下操作符
+ // 小于、小于等于、大于、大于等于、等于、不等于、空、非空
+ availableComparator.AddRange(new[]
+ {
+ DataAccessFilterOperate.Greater,
+ DataAccessFilterOperate.GreaterOrEqual,
+ DataAccessFilterOperate.Less,
+ DataAccessFilterOperate.LessOrEqual,
+ DataAccessFilterOperate.Equal,
+ DataAccessFilterOperate.NotEqual,
+ });
+ return ("number", availableComparator.ToArray());
+ }
+
+ var typeFullName = propertyType.FullName;
+
+ switch (typeFullName)
+ {
+ case "System.Int16":
+ case "System.Int32":
+ case "System.Int64":
+ case "System.UInt16":
+ case "System.UInt32":
+ case "System.UInt64":
+ case "System.Single":
+ case "System.Double":
+ case "System.Byte":
+ case "System.SByte":
+ case "System.Decimal":
+ // 数值类型只支持如下操作符
+ // 小于、小于等于、大于、大于等于、等于、不等于、空、非空
+ availableComparator.AddRange(new[]
+ {
+ DataAccessFilterOperate.Greater,
+ DataAccessFilterOperate.GreaterOrEqual,
+ DataAccessFilterOperate.Less,
+ DataAccessFilterOperate.LessOrEqual,
+ DataAccessFilterOperate.Equal,
+ DataAccessFilterOperate.NotEqual,
+ });
+ return ("number", availableComparator.ToArray());
+ case "System.Boolean":
+ // 布尔类型只支持如下操作符
+ // 等于、不等于、空、非空
+ availableComparator.AddRange(new[]
+ {
+ DataAccessFilterOperate.Equal,
+ DataAccessFilterOperate.NotEqual,
+ });
+ return ("boolean", availableComparator.ToArray());
+ case "System.Guid":
+ // Guid类型只支持如下操作符
+ // 等于、不等于、空、非空
+ availableComparator.AddRange(new[]
+ {
+ DataAccessFilterOperate.Equal,
+ DataAccessFilterOperate.NotEqual,
+ });
+ return ("string", availableComparator.ToArray());
+ case "System.Char":
+ case "System.String":
+ // 字符类型支持所有操作符
+ return ("string", availableComparator.ToArray());
+ case "System.DateTime":
+ // 时间类型只支持如下操作符
+ // 小于、小于等于、大于、大于等于、等于、不等于、空、非空
+ availableComparator.AddRange(new[]
+ {
+ DataAccessFilterOperate.Greater,
+ DataAccessFilterOperate.GreaterOrEqual,
+ DataAccessFilterOperate.Less,
+ DataAccessFilterOperate.LessOrEqual,
+ DataAccessFilterOperate.Equal,
+ DataAccessFilterOperate.NotEqual,
+ });
+ return ("Date", availableComparator.ToArray());
+ default:
+ case "System.Object":
+ case "System.DBNull":
+ if (propertyType.IsArray)
+ {
+ // 数组类型只支持如下操作符
+ // 包含、不包含、空、非空
+ availableComparator.AddRange(new[]
+ {
+ DataAccessFilterOperate.Contains,
+ DataAccessFilterOperate.NotContains,
+ });
+
+ return ("array", availableComparator.ToArray());
+ }
+ else
+ {
+ // 未知对象类型只支持如下操作符
+ // 等于、不等于、空、非空
+ availableComparator.AddRange(new[]
+ {
+ DataAccessFilterOperate.Equal,
+ DataAccessFilterOperate.NotEqual,
+ });
+ return ("object", availableComparator.ToArray());
+ }
+ }
+ }
+}
diff --git a/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection/LINGYUN/Abp/DataProtection/JavaScriptTypeConvertResult.cs b/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection/LINGYUN/Abp/DataProtection/JavaScriptTypeConvertResult.cs
new file mode 100644
index 000000000..e93a71107
--- /dev/null
+++ b/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection/LINGYUN/Abp/DataProtection/JavaScriptTypeConvertResult.cs
@@ -0,0 +1,12 @@
+namespace LINGYUN.Abp.DataProtection;
+
+public class JavaScriptTypeConvertResult
+{
+ public string Type { get; }
+ public DataAccessFilterOperate[] AllowOperates { get; }
+ public JavaScriptTypeConvertResult(string type, DataAccessFilterOperate[] allowOperates)
+ {
+ Type = type;
+ AllowOperates = allowOperates;
+ }
+}
diff --git a/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection/LINGYUN/Abp/DataProtection/Subjects/DataAccessClientIdContributor.cs b/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection/LINGYUN/Abp/DataProtection/Subjects/DataAccessClientIdContributor.cs
index 2c566076d..c63992adf 100644
--- a/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection/LINGYUN/Abp/DataProtection/Subjects/DataAccessClientIdContributor.cs
+++ b/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection/LINGYUN/Abp/DataProtection/Subjects/DataAccessClientIdContributor.cs
@@ -1,6 +1,7 @@
using Microsoft.Extensions.DependencyInjection;
using System.Collections.Generic;
using System.Linq;
+using System.Threading.Tasks;
using Volo.Abp.Authorization.Permissions;
using Volo.Abp.Clients;
@@ -9,30 +10,30 @@ public class DataAccessClientIdContributor : IDataAccessSubjectContributor
{
public string Name => ClientPermissionValueProvider.ProviderName;
- public virtual List GetAllowProperties(DataAccessSubjectContributorContext context)
+ public async virtual Task> GetAccessdProperties(DataAccessSubjectContributorContext context)
{
var allowProperties = new List();
var currentClient = context.ServiceProvider.GetRequiredService();
if (currentClient.IsAuthenticated)
{
var resourceStore = context.ServiceProvider.GetRequiredService();
- var resource = resourceStore.Get(Name, currentClient.Id, context.EntityTypeFullName, context.Operation);
- if (resource?.AllowProperties.Any() == true)
+ var resource = await resourceStore.GetAsync(Name, currentClient.Id, context.EntityTypeFullName, context.Operation);
+ if (resource?.AccessedProperties.Any() == true)
{
- allowProperties.AddIfNotContains(resource.AllowProperties);
+ allowProperties.AddIfNotContains(resource.AccessedProperties);
}
}
return allowProperties;
}
- public virtual List GetFilterGroups(DataAccessSubjectContributorContext context)
+ public async virtual Task> GetFilterGroups(DataAccessSubjectContributorContext context)
{
var groups = new List();
var currentClient = context.ServiceProvider.GetRequiredService();
if (currentClient.IsAuthenticated)
{
var resourceStore = context.ServiceProvider.GetRequiredService();
- var resource = resourceStore.Get(Name, currentClient.Id, context.EntityTypeFullName, context.Operation);
+ var resource = await resourceStore.GetAsync(Name, currentClient.Id, context.EntityTypeFullName, context.Operation);
if (resource?.FilterGroup != null)
{
groups.Add(resource.FilterGroup);
diff --git a/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection/LINGYUN/Abp/DataProtection/Subjects/DataAccessOrganizationUnitContributor.cs b/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection/LINGYUN/Abp/DataProtection/Subjects/DataAccessOrganizationUnitContributor.cs
index 202012f76..82ecf6d81 100644
--- a/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection/LINGYUN/Abp/DataProtection/Subjects/DataAccessOrganizationUnitContributor.cs
+++ b/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection/LINGYUN/Abp/DataProtection/Subjects/DataAccessOrganizationUnitContributor.cs
@@ -2,6 +2,7 @@
using Microsoft.Extensions.DependencyInjection;
using System.Collections.Generic;
using System.Linq;
+using System.Threading.Tasks;
using Volo.Abp.Users;
namespace LINGYUN.Abp.DataProtection.Subjects;
@@ -10,7 +11,7 @@ public class DataAccessOrganizationUnitContributor : IDataAccessSubjectContribut
{
public string Name => OrganizationUnitPermissionValueProvider.ProviderName;
- public virtual List GetFilterGroups(DataAccessSubjectContributorContext context)
+ public async virtual Task> GetFilterGroups(DataAccessSubjectContributorContext context)
{
var groups = new List();
var currentUser = context.ServiceProvider.GetRequiredService();
@@ -20,7 +21,7 @@ public class DataAccessOrganizationUnitContributor : IDataAccessSubjectContribut
var orgCodes = currentUser.FindOrganizationUnits();
foreach (var orgCode in orgCodes)
{
- var resource = resourceStore.Get(Name, orgCode, context.EntityTypeFullName, context.Operation);
+ var resource = await resourceStore.GetAsync(Name, orgCode, context.EntityTypeFullName, context.Operation);
if (resource?.FilterGroup != null)
{
groups.Add(resource.FilterGroup);
@@ -30,7 +31,7 @@ public class DataAccessOrganizationUnitContributor : IDataAccessSubjectContribut
return groups;
}
- public virtual List GetAllowProperties(DataAccessSubjectContributorContext context)
+ public async virtual Task> GetAccessdProperties(DataAccessSubjectContributorContext context)
{
var allowProperties = new List();
var currentUser = context.ServiceProvider.GetRequiredService();
@@ -40,10 +41,10 @@ public class DataAccessOrganizationUnitContributor : IDataAccessSubjectContribut
var orgCodes = currentUser.FindOrganizationUnits();
foreach (var orgCode in orgCodes)
{
- var resource = resourceStore.Get(Name, orgCode, context.EntityTypeFullName, context.Operation);
- if (resource?.AllowProperties.Any() == true)
+ var resource = await resourceStore.GetAsync(Name, orgCode, context.EntityTypeFullName, context.Operation);
+ if (resource?.AccessedProperties.Any() == true)
{
- allowProperties.AddIfNotContains(resource.AllowProperties);
+ allowProperties.AddIfNotContains(resource.AccessedProperties);
}
}
}
diff --git a/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection/LINGYUN/Abp/DataProtection/Subjects/DataAccessRoleNameContributor.cs b/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection/LINGYUN/Abp/DataProtection/Subjects/DataAccessRoleNameContributor.cs
index e2ab6e523..89712396b 100644
--- a/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection/LINGYUN/Abp/DataProtection/Subjects/DataAccessRoleNameContributor.cs
+++ b/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection/LINGYUN/Abp/DataProtection/Subjects/DataAccessRoleNameContributor.cs
@@ -1,6 +1,7 @@
using Microsoft.Extensions.DependencyInjection;
using System.Collections.Generic;
using System.Linq;
+using System.Threading.Tasks;
using Volo.Abp.Authorization.Permissions;
using Volo.Abp.Users;
@@ -10,7 +11,7 @@ public class DataAccessRoleNameContributor : IDataAccessSubjectContributor
{
public string Name => RolePermissionValueProvider.ProviderName;
- public virtual List GetFilterGroups(DataAccessSubjectContributorContext context)
+ public async virtual Task> GetFilterGroups(DataAccessSubjectContributorContext context)
{
var groups = new List();
var currentUser = context.ServiceProvider.GetRequiredService();
@@ -20,7 +21,7 @@ public class DataAccessRoleNameContributor : IDataAccessSubjectContributor
var roles = currentUser.Roles;
foreach (var role in roles)
{
- var resource = resourceStore.Get(Name, role, context.EntityTypeFullName, context.Operation);
+ var resource = await resourceStore.GetAsync(Name, role, context.EntityTypeFullName, context.Operation);
if (resource?.FilterGroup != null)
{
groups.Add(resource.FilterGroup);
@@ -30,7 +31,7 @@ public class DataAccessRoleNameContributor : IDataAccessSubjectContributor
return groups;
}
- public virtual List GetAllowProperties(DataAccessSubjectContributorContext context)
+ public async virtual Task> GetAccessdProperties(DataAccessSubjectContributorContext context)
{
var allowProperties = new List();
var currentUser = context.ServiceProvider.GetRequiredService();
@@ -40,10 +41,10 @@ public class DataAccessRoleNameContributor : IDataAccessSubjectContributor
var roles = currentUser.Roles;
foreach (var role in roles)
{
- var resource = resourceStore.Get(Name, role, context.EntityTypeFullName, context.Operation);
- if (resource?.AllowProperties.Any() == true)
+ var resource = await resourceStore.GetAsync(Name, role, context.EntityTypeFullName, context.Operation);
+ if (resource?.AccessedProperties.Any() == true)
{
- allowProperties.AddIfNotContains(resource.AllowProperties);
+ allowProperties.AddIfNotContains(resource.AccessedProperties);
}
}
}
diff --git a/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection/LINGYUN/Abp/DataProtection/Subjects/DataAccessUserIdContributor.cs b/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection/LINGYUN/Abp/DataProtection/Subjects/DataAccessUserIdContributor.cs
index ff0219f53..834d682ff 100644
--- a/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection/LINGYUN/Abp/DataProtection/Subjects/DataAccessUserIdContributor.cs
+++ b/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection/LINGYUN/Abp/DataProtection/Subjects/DataAccessUserIdContributor.cs
@@ -1,6 +1,7 @@
using Microsoft.Extensions.DependencyInjection;
using System.Collections.Generic;
using System.Linq;
+using System.Threading.Tasks;
using Volo.Abp.Authorization.Permissions;
using Volo.Abp.Users;
@@ -10,14 +11,14 @@ public class DataAccessUserIdContributor : IDataAccessSubjectContributor
{
public string Name => UserPermissionValueProvider.ProviderName;
- public virtual List GetFilterGroups(DataAccessSubjectContributorContext context)
+ public async virtual Task> GetFilterGroups(DataAccessSubjectContributorContext context)
{
var groups = new List();
var currentUser = context.ServiceProvider.GetRequiredService();
if (currentUser.IsAuthenticated)
{
var resourceStore = context.ServiceProvider.GetRequiredService();
- var resource = resourceStore.Get(Name, currentUser.Id.ToString(), context.EntityTypeFullName, context.Operation);
+ var resource = await resourceStore.GetAsync(Name, currentUser.Id.ToString(), context.EntityTypeFullName, context.Operation);
if (resource?.FilterGroup != null)
{
groups.Add(resource.FilterGroup);
@@ -26,17 +27,17 @@ public class DataAccessUserIdContributor : IDataAccessSubjectContributor
return groups;
}
- public virtual List GetAllowProperties(DataAccessSubjectContributorContext context)
+ public async virtual Task> GetAccessdProperties(DataAccessSubjectContributorContext context)
{
var allowProperties = new List();
var currentUser = context.ServiceProvider.GetRequiredService();
if (currentUser.IsAuthenticated)
{
var resourceStore = context.ServiceProvider.GetRequiredService();
- var resource = resourceStore.Get(Name, currentUser.Id.ToString(), context.EntityTypeFullName, context.Operation);
- if (resource?.AllowProperties.Any() == true)
+ var resource = await resourceStore.GetAsync(Name, currentUser.Id.ToString(), context.EntityTypeFullName, context.Operation);
+ if (resource?.AccessedProperties.Any() == true)
{
- allowProperties.AddIfNotContains(resource.AllowProperties);
+ allowProperties.AddIfNotContains(resource.AccessedProperties);
}
}
return allowProperties;
diff --git a/aspnet-core/migrations/LY.MicroService.Applications.Single.DbMigrator/LY.MicroService.Applications.Single.DbMigrator.csproj b/aspnet-core/migrations/LY.MicroService.Applications.Single.DbMigrator/LY.MicroService.Applications.Single.DbMigrator.csproj
index 620990228..3092d4949 100644
--- a/aspnet-core/migrations/LY.MicroService.Applications.Single.DbMigrator/LY.MicroService.Applications.Single.DbMigrator.csproj
+++ b/aspnet-core/migrations/LY.MicroService.Applications.Single.DbMigrator/LY.MicroService.Applications.Single.DbMigrator.csproj
@@ -26,26 +26,12 @@
-
- PreserveNewest
- true
- PreserveNewest
-
-
-
- PreserveNewest
-
PreserveNewest
-
-
-
-
-
diff --git a/aspnet-core/migrations/LY.MicroService.Applications.Single.EntityFrameworkCore.MySql/Migrations/20250315061656_Remove-Identity-Server-And-Add-Entity-Enum-Info.Designer.cs b/aspnet-core/migrations/LY.MicroService.Applications.Single.EntityFrameworkCore.MySql/Migrations/20250315061656_Remove-Identity-Server-And-Add-Entity-Enum-Info.Designer.cs
new file mode 100644
index 000000000..bdb84293d
--- /dev/null
+++ b/aspnet-core/migrations/LY.MicroService.Applications.Single.EntityFrameworkCore.MySql/Migrations/20250315061656_Remove-Identity-Server-And-Add-Entity-Enum-Info.Designer.cs
@@ -0,0 +1,5314 @@
+//
+using System;
+using LY.MicroService.Applications.Single.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Metadata;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+using Volo.Abp.EntityFrameworkCore;
+
+#nullable disable
+
+namespace LY.MicroService.Applications.Single.EntityFrameworkCore.MySql.Migrations
+{
+ [DbContext(typeof(SingleMigrationsDbContext))]
+ [Migration("20250315061656_Remove-Identity-Server-And-Add-Entity-Enum-Info")]
+ partial class RemoveIdentityServerAndAddEntityEnumInfo
+ {
+ ///
+ protected override void BuildTargetModel(ModelBuilder modelBuilder)
+ {
+#pragma warning disable 612, 618
+ modelBuilder
+ .HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.MySql)
+ .HasAnnotation("ProductVersion", "9.0.0")
+ .HasAnnotation("Relational:MaxIdentifierLength", 64);
+
+ MySqlModelBuilderExtensions.AutoIncrementColumns(modelBuilder);
+
+ modelBuilder.Entity("LINGYUN.Abp.DataProtectionManagement.EntityEnumInfo", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("char(36)");
+
+ b.Property("DisplayName")
+ .IsRequired()
+ .HasMaxLength(128)
+ .HasColumnType("varchar(128)")
+ .HasColumnName("DisplayName");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasMaxLength(64)
+ .HasColumnType("varchar(64)")
+ .HasColumnName("Name");
+
+ b.Property("PropertyInfoId")
+ .HasColumnType("char(36)");
+
+ b.Property("Value")
+ .IsRequired()
+ .HasMaxLength(10)
+ .HasColumnType("varchar(10)")
+ .HasColumnName("Value");
+
+ b.HasKey("Id");
+
+ b.HasIndex("PropertyInfoId", "Name");
+
+ b.ToTable("AbpAuthEntityEnums", (string)null);
+ });
+
+ modelBuilder.Entity("LINGYUN.Abp.DataProtectionManagement.EntityPropertyInfo", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("char(36)");
+
+ b.Property("DisplayName")
+ .IsRequired()
+ .HasMaxLength(128)
+ .HasColumnType("varchar(128)")
+ .HasColumnName("DisplayName");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasMaxLength(64)
+ .HasColumnType("varchar(64)")
+ .HasColumnName("Name");
+
+ b.Property("TypeFullName")
+ .IsRequired()
+ .HasMaxLength(256)
+ .HasColumnType("varchar(256)")
+ .HasColumnName("TypeFullName");
+
+ b.Property("TypeInfoId")
+ .HasColumnType("char(36)");
+
+ b.HasKey("Id");
+
+ b.HasIndex("TypeInfoId", "TypeFullName");
+
+ b.ToTable("AbpAuthEntityProperties", (string)null);
+ });
+
+ modelBuilder.Entity("LINGYUN.Abp.DataProtectionManagement.EntityTypeInfo", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("char(36)");
+
+ b.Property("ConcurrencyStamp")
+ .IsConcurrencyToken()
+ .IsRequired()
+ .HasMaxLength(40)
+ .HasColumnType("varchar(40)")
+ .HasColumnName("ConcurrencyStamp");
+
+ b.Property("CreationTime")
+ .HasColumnType("datetime(6)")
+ .HasColumnName("CreationTime");
+
+ b.Property("CreatorId")
+ .HasColumnType("char(36)")
+ .HasColumnName("CreatorId");
+
+ b.Property("DisplayName")
+ .IsRequired()
+ .HasMaxLength(128)
+ .HasColumnType("varchar(128)")
+ .HasColumnName("DisplayName");
+
+ b.Property("ExtraProperties")
+ .IsRequired()
+ .HasColumnType("longtext")
+ .HasColumnName("ExtraProperties");
+
+ b.Property("IsAuditEnabled")
+ .HasColumnType("tinyint(1)");
+
+ b.Property("LastModificationTime")
+ .HasColumnType("datetime(6)")
+ .HasColumnName("LastModificationTime");
+
+ b.Property("LastModifierId")
+ .HasColumnType("char(36)")
+ .HasColumnName("LastModifierId");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasMaxLength(64)
+ .HasColumnType("varchar(64)")
+ .HasColumnName("Name");
+
+ b.Property("TypeFullName")
+ .IsRequired()
+ .HasMaxLength(256)
+ .HasColumnType("varchar(256)")
+ .HasColumnName("TypeFullName");
+
+ b.HasKey("Id");
+
+ b.HasIndex("TypeFullName");
+
+ b.ToTable("AbpAuthEntitites", (string)null);
+ });
+
+ modelBuilder.Entity("LINGYUN.Abp.DataProtectionManagement.OrganizationUnitEntityRule", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("char(36)");
+
+ b.Property("AllowProperties")
+ .HasMaxLength(512)
+ .HasColumnType("varchar(512)")
+ .HasColumnName("AllowProperties");
+
+ b.Property("ConcurrencyStamp")
+ .IsConcurrencyToken()
+ .IsRequired()
+ .HasMaxLength(40)
+ .HasColumnType("varchar(40)")
+ .HasColumnName("ConcurrencyStamp");
+
+ b.Property("CreationTime")
+ .HasColumnType("datetime(6)")
+ .HasColumnName("CreationTime");
+
+ b.Property("CreatorId")
+ .HasColumnType("char(36)")
+ .HasColumnName("CreatorId");
+
+ b.Property("EntityTypeFullName")
+ .HasColumnType("longtext");
+
+ b.Property("EntityTypeId")
+ .HasColumnType("char(36)");
+
+ b.Property("ExtraProperties")
+ .IsRequired()
+ .HasColumnType("longtext")
+ .HasColumnName("ExtraProperties");
+
+ b.Property("FilterGroup")
+ .HasColumnType("longtext")
+ .HasColumnName("FilterGroup");
+
+ b.Property("IsEnabled")
+ .HasColumnType("tinyint(1)");
+
+ b.Property("LastModificationTime")
+ .HasColumnType("datetime(6)")
+ .HasColumnName("LastModificationTime");
+
+ b.Property("LastModifierId")
+ .HasColumnType("char(36)")
+ .HasColumnName("LastModifierId");
+
+ b.Property("Operation")
+ .HasColumnType("int");
+
+ b.Property("OrgCode")
+ .IsRequired()
+ .HasMaxLength(128)
+ .HasColumnType("varchar(128)")
+ .HasColumnName("OrgCode");
+
+ b.Property("OrgId")
+ .HasColumnType("char(36)");
+
+ b.Property("TenantId")
+ .HasColumnType("char(36)")
+ .HasColumnName("TenantId");
+
+ b.HasKey("Id");
+
+ b.HasIndex("EntityTypeId");
+
+ b.ToTable("AbpAuthOrganizationUnitEntityRules", (string)null);
+ });
+
+ modelBuilder.Entity("LINGYUN.Abp.DataProtectionManagement.RoleEntityRule", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("char(36)");
+
+ b.Property("AllowProperties")
+ .HasMaxLength(512)
+ .HasColumnType("varchar(512)")
+ .HasColumnName("AllowProperties");
+
+ b.Property("ConcurrencyStamp")
+ .IsConcurrencyToken()
+ .IsRequired()
+ .HasMaxLength(40)
+ .HasColumnType("varchar(40)")
+ .HasColumnName("ConcurrencyStamp");
+
+ b.Property("CreationTime")
+ .HasColumnType("datetime(6)")
+ .HasColumnName("CreationTime");
+
+ b.Property("CreatorId")
+ .HasColumnType("char(36)")
+ .HasColumnName("CreatorId");
+
+ b.Property("EntityTypeFullName")
+ .HasColumnType("longtext");
+
+ b.Property("EntityTypeId")
+ .HasColumnType("char(36)");
+
+ b.Property("ExtraProperties")
+ .IsRequired()
+ .HasColumnType("longtext")
+ .HasColumnName("ExtraProperties");
+
+ b.Property("FilterGroup")
+ .HasColumnType("longtext")
+ .HasColumnName("FilterGroup");
+
+ b.Property("IsEnabled")
+ .HasColumnType("tinyint(1)");
+
+ b.Property("LastModificationTime")
+ .HasColumnType("datetime(6)")
+ .HasColumnName("LastModificationTime");
+
+ b.Property("LastModifierId")
+ .HasColumnType("char(36)")
+ .HasColumnName("LastModifierId");
+
+ b.Property("Operation")
+ .HasColumnType("int");
+
+ b.Property("RoleId")
+ .HasColumnType("char(36)");
+
+ b.Property("RoleName")
+ .IsRequired()
+ .HasMaxLength(256)
+ .HasColumnType("varchar(256)")
+ .HasColumnName("RoleName");
+
+ b.Property("TenantId")
+ .HasColumnType("char(36)")
+ .HasColumnName("TenantId");
+
+ b.HasKey("Id");
+
+ b.HasIndex("EntityTypeId");
+
+ b.ToTable("AbpAuthRoleEntityRules", (string)null);
+ });
+
+ modelBuilder.Entity("LINGYUN.Abp.Demo.Authors.Author", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("char(36)");
+
+ b.Property("BirthDate")
+ .HasColumnType("datetime(6)");
+
+ b.Property("ConcurrencyStamp")
+ .IsConcurrencyToken()
+ .IsRequired()
+ .HasMaxLength(40)
+ .HasColumnType("varchar(40)")
+ .HasColumnName("ConcurrencyStamp");
+
+ b.Property("CreationTime")
+ .HasColumnType("datetime(6)")
+ .HasColumnName("CreationTime");
+
+ b.Property("CreatorId")
+ .HasColumnType("char(36)")
+ .HasColumnName("CreatorId");
+
+ b.Property("DeleterId")
+ .HasColumnType("char(36)")
+ .HasColumnName("DeleterId");
+
+ b.Property("DeletionTime")
+ .HasColumnType("datetime(6)")
+ .HasColumnName("DeletionTime");
+
+ b.Property("ExtraProperties")
+ .IsRequired()
+ .HasColumnType("longtext")
+ .HasColumnName("ExtraProperties");
+
+ b.Property("IsDeleted")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("tinyint(1)")
+ .HasDefaultValue(false)
+ .HasColumnName("IsDeleted");
+
+ b.Property("LastModificationTime")
+ .HasColumnType("datetime(6)")
+ .HasColumnName("LastModificationTime");
+
+ b.Property("LastModifierId")
+ .HasColumnType("char(36)")
+ .HasColumnName("LastModifierId");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasMaxLength(64)
+ .HasColumnType("varchar(64)");
+
+ b.Property("ShortBio")
+ .HasColumnType("longtext");
+
+ b.HasKey("Id");
+
+ b.HasIndex("Name");
+
+ b.ToTable("Demo_Authors", (string)null);
+ });
+
+ modelBuilder.Entity("LINGYUN.Abp.Demo.Books.Book", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("char(36)");
+
+ b.Property("AuthorId")
+ .HasColumnType("char(36)");
+
+ b.Property("ConcurrencyStamp")
+ .IsConcurrencyToken()
+ .IsRequired()
+ .HasMaxLength(40)
+ .HasColumnType("varchar(40)")
+ .HasColumnName("ConcurrencyStamp");
+
+ b.Property("CreationTime")
+ .HasColumnType("datetime(6)")
+ .HasColumnName("CreationTime");
+
+ b.Property("CreatorId")
+ .HasColumnType("char(36)")
+ .HasColumnName("CreatorId");
+
+ b.Property("ExtraProperties")
+ .IsRequired()
+ .HasColumnType("longtext")
+ .HasColumnName("ExtraProperties");
+
+ b.Property("LastModificationTime")
+ .HasColumnType("datetime(6)")
+ .HasColumnName("LastModificationTime");
+
+ b.Property("LastModifierId")
+ .HasColumnType("char(36)")
+ .HasColumnName("LastModifierId");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasMaxLength(128)
+ .HasColumnType("varchar(128)");
+
+ b.Property("Price")
+ .HasColumnType("float");
+
+ b.Property("PublishDate")
+ .HasColumnType("datetime(6)");
+
+ b.Property("Type")
+ .HasColumnType("int");
+
+ b.HasKey("Id");
+
+ b.HasIndex("AuthorId");
+
+ b.ToTable("Demo_Books", (string)null);
+ });
+
+ modelBuilder.Entity("LINGYUN.Abp.Gdpr.GdprInfo", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("char(36)");
+
+ b.Property("Data")
+ .IsRequired()
+ .HasColumnType("longtext")
+ .HasColumnName("Data");
+
+ b.Property("Provider")
+ .IsRequired()
+ .HasMaxLength(256)
+ .HasColumnType("varchar(256)")
+ .HasColumnName("Provider");
+
+ b.Property("RequestId")
+ .HasColumnType("char(36)");
+
+ b.HasKey("Id");
+
+ b.HasIndex("RequestId");
+
+ b.ToTable("AbpGdprInfos", (string)null);
+ });
+
+ modelBuilder.Entity("LINGYUN.Abp.Gdpr.GdprRequest", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("char(36)");
+
+ b.Property("ConcurrencyStamp")
+ .IsConcurrencyToken()
+ .IsRequired()
+ .HasMaxLength(40)
+ .HasColumnType("varchar(40)")
+ .HasColumnName("ConcurrencyStamp");
+
+ b.Property("CreationTime")
+ .HasColumnType("datetime(6)")
+ .HasColumnName("CreationTime");
+
+ b.Property("ExtraProperties")
+ .IsRequired()
+ .HasColumnType("longtext")
+ .HasColumnName("ExtraProperties");
+
+ b.Property("ReadyTime")
+ .HasColumnType("datetime(6)");
+
+ b.Property("UserId")
+ .HasColumnType("char(36)");
+
+ b.HasKey("Id");
+
+ b.HasIndex("UserId");
+
+ b.ToTable("AbpGdprRequests", (string)null);
+ });
+
+ modelBuilder.Entity("LINGYUN.Abp.LocalizationManagement.Language", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("char(36)");
+
+ b.Property("CreationTime")
+ .HasColumnType("datetime(6)")
+ .HasColumnName("CreationTime");
+
+ b.Property("CreatorId")
+ .HasColumnType("char(36)")
+ .HasColumnName("CreatorId");
+
+ b.Property("CultureName")
+ .IsRequired()
+ .HasMaxLength(20)
+ .HasColumnType("varchar(20)")
+ .HasColumnName("CultureName");
+
+ b.Property("DisplayName")
+ .IsRequired()
+ .HasMaxLength(64)
+ .HasColumnType("varchar(64)")
+ .HasColumnName("DisplayName");
+
+ b.Property("Enable")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("tinyint(1)")
+ .HasDefaultValue(true);
+
+ b.Property("LastModificationTime")
+ .HasColumnType("datetime(6)")
+ .HasColumnName("LastModificationTime");
+
+ b.Property("LastModifierId")
+ .HasColumnType("char(36)")
+ .HasColumnName("LastModifierId");
+
+ b.Property("TwoLetterISOLanguageName")
+ .HasMaxLength(30)
+ .HasColumnType("varchar(30)")
+ .HasColumnName("TwoLetterISOLanguageName");
+
+ b.Property("UiCultureName")
+ .IsRequired()
+ .HasMaxLength(20)
+ .HasColumnType("varchar(20)")
+ .HasColumnName("UiCultureName");
+
+ b.HasKey("Id");
+
+ b.HasIndex("CultureName");
+
+ b.ToTable("AbpLocalizationLanguages", (string)null);
+ });
+
+ modelBuilder.Entity("LINGYUN.Abp.LocalizationManagement.Resource", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("char(36)");
+
+ b.Property("CreationTime")
+ .HasColumnType("datetime(6)")
+ .HasColumnName("CreationTime");
+
+ b.Property("CreatorId")
+ .HasColumnType("char(36)")
+ .HasColumnName("CreatorId");
+
+ b.Property("DefaultCultureName")
+ .HasMaxLength(64)
+ .HasColumnType("varchar(64)")
+ .HasColumnName("DefaultCultureName");
+
+ b.Property("Description")
+ .HasMaxLength(64)
+ .HasColumnType("varchar(64)")
+ .HasColumnName("Description");
+
+ b.Property("DisplayName")
+ .HasMaxLength(64)
+ .HasColumnType("varchar(64)")
+ .HasColumnName("DisplayName");
+
+ b.Property("Enable")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("tinyint(1)")
+ .HasDefaultValue(true);
+
+ b.Property("LastModificationTime")
+ .HasColumnType("datetime(6)")
+ .HasColumnName("LastModificationTime");
+
+ b.Property("LastModifierId")
+ .HasColumnType("char(36)")
+ .HasColumnName("LastModifierId");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasMaxLength(50)
+ .HasColumnType("varchar(50)")
+ .HasColumnName("Name");
+
+ b.HasKey("Id");
+
+ b.HasIndex("Name");
+
+ b.ToTable("AbpLocalizationResources", (string)null);
+ });
+
+ modelBuilder.Entity("LINGYUN.Abp.LocalizationManagement.Text", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id"));
+
+ b.Property("CultureName")
+ .IsRequired()
+ .HasMaxLength(20)
+ .HasColumnType("varchar(20)")
+ .HasColumnName("CultureName");
+
+ b.Property("Key")
+ .IsRequired()
+ .HasMaxLength(512)
+ .HasColumnType("varchar(512)")
+ .HasColumnName("Key");
+
+ b.Property("ResourceName")
+ .HasColumnType("longtext");
+
+ b.Property("Value")
+ .HasMaxLength(2048)
+ .HasColumnType("varchar(2048)")
+ .HasColumnName("Value");
+
+ b.HasKey("Id");
+
+ b.HasIndex("Key");
+
+ b.ToTable("AbpLocalizationTexts", (string)null);
+ });
+
+ modelBuilder.Entity("LINGYUN.Abp.MessageService.Chat.UserChatCard", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("bigint");
+
+ MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id"));
+
+ b.Property