Skip to content

Commit

Permalink
upd legacy DomainObjectAttribute (#520)
Browse files Browse the repository at this point in the history
  • Loading branch information
iatsuta authored Oct 21, 2024
1 parent 63d808b commit c6edc30
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ public EditDomainObjectAttribute(SecurityRule securityRule)
{
}

public EditDomainObjectAttribute(Type domainType)
: base(SecurityRule.Edit.ToDomain(domainType))
{
}

/// <summary>
/// Констуктор с доступом по операции
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ public ViewDomainObjectAttribute(Type securityRuleType, string name)
{
}

public ViewDomainObjectAttribute(Type domainType)
: base(SecurityRule.View.ToDomain(domainType))
{
}

public ViewDomainObjectAttribute(SecurityRule securityRule)
: base(securityRule)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ public static CodeExpression GetSecurityCodeExpression(
{
return typeof(SecurityRule).ToTypeReferenceExpression().ToPropertyReference(securityRule.ToString());
}
else if (securityRule is DomainSecurityRule.DomainModeSecurityRule domainModeSecurityRule)
{
return configuration.GetSecurityCodeExpression(domainModeSecurityRule.Mode).ToMethodReferenceExpression("ToDomain", [domainModeSecurityRule.DomainType]).ToMethodInvokeExpression();
}
else if (securityRule is DomainSecurityRule.NonExpandedRolesSecurityRule)
{
return typeof(SecurityRole).ToTypeReferenceExpression().ToPropertyReference(securityRule.ToString());
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
namespace SampleSystem.Domain.Models.Filters;
using Framework.Security;

namespace SampleSystem.Domain.Models.Filters;

[ViewDomainObject(typeof(Employee))]
public class EmployeeFilterModel : DomainObjectContextFilterModel<Employee>
{
}
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ protected virtual SampleSystem.Generated.DTO.EmployeeFullDTO GetFullEmployeeInte

protected virtual System.Collections.Generic.IEnumerable<SampleSystem.Generated.DTO.EmployeeFullDTO> GetFullEmployeesByFilterInternal(SampleSystem.Generated.DTO.EmployeeFilterModelStrictDTO filter, Framework.DomainDriven.ServiceModel.Service.EvaluatedData<SampleSystem.BLL.ISampleSystemBLLContext, SampleSystem.Generated.DTO.ISampleSystemDTOMappingService> evaluateData)
{
SampleSystem.BLL.IEmployeeBLL bll = evaluateData.Context.Logics.EmployeeFactory.Create(Framework.SecuritySystem.SecurityRule.View);
SampleSystem.BLL.IEmployeeBLL bll = evaluateData.Context.Logics.EmployeeFactory.Create(Framework.SecuritySystem.SecurityRule.View.ToDomain<SampleSystem.Domain.Employee>());
SampleSystem.Domain.Models.Filters.EmployeeFilterModel typedFilter = filter.ToDomainObject(evaluateData.MappingService);
return SampleSystem.Generated.DTO.LambdaHelper.ToFullDTOList(bll.GetListBy(typedFilter, evaluateData.Context.FetchService.GetContainer<SampleSystem.Domain.Employee>(Framework.Transfering.ViewDTOType.FullDTO)), evaluateData.MappingService);
}
Expand Down Expand Up @@ -175,7 +175,7 @@ protected virtual SampleSystem.Generated.DTO.EmployeeSimpleDTO GetSimpleEmployee

protected virtual System.Collections.Generic.IEnumerable<SampleSystem.Generated.DTO.EmployeeSimpleDTO> GetSimpleEmployeesByFilterInternal(SampleSystem.Generated.DTO.EmployeeFilterModelStrictDTO filter, Framework.DomainDriven.ServiceModel.Service.EvaluatedData<SampleSystem.BLL.ISampleSystemBLLContext, SampleSystem.Generated.DTO.ISampleSystemDTOMappingService> evaluateData)
{
SampleSystem.BLL.IEmployeeBLL bll = evaluateData.Context.Logics.EmployeeFactory.Create(Framework.SecuritySystem.SecurityRule.View);
SampleSystem.BLL.IEmployeeBLL bll = evaluateData.Context.Logics.EmployeeFactory.Create(Framework.SecuritySystem.SecurityRule.View.ToDomain<SampleSystem.Domain.Employee>());
SampleSystem.Domain.Models.Filters.EmployeeFilterModel typedFilter = filter.ToDomainObject(evaluateData.MappingService);
return SampleSystem.Generated.DTO.LambdaHelper.ToSimpleDTOList(bll.GetListBy(typedFilter, evaluateData.Context.FetchService.GetContainer<SampleSystem.Domain.Employee>(Framework.Transfering.ViewDTOType.SimpleDTO)), evaluateData.MappingService);
}
Expand Down Expand Up @@ -337,7 +337,7 @@ protected virtual SampleSystem.Generated.DTO.TestEmployeeProjectionDTO GetTestEm

protected virtual System.Collections.Generic.IEnumerable<SampleSystem.Generated.DTO.TestEmployeeProjectionDTO> GetTestEmployeesByEmployeeFilterInternal(SampleSystem.Generated.DTO.EmployeeFilterModelStrictDTO filter, Framework.DomainDriven.ServiceModel.Service.EvaluatedData<SampleSystem.BLL.ISampleSystemBLLContext, SampleSystem.Generated.DTO.ISampleSystemDTOMappingService> evaluateData)
{
SampleSystem.BLL.ITestEmployeeBLL bll = evaluateData.Context.Logics.TestEmployeeFactory.Create(Framework.SecuritySystem.SecurityRule.View);
SampleSystem.BLL.ITestEmployeeBLL bll = evaluateData.Context.Logics.TestEmployeeFactory.Create(Framework.SecuritySystem.SecurityRule.View.ToDomain<SampleSystem.Domain.Employee>());
SampleSystem.Domain.Models.Filters.EmployeeFilterModel typedFilter = filter.ToDomainObject(evaluateData.MappingService);
return SampleSystem.Generated.DTO.LambdaHelper.ToProjectionDTOList(bll.GetListBy(typedFilter, evaluateData.Context.FetchService.GetContainer<SampleSystem.Domain.Projections.TestEmployee>(Framework.Transfering.ViewDTOType.ProjectionDTO)), evaluateData.MappingService);
}
Expand Down Expand Up @@ -385,7 +385,7 @@ protected virtual SampleSystem.Generated.DTO.TestLegacyEmployeeProjectionDTO Get

protected virtual System.Collections.Generic.IEnumerable<SampleSystem.Generated.DTO.TestLegacyEmployeeProjectionDTO> GetTestLegacyEmployeesByEmployeeFilterInternal(SampleSystem.Generated.DTO.EmployeeFilterModelStrictDTO filter, Framework.DomainDriven.ServiceModel.Service.EvaluatedData<SampleSystem.BLL.ISampleSystemBLLContext, SampleSystem.Generated.DTO.ISampleSystemDTOMappingService> evaluateData)
{
SampleSystem.BLL.ITestLegacyEmployeeBLL bll = evaluateData.Context.Logics.TestLegacyEmployeeFactory.Create(Framework.SecuritySystem.SecurityRule.View);
SampleSystem.BLL.ITestLegacyEmployeeBLL bll = evaluateData.Context.Logics.TestLegacyEmployeeFactory.Create(Framework.SecuritySystem.SecurityRule.View.ToDomain<SampleSystem.Domain.Employee>());
SampleSystem.Domain.Models.Filters.EmployeeFilterModel typedFilter = filter.ToDomainObject(evaluateData.MappingService);
return SampleSystem.Generated.DTO.LambdaHelper.ToProjectionDTOList(bll.GetListBy(typedFilter, evaluateData.Context.FetchService.GetContainer<SampleSystem.Domain.Projections.TestLegacyEmployee>(Framework.Transfering.ViewDTOType.ProjectionDTO)), evaluateData.MappingService);
}
Expand Down
6 changes: 3 additions & 3 deletions src/__SolutionItems/CommonAssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
[assembly: AssemblyCompany("Luxoft")]
[assembly: AssemblyCopyright("Copyright © Luxoft 2009-2024")]

[assembly: AssemblyVersion("22.5.1.0")]
[assembly: AssemblyFileVersion("22.5.1.0")]
[assembly: AssemblyInformationalVersion("22.5.1.0")]
[assembly: AssemblyVersion("22.5.2.0")]
[assembly: AssemblyFileVersion("22.5.2.0")]
[assembly: AssemblyInformationalVersion("22.5.2.0")]

#if DEBUG
[assembly: AssemblyConfiguration("Debug")]
Expand Down

0 comments on commit c6edc30

Please sign in to comment.