Merge branch 'feature/operations-domain-invariants' into development
This commit is contained in:
commit
21030d4cbc
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,2 +1,4 @@
|
||||
.tasks/
|
||||
.agile/
|
||||
**/bin/
|
||||
**/obj/
|
||||
|
||||
10
Directory.Build.props
Normal file
10
Directory.Build.props
Normal file
@ -0,0 +1,10 @@
|
||||
<Project>
|
||||
<PropertyGroup>
|
||||
<Authors>AgileWebs</Authors>
|
||||
<Company>AgileWebs</Company>
|
||||
<RepositoryType>git</RepositoryType>
|
||||
<RepositoryUrl>http://192.168.68.156:3000/AgileWebs/operations-domain</RepositoryUrl>
|
||||
<PackageProjectUrl>http://192.168.68.156:3000/AgileWebs/operations-domain</PackageProjectUrl>
|
||||
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
5
Operations.Domain.slnx
Normal file
5
Operations.Domain.slnx
Normal file
@ -0,0 +1,5 @@
|
||||
<Solution>
|
||||
<Folder Name="/src/">
|
||||
<Project Path="src/Operations.Domain/Operations.Domain.csproj" />
|
||||
</Folder>
|
||||
</Solution>
|
||||
@ -0,0 +1,3 @@
|
||||
namespace Operations.Domain.Conventions;
|
||||
|
||||
public interface IOperationsDomainPackageContract;
|
||||
@ -0,0 +1,11 @@
|
||||
using Operations.Domain.Models;
|
||||
|
||||
namespace Operations.Domain.Decisions;
|
||||
|
||||
public interface IOperationsPolicyResolutionService
|
||||
{
|
||||
ResolvedPolicyDecision ResolvePolicy(
|
||||
string policyName,
|
||||
IReadOnlyDictionary<string, string> facts,
|
||||
IReadOnlyDictionary<string, bool> featureFlags);
|
||||
}
|
||||
@ -0,0 +1,19 @@
|
||||
using Operations.Domain.Models;
|
||||
|
||||
namespace Operations.Domain.Decisions;
|
||||
|
||||
public sealed class OperationsPolicyResolutionService : IOperationsPolicyResolutionService
|
||||
{
|
||||
public ResolvedPolicyDecision ResolvePolicy(
|
||||
string policyName,
|
||||
IReadOnlyDictionary<string, string> facts,
|
||||
IReadOnlyDictionary<string, bool> featureFlags)
|
||||
{
|
||||
if (featureFlags.TryGetValue($"policy:{policyName}:disabled", out var disabled) && disabled)
|
||||
{
|
||||
return new ResolvedPolicyDecision(false, "Policy disabled by feature flag.");
|
||||
}
|
||||
|
||||
return new ResolvedPolicyDecision(true, "Policy allowed by default resolution.");
|
||||
}
|
||||
}
|
||||
3
src/Operations.Domain/Models/ResolvedPolicyDecision.cs
Normal file
3
src/Operations.Domain/Models/ResolvedPolicyDecision.cs
Normal file
@ -0,0 +1,3 @@
|
||||
namespace Operations.Domain.Models;
|
||||
|
||||
public sealed record ResolvedPolicyDecision(bool Allowed, string Explanation);
|
||||
9
src/Operations.Domain/Operations.Domain.csproj
Normal file
9
src/Operations.Domain/Operations.Domain.csproj
Normal file
@ -0,0 +1,9 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net10.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
Loading…
Reference in New Issue
Block a user