Browse Source

fix(data-protection): 修复受保护实体初始化时重复写入属性列表

pull/1013/head
colin 1 year ago
parent
commit
3000290d86
  1. 5
      aspnet-core/modules/data-protection/LINGYUN.Abp.DataProtectionManagement.Application/LINGYUN/Abp/DataProtectionManagement/OrganizationUnitEntityRuleAppService.cs
  2. 8
      aspnet-core/modules/data-protection/LINGYUN.Abp.DataProtectionManagement.Application/LINGYUN/Abp/DataProtectionManagement/RoleEntityRuleAppService.cs
  3. 2
      aspnet-core/modules/data-protection/LINGYUN.Abp.DataProtectionManagement.Domain/LINGYUN/Abp/DataProtectionManagement/ProtectedEntitiesSaver.cs

5
aspnet-core/modules/data-protection/LINGYUN.Abp.DataProtectionManagement.Application/LINGYUN/Abp/DataProtectionManagement/OrganizationUnitEntityRuleAppService.cs

@ -36,8 +36,8 @@ public class OrganizationUnitEntityRuleAppService : DataProtectionManagementAppl
{
throw new BusinessException(DataProtectionManagementErrorCodes.OrganizationUnitEntityRule.DuplicateEntityRule)
.WithData(nameof(OrganizationUnitEntityRule.OrgCode), input.OrgCode)
.WithData(nameof(EntityTypeInfo.DisplayName), entityTypeInfo.DisplayName)
.WithData(nameof(EntityRuleBase.Operation), input.Operation);
.WithData(nameof(EntityTypeInfo.Name), entityTypeInfo.Name)
.WithData(nameof(EntityRuleBase.Operation), input.Operation.ToString());
}
var entityRule = new OrganizationUnitEntityRule(
@ -78,6 +78,7 @@ public class OrganizationUnitEntityRuleAppService : DataProtectionManagementAppl
{
entityRule.AllowProperties = allowPropertites;
}
entityRule.FilterGroup = input.FilterGroup;
entityRule = await _organizationUnitEntityRuleRepository.UpdateAsync(entityRule);

8
aspnet-core/modules/data-protection/LINGYUN.Abp.DataProtectionManagement.Application/LINGYUN/Abp/DataProtectionManagement/RoleEntityRuleAppService.cs

@ -34,10 +34,10 @@ public class RoleEntityRuleAppService : DataProtectionManagementApplicationServi
var entityTypeInfo = await _entityTypeInfoRepository.GetAsync(input.EntityTypeId);
if (await _roleEntityRuleRepository.FindEntityRuleAsync(input.RoleName, entityTypeInfo.TypeFullName, input.Operation) != null)
{
throw new BusinessException(DataProtectionManagementErrorCodes.OrganizationUnitEntityRule.DuplicateEntityRule)
throw new BusinessException(DataProtectionManagementErrorCodes.RoleEntityRule.DuplicateEntityRule)
.WithData(nameof(RoleEntityRule.RoleName), input.RoleName)
.WithData(nameof(EntityTypeInfo.DisplayName), entityTypeInfo.DisplayName)
.WithData(nameof(EntityRuleBase.Operation), input.Operation);
.WithData(nameof(EntityTypeInfo.Name), entityTypeInfo.Name)
.WithData(nameof(EntityRuleBase.Operation), input.Operation.ToString());
}
var entityRule = new RoleEntityRule(
@ -79,6 +79,8 @@ public class RoleEntityRuleAppService : DataProtectionManagementApplicationServi
entityRule.AllowProperties = allowPropertites;
}
entityRule.FilterGroup = input.FilterGroup;
entityRule = await _roleEntityRuleRepository.UpdateAsync(entityRule);
await CurrentUnitOfWork.SaveChangesAsync();

2
aspnet-core/modules/data-protection/LINGYUN.Abp.DataProtectionManagement.Domain/LINGYUN/Abp/DataProtectionManagement/ProtectedEntitiesSaver.cs

@ -67,7 +67,7 @@ public class ProtectedEntitiesSaver : IProtectedEntitiesSaver, ITransientDepende
var newRecords = new List<EntityTypeInfo>();
var changeRecords = new List<EntityTypeInfo>();
var entityTypeList = await EntityTypeInfoRepository.GetListAsync();
var entityTypeList = await EntityTypeInfoRepository.GetListAsync(includeDetails: true);
foreach (var protectedEntityMap in ManagementOptions.ProtectedEntities)
{
var resourceType = protectedEntityMap.Key;

Loading…
Cancel
Save