Skip to content

Commit 67bfb5e

Browse files
committed
Add Setting/Feature definition contributors to app modules; remove stub value providers
- Identity: 5 settings (password policy, lockout) + 1 feature (user registration) - TenantManagement: 1 feature (max tenants) - AuditLogging: 1 setting (retention days) + 1 feature (enable audit logging) - Wire all contributors via DI in ServiceCollectionExtensions - Add Settings project reference to Identity.Application and AuditLogging.Application - Remove 6 stub value providers (Global/Tenant/User for both Settings and Features) - Remove TryAddEnumerable registrations from framework DI extensions
1 parent 1365f4a commit 67bfb5e

32 files changed

Lines changed: 193 additions & 124 deletions

File tree

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
using ChengYuan.Features;
2+
3+
namespace ChengYuan.AuditLogging;
4+
5+
internal sealed class AuditLoggingFeatureDefinitionContributor : IFeatureDefinitionContributor
6+
{
7+
public void Define(IFeatureDefinitionContext context)
8+
{
9+
var group = context.AddGroup(AuditLoggingFeatures.GroupName, "Audit Logging");
10+
11+
group.AddFeature<bool>(AuditLoggingFeatures.EnableAuditLogging, true, "Enable audit logging");
12+
}
13+
}

src/Applications/AuditLogging/ChengYuan.AuditLogging.Application/AuditLoggingServiceCollectionExtensions.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
using ChengYuan.Auditing;
22
using ChengYuan.Authorization;
3+
using ChengYuan.Features;
4+
using ChengYuan.Settings;
35
using Microsoft.Extensions.DependencyInjection;
46
using Microsoft.Extensions.DependencyInjection.Extensions;
57

@@ -11,6 +13,8 @@ public static IServiceCollection AddAuditLogging(this IServiceCollection service
1113
{
1214
services.TryAddEnumerable(ServiceDescriptor.Singleton<IAuditLogSink, AuditLogStoreSink>());
1315
services.AddTransient<IPermissionDefinitionContributor, AuditLoggingPermissionDefinitionContributor>();
16+
services.AddTransient<ISettingDefinitionContributor, AuditLoggingSettingDefinitionContributor>();
17+
services.AddTransient<IFeatureDefinitionContributor, AuditLoggingFeatureDefinitionContributor>();
1418
return services;
1519
}
1620

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
using ChengYuan.Settings;
2+
3+
namespace ChengYuan.AuditLogging;
4+
5+
internal sealed class AuditLoggingSettingDefinitionContributor : ISettingDefinitionContributor
6+
{
7+
public void Define(ISettingDefinitionContext context)
8+
{
9+
var group = context.AddGroup(AuditLoggingSettings.GroupName, "Audit Logging");
10+
11+
group.AddSetting<int>(AuditLoggingSettings.RetentionDays, 90, "Audit log retention (days)");
12+
}
13+
}

src/Applications/AuditLogging/ChengYuan.AuditLogging.Application/ChengYuan.AuditLogging.Application.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
<ItemGroup>
88
<ProjectReference Include="..\..\..\Framework\Core\ChengYuan.Core.csproj" />
99
<ProjectReference Include="..\..\..\Framework\Authorization\ChengYuan.Authorization\ChengYuan.Authorization.csproj" />
10+
<ProjectReference Include="..\..\..\Framework\Settings\ChengYuan.Settings\ChengYuan.Settings.csproj" />
1011
<ProjectReference Include="..\ChengYuan.AuditLogging.Contracts\ChengYuan.AuditLogging.Contracts.csproj" />
1112
<ProjectReference Include="..\..\..\Framework\Auditing\ChengYuan.Auditing\ChengYuan.Auditing.csproj" />
1213
</ItemGroup>

src/Applications/AuditLogging/ChengYuan.AuditLogging.Application/packages.lock.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,14 @@
6060
"ChengYuan.ExecutionContext": "[0.2.10-local, )"
6161
}
6262
},
63+
"chengyuan.settings": {
64+
"type": "Project",
65+
"dependencies": {
66+
"ChengYuan.Core": "[0.2.10-local, )",
67+
"ChengYuan.ExecutionContext": "[0.2.10-local, )",
68+
"ChengYuan.MultiTenancy": "[0.2.10-local, )"
69+
}
70+
},
6371
"Microsoft.Extensions.Configuration.Abstractions": {
6472
"type": "CentralTransitive",
6573
"requested": "[10.0.5, )",
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
namespace ChengYuan.AuditLogging;
2+
3+
public static class AuditLoggingFeatures
4+
{
5+
public const string GroupName = "AuditLogging";
6+
7+
public const string EnableAuditLogging = GroupName + ".EnableAuditLogging";
8+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
namespace ChengYuan.AuditLogging;
2+
3+
public static class AuditLoggingSettings
4+
{
5+
public const string GroupName = "AuditLogging";
6+
7+
public const string RetentionDays = GroupName + ".RetentionDays";
8+
}

src/Applications/AuditLogging/ChengYuan.AuditLogging.Persistence/packages.lock.json

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,8 @@
269269
"ChengYuan.AuditLogging.Contracts": "[0.2.10-local, )",
270270
"ChengYuan.Auditing": "[0.2.10-local, )",
271271
"ChengYuan.Authorization": "[0.2.10-local, )",
272-
"ChengYuan.Core": "[0.2.10-local, )"
272+
"ChengYuan.Core": "[0.2.10-local, )",
273+
"ChengYuan.Settings": "[0.2.10-local, )"
273274
}
274275
},
275276
"chengyuan.auditlogging.contracts": {
@@ -342,6 +343,14 @@
342343
"ChengYuan.ExecutionContext": "[0.2.10-local, )"
343344
}
344345
},
346+
"chengyuan.settings": {
347+
"type": "Project",
348+
"dependencies": {
349+
"ChengYuan.Core": "[0.2.10-local, )",
350+
"ChengYuan.ExecutionContext": "[0.2.10-local, )",
351+
"ChengYuan.MultiTenancy": "[0.2.10-local, )"
352+
}
353+
},
345354
"Microsoft.EntityFrameworkCore": {
346355
"type": "CentralTransitive",
347356
"requested": "[10.0.5, )",

src/Applications/AuditLogging/ChengYuan.AuditLogging.Web/packages.lock.json

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,8 @@
243243
"ChengYuan.AuditLogging.Contracts": "[0.2.10-local, )",
244244
"ChengYuan.Auditing": "[0.2.10-local, )",
245245
"ChengYuan.Authorization": "[0.2.10-local, )",
246-
"ChengYuan.Core": "[0.2.10-local, )"
246+
"ChengYuan.Core": "[0.2.10-local, )",
247+
"ChengYuan.Settings": "[0.2.10-local, )"
247248
}
248249
},
249250
"chengyuan.auditlogging.contracts": {
@@ -322,6 +323,14 @@
322323
"ChengYuan.Core": "[0.2.10-local, )"
323324
}
324325
},
326+
"chengyuan.settings": {
327+
"type": "Project",
328+
"dependencies": {
329+
"ChengYuan.Core": "[0.2.10-local, )",
330+
"ChengYuan.ExecutionContext": "[0.2.10-local, )",
331+
"ChengYuan.MultiTenancy": "[0.2.10-local, )"
332+
}
333+
},
325334
"Microsoft.EntityFrameworkCore": {
326335
"type": "CentralTransitive",
327336
"requested": "[10.0.5, )",

src/Applications/Identity/ChengYuan.Identity.Application/ChengYuan.Identity.Application.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
<ItemGroup>
1212
<ProjectReference Include="..\..\..\Framework\Core\ChengYuan.Core.csproj" />
1313
<ProjectReference Include="..\..\..\Framework\Authorization\ChengYuan.Authorization\ChengYuan.Authorization.csproj" />
14+
<ProjectReference Include="..\..\..\Framework\Settings\ChengYuan.Settings\ChengYuan.Settings.csproj" />
1415
<ProjectReference Include="..\ChengYuan.Identity.Contracts\ChengYuan.Identity.Contracts.csproj" />
1516
<ProjectReference Include="..\ChengYuan.Identity.Domain\ChengYuan.Identity.Domain.csproj" />
1617
</ItemGroup>

0 commit comments

Comments
 (0)