diff --git a/apps/vben5/packages/@abp/platform/src/components/messages/email/EmailMessageModal.vue b/apps/vben5/packages/@abp/platform/src/components/messages/email/EmailMessageModal.vue index 4cab47c1d..5d9b70b89 100644 --- a/apps/vben5/packages/@abp/platform/src/components/messages/email/EmailMessageModal.vue +++ b/apps/vben5/packages/@abp/platform/src/components/messages/email/EmailMessageModal.vue @@ -1,34 +1,100 @@ diff --git a/aspnet-core/aspire/LINGYUN.Abp.MicroService.AppHost/AppHost.cs b/aspnet-core/aspire/LINGYUN.Abp.MicroService.AppHost/AppHost.cs index 227817e45..66ae8f36b 100644 --- a/aspnet-core/aspire/LINGYUN.Abp.MicroService.AppHost/AppHost.cs +++ b/aspnet-core/aspire/LINGYUN.Abp.MicroService.AppHost/AppHost.cs @@ -64,7 +64,7 @@ IResourceBuilder AddDotNetProject( string portName, string serviceSuffix = "Service", string migratorSuffix = "Migrator", - IResourceBuilder? waitProject = null) + params IResourceBuilder[]? waitProjects) where TDbMigrator : IProjectMetadata, new() where TProject : IProjectMetadata, new() { @@ -109,9 +109,12 @@ IResourceBuilder AddDotNetProject( .WaitFor(abpDb); } - if (waitProject != null) + if (waitProjects != null) { - service.WaitFor(waitProject); + foreach (var waitProject in waitProjects) + { + service = service.WaitFor(waitProject); + } } return service; @@ -139,7 +142,7 @@ var authServer = AddDotNetProject< migratorSuffix: "Migrator", port: 44385, portName: "auth", - waitProject: localizationService); + waitProjects: localizationService); // AdminService var adminService = AddDotNetProject< @@ -151,7 +154,7 @@ var adminService = AddDotNetProject< migratorSuffix: "Migrator", port: 30010, portName: "admin", - waitProject: authServer); + waitProjects: authServer); // IdentityService AddDotNetProject< @@ -163,7 +166,7 @@ AddDotNetProject< migratorSuffix: "Migrator", port: 30015, portName: "identity", - waitProject: authServer); + waitProjects: authServer); // TaskService var taskService = AddDotNetProject< @@ -175,7 +178,7 @@ var taskService = AddDotNetProject< migratorSuffix: "Migrator", port: 30040, portName: "task", - waitProject: adminService) + waitProjects: adminService) .WithHttpHealthCheck("/health/service"); // MessageService @@ -188,7 +191,7 @@ AddDotNetProject< migratorSuffix: "Migrator", port: 30020, portName: "message", - waitProject: taskService); + waitProjects: taskService); // WebhookService AddDotNetProject< @@ -200,7 +203,7 @@ AddDotNetProject< migratorSuffix: "Migrator", port: 30045, portName: "webhook", - waitProject: taskService); + waitProjects: taskService); // PlatformService AddDotNetProject< @@ -212,7 +215,7 @@ AddDotNetProject< migratorSuffix: "Migrator", port: 30025, portName: "platform", - waitProject: adminService); + waitProjects: adminService); // WeChatService builder.AddProject("WeChatService") @@ -252,7 +255,7 @@ AddDotNetProject< migratorSuffix: "Migrator", port: 30070, portName: "ai", - waitProject: localizationService); + waitProjects: localizationService); // ApiGateway var apigateway = builder.AddProject("ApiGateway") diff --git a/aspnet-core/aspire/LINGYUN.Abp.MicroService.AuthServer.DbMigrator/AuthServerDbMigratorHostedService.cs b/aspnet-core/aspire/LINGYUN.Abp.MicroService.AuthServer.DbMigrator/AuthServerDbMigratorHostedService.cs index a60c2a5a4..1de910625 100644 --- a/aspnet-core/aspire/LINGYUN.Abp.MicroService.AuthServer.DbMigrator/AuthServerDbMigratorHostedService.cs +++ b/aspnet-core/aspire/LINGYUN.Abp.MicroService.AuthServer.DbMigrator/AuthServerDbMigratorHostedService.cs @@ -36,6 +36,11 @@ public class AuthServerDbMigratorHostedService : IHostedService .GetRequiredService() .CheckAndApplyDatabaseMigrationsAsync(); + await application + .ServiceProvider + .GetRequiredService() + .SeedAsync(new DataSeedContext()); + await application.ShutdownAsync(); _hostApplicationLifetime.StopApplication(); diff --git a/aspnet-core/aspire/LINGYUN.Abp.MicroService.AuthServer.DbMigrator/AuthServerDbMigratorModule.cs b/aspnet-core/aspire/LINGYUN.Abp.MicroService.AuthServer.DbMigrator/AuthServerDbMigratorModule.cs index 1a491e8a2..70a294486 100644 --- a/aspnet-core/aspire/LINGYUN.Abp.MicroService.AuthServer.DbMigrator/AuthServerDbMigratorModule.cs +++ b/aspnet-core/aspire/LINGYUN.Abp.MicroService.AuthServer.DbMigrator/AuthServerDbMigratorModule.cs @@ -1,10 +1,16 @@ -using Volo.Abp.Autofac; +using LINGYUN.Abp.Identity.Notifications; +using LINGYUN.Abp.Notifications.Common; +using LINGYUN.Abp.Notifications.EntityFrameworkCore; +using Volo.Abp.Autofac; using Volo.Abp.Modularity; namespace LINGYUN.Abp.MicroService.AuthServer; [DependsOn( typeof(AbpAutofacModule), + typeof(AbpNotificationsCommonModule), + typeof(AbpIdentityNotificationsModule), + typeof(AbpNotificationsEntityFrameworkCoreModule), typeof(AuthServerMigrationsEntityFrameworkCoreModule))] public class AuthServerDbMigratorModule : AbpModule { diff --git a/aspnet-core/aspire/LINGYUN.Abp.MicroService.AuthServer.DbMigrator/AuthServerInitializeDataSeeder.cs b/aspnet-core/aspire/LINGYUN.Abp.MicroService.AuthServer.DbMigrator/AuthServerInitializeDataSeeder.cs new file mode 100644 index 000000000..50fd4da16 --- /dev/null +++ b/aspnet-core/aspire/LINGYUN.Abp.MicroService.AuthServer.DbMigrator/AuthServerInitializeDataSeeder.cs @@ -0,0 +1,19 @@ +using LINGYUN.Abp.MicroService.AuthServer.DataSeeds; +using Volo.Abp.Data; +using Volo.Abp.DependencyInjection; + +namespace LINGYUN.Abp.MicroService.AuthServer; + +public class AuthServerInitializeDataSeeder : ITransientDependency +{ + protected IdentityUserNotificationDataSeeder UserNotificationDataSeeder { get; } + public AuthServerInitializeDataSeeder(IdentityUserNotificationDataSeeder userNotificationDataSeeder) + { + UserNotificationDataSeeder = userNotificationDataSeeder; + } + + public virtual async Task SeedAsync(DataSeedContext context) + { + await UserNotificationDataSeeder.SeedAsync(context); + } +} diff --git a/aspnet-core/aspire/LINGYUN.Abp.MicroService.AuthServer.DbMigrator/DataSeeds/IdentityUserNotificationDataSeeder.cs b/aspnet-core/aspire/LINGYUN.Abp.MicroService.AuthServer.DbMigrator/DataSeeds/IdentityUserNotificationDataSeeder.cs new file mode 100644 index 000000000..b89daab22 --- /dev/null +++ b/aspnet-core/aspire/LINGYUN.Abp.MicroService.AuthServer.DbMigrator/DataSeeds/IdentityUserNotificationDataSeeder.cs @@ -0,0 +1,89 @@ +using LINGYUN.Abp.Identity.Notifications; +using LINGYUN.Abp.Notifications; +using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Logging.Abstractions; +using Volo.Abp.Data; +using Volo.Abp.DependencyInjection; +using Volo.Abp.Identity; +using Volo.Abp.Users; + +namespace LINGYUN.Abp.MicroService.AuthServer.DataSeeds; + +public class IdentityUserNotificationDataSeeder : ITransientDependency +{ + public ILogger Logger { protected get; set; } + protected IdentityUserManager IdentityUserManager { get; } + protected INotificationSender NotificationSender { get; } + protected INotificationSubscriptionManager NotificationSubscriptionManager { get; } + public IdentityUserNotificationDataSeeder( + IdentityUserManager identityUserManager, + INotificationSender notificationSender, + INotificationSubscriptionManager notificationSubscriptionManager) + { + IdentityUserManager = identityUserManager; + NotificationSender = notificationSender; + NotificationSubscriptionManager = notificationSubscriptionManager; + + Logger = NullLogger.Instance; + } + + public virtual async Task SeedAsync(DataSeedContext context) + { + await SubscribeDefaultNotifierAsync(context); + } + + protected async virtual Task SubscribeDefaultNotifierAsync(DataSeedContext context) + { + var user = await IdentityUserManager.FindByNameAsync("admin"); + if (user == null) + { + Logger.LogInformation("No user information named {UserName} was found, so default messages cannot be subscribed to.", "admin"); + return; + } + Logger.LogInformation("User {UserId} has subscribed to default notifications.", user.Id); + var userIdentifer = new UserIdentifier(user.Id, user.UserName); + // 订阅内置通知 + await NotificationSubscriptionManager + .SubscribeAsync( + context.TenantId, + userIdentifer, + DefaultNotifications.SystemNotice); + await NotificationSubscriptionManager + .SubscribeAsync( + context.TenantId, + userIdentifer, + DefaultNotifications.OnsideNotice); + await NotificationSubscriptionManager + .SubscribeAsync( + context.TenantId, + userIdentifer, + DefaultNotifications.ActivityNotice); + + // 新用户订阅会话过期通知 + await NotificationSubscriptionManager + .SubscribeAsync( + context.TenantId, + userIdentifer, + IdentityNotificationNames.Session.ExpirationSession); + // 新用户订阅不活跃用户相关通知 + await NotificationSubscriptionManager + .SubscribeAsync( + context.TenantId, + userIdentifer, + IdentityNotificationNames.IdentityUser.InactiveUserReminderNotifier); + await NotificationSubscriptionManager + .SubscribeAsync( + context.TenantId, + userIdentifer, + IdentityNotificationNames.IdentityUser.InactiveUserDeactivationNotifier); + + // 订阅用户欢迎消息 + await NotificationSubscriptionManager + .SubscribeAsync( + context.TenantId, + userIdentifer, + UserNotificationNames.WelcomeToApplication); + + Logger.LogInformation("User {UserId} is subscribed to notifications by default.", user.Id); + } +} diff --git a/aspnet-core/aspire/LINGYUN.Abp.MicroService.AuthServer.DbMigrator/LINGYUN.Abp.MicroService.AuthServer.DbMigrator.csproj b/aspnet-core/aspire/LINGYUN.Abp.MicroService.AuthServer.DbMigrator/LINGYUN.Abp.MicroService.AuthServer.DbMigrator.csproj index 71b74286f..35f501859 100644 --- a/aspnet-core/aspire/LINGYUN.Abp.MicroService.AuthServer.DbMigrator/LINGYUN.Abp.MicroService.AuthServer.DbMigrator.csproj +++ b/aspnet-core/aspire/LINGYUN.Abp.MicroService.AuthServer.DbMigrator/LINGYUN.Abp.MicroService.AuthServer.DbMigrator.csproj @@ -28,6 +28,9 @@ + + + diff --git a/aspnet-core/aspire/LINGYUN.Abp.MicroService.AuthServer.EntityFrameworkCore/DataSeeds/IdentityUserRoleDataSeeder.cs b/aspnet-core/aspire/LINGYUN.Abp.MicroService.AuthServer.EntityFrameworkCore/DataSeeds/IdentityUserRoleDataSeeder.cs index 4c568f4bc..2092997be 100644 --- a/aspnet-core/aspire/LINGYUN.Abp.MicroService.AuthServer.EntityFrameworkCore/DataSeeds/IdentityUserRoleDataSeeder.cs +++ b/aspnet-core/aspire/LINGYUN.Abp.MicroService.AuthServer.EntityFrameworkCore/DataSeeds/IdentityUserRoleDataSeeder.cs @@ -6,6 +6,7 @@ using Volo.Abp.Data; using Volo.Abp.DependencyInjection; using Volo.Abp.Guids; using Volo.Abp.Identity; +using Volo.Abp.Roles; namespace LINGYUN.Abp.MicroService.AuthServer.DataSeeds; public class IdentityUserRoleDataSeeder : ITransientDependency @@ -54,7 +55,7 @@ public class IdentityUserRoleDataSeeder : ITransientDependency { await IdentityOptions.SetAsync(); - const string adminRoleName = "admin"; + const string adminRoleName = AbpRoleConsts.AdminRoleName; var adminUserName = context[AdminUserNamePropertyName] as string ?? AdminUserNameDefaultValue; Guid adminRoleId; @@ -86,10 +87,9 @@ public class IdentityUserRoleDataSeeder : ITransientDependency var adminEmailAddress = context[AdminEmailPropertyName] as string ?? AdminEmailDefaultValue; var adminPassword = context[AdminPasswordPropertyName] as string ?? AdminPasswordDefaultValue; - var adminUser = await UserManager.FindByNameAsync(adminUserName); - if (adminUser == null) + if (await UserManager.FindByNameAsync(adminUserName) == null) { - adminUser = new IdentityUser( + var adminUser = new IdentityUser( adminUserId, adminUserName, adminEmailAddress, @@ -106,7 +106,7 @@ public class IdentityUserRoleDataSeeder : ITransientDependency private async Task SeedDefaultRoleAsync(DataSeedContext context) { const string defaultRoleName = "Users"; - if (await RoleManager.FindByNameAsync(defaultRoleName) != null) + if (await RoleManager.FindByNameAsync(defaultRoleName) == null) { var roleId = GuidGenerator.Create(); var defaultRole = new IdentityRole( diff --git a/aspnet-core/aspire/LINGYUN.Abp.MicroService.AuthServer/AuthServerModule.Configure.cs b/aspnet-core/aspire/LINGYUN.Abp.MicroService.AuthServer/AuthServerModule.Configure.cs index cce2f4351..d43000e6d 100644 --- a/aspnet-core/aspire/LINGYUN.Abp.MicroService.AuthServer/AuthServerModule.Configure.cs +++ b/aspnet-core/aspire/LINGYUN.Abp.MicroService.AuthServer/AuthServerModule.Configure.cs @@ -116,13 +116,10 @@ public partial class AuthServerModule { builder.AddValidation(options => { - var validAudiences = configuration.GetSection("AuthServer:ValidAudiences").Get>(); - if (validAudiences?.Count > 0) + var validAudiences = configuration.GetSection("AuthServer:ValidAudiences").Get(); + if (validAudiences?.Length > 0) { - foreach (var audience in validAudiences) - { - options.AddAudiences(audience); - } + options.AddAudiences(validAudiences); } options.UseLocalServer(); @@ -427,6 +424,11 @@ public partial class AuthServerModule options.TokenValidationParameters.ValidIssuers = validIssuers; options.TokenValidationParameters.IssuerValidator = TokenWildcardIssuerValidator.IssuerValidator; } + var validAudiences = configuration.GetSection("AuthServer:ValidAudiences").Get>(); + if (validAudiences?.Count > 0) + { + options.TokenValidationParameters.ValidAudiences = validAudiences; + } }); services diff --git a/aspnet-core/aspire/LINGYUN.Abp.MicroService.AuthServer/appsettings.Development.json b/aspnet-core/aspire/LINGYUN.Abp.MicroService.AuthServer/appsettings.Development.json index 09e85a1bd..d2e317850 100644 --- a/aspnet-core/aspire/LINGYUN.Abp.MicroService.AuthServer/appsettings.Development.json +++ b/aspnet-core/aspire/LINGYUN.Abp.MicroService.AuthServer/appsettings.Development.json @@ -101,7 +101,21 @@ "AuthServer": { "Authority": "http://localhost:44385/", "Audience": "auth-server", - "ValidAudiences": [ "lingyun-abp-application" ], + "ValidAudiences": [ + "api-gateway", + "auth-server", + "admin-service", + "ai-service", + "identity-service", + "localization-service", + "message-service", + "platform-service", + "task-service", + "webhook-service", + "wechat-service", + "workflow-service", + "lingyun-abp-application" + ], "MapInboundClaims": false, "RequireHttpsMetadata": false }, @@ -138,7 +152,8 @@ "Override": { "System": "Warning", "Microsoft": "Warning", - "DotNetCore": "Debug" + "DotNetCore": "Warning", + "OpenIddict": "Warning" } }, "WriteTo": [ diff --git a/aspnet-core/aspire/LINGYUN.Abp.MicroService.AuthServer/appsettings.json b/aspnet-core/aspire/LINGYUN.Abp.MicroService.AuthServer/appsettings.json index b14a350fb..cd3e222d4 100644 --- a/aspnet-core/aspire/LINGYUN.Abp.MicroService.AuthServer/appsettings.json +++ b/aspnet-core/aspire/LINGYUN.Abp.MicroService.AuthServer/appsettings.json @@ -34,7 +34,8 @@ "Override": { "System": "Warning", "Microsoft": "Warning", - "DotNetCore": "Information" + "DotNetCore": "Warning", + "OpenIddict": "Warning" } }, "Enrich": [ "FromLogContext", "WithProcessId", "WithThreadId", "WithEnvironmentName", "WithMachineName", "WithApplicationName", "WithUniqueId" ], diff --git a/aspnet-core/aspire/LINGYUN.Abp.MicroService.IdentityService/Handlers/IdentitySessionAccessEventHandler.cs b/aspnet-core/aspire/LINGYUN.Abp.MicroService.IdentityService/Handlers/IdentitySessionAccessEventHandler.cs index 8bf28e440..1ac81aee3 100644 --- a/aspnet-core/aspire/LINGYUN.Abp.MicroService.IdentityService/Handlers/IdentitySessionAccessEventHandler.cs +++ b/aspnet-core/aspire/LINGYUN.Abp.MicroService.IdentityService/Handlers/IdentitySessionAccessEventHandler.cs @@ -86,8 +86,7 @@ public class IdentitySessionAccessEventHandler : [UnitOfWork] public async virtual Task HandleEventAsync(IdentityUserSessionPasswordChangedEto eventData) { - if (!eventData.SessionId.IsNullOrWhiteSpace() && - Guid.TryParse(eventData.SessionId, out var exceptSessionId)) + if (!eventData.SessionId.IsNullOrWhiteSpace()) { // 用户密码更新使会话过期 var lockKey = $"{nameof(IdentitySessionAccessEventHandler)}_{nameof(IdentityUserSessionPasswordChangedEto)}"; @@ -103,7 +102,9 @@ public class IdentitySessionAccessEventHandler : Logger.LogDebug("Due to the password update of user {Id}, all sessions have been revoked.", eventData.Id); - await IdentitySessionStore.RevokeAllAsync(eventData.Id, exceptSessionId); + var session = await IdentitySessionStore.FindAsync(eventData.SessionId); + + await IdentitySessionStore.RevokeAllAsync(eventData.Id, session?.Id); } } diff --git a/aspnet-core/aspire/LINGYUN.Abp.MicroService.MessageService.EntityFrameworkCore/DataSeeds/NotificationDataSeeder.cs b/aspnet-core/aspire/LINGYUN.Abp.MicroService.MessageService.EntityFrameworkCore/DataSeeds/NotificationDataSeeder.cs index 59a2e1d4f..af6339ac7 100644 --- a/aspnet-core/aspire/LINGYUN.Abp.MicroService.MessageService.EntityFrameworkCore/DataSeeds/NotificationDataSeeder.cs +++ b/aspnet-core/aspire/LINGYUN.Abp.MicroService.MessageService.EntityFrameworkCore/DataSeeds/NotificationDataSeeder.cs @@ -7,7 +7,6 @@ using System.Threading.Tasks; using Volo.Abp.Data; using Volo.Abp.DependencyInjection; using Volo.Abp.MultiTenancy; -using Volo.Abp.Users; namespace LINGYUN.Abp.MicroService.MessageService.DataSeeds; @@ -28,45 +27,9 @@ public class NotificationDataSeeder : ITransientDependency public virtual async Task SeedAsync(DataSeedContext context) { - await SubscribeDefaultNotifierAsync(context); await SeedWelcomeNotifierAsync(context); } - public async virtual Task SubscribeDefaultNotifierAsync(DataSeedContext context) - { - if (!context.Properties.TryGetValue(MessageServiceDataSeedConsts.AdminUserIdPropertyName, out var userIdString) || - !Guid.TryParse(userIdString?.ToString(), out var adminUserId)) - { - - return; - } - var adminUserName = context.Properties.GetOrDefault(MessageServiceDataSeedConsts.AdminUserNamePropertyName)?.ToString() - ?? MessageServiceDataSeedConsts.AdminUserNameDefaultValue; - var userIdentifer = new UserIdentifier(adminUserId, adminUserName); - // 订阅内置通知 - await NotificationSubscriptionManager - .SubscribeAsync( - context.TenantId, - userIdentifer, - DefaultNotifications.SystemNotice); - await NotificationSubscriptionManager - .SubscribeAsync( - context.TenantId, - userIdentifer, - DefaultNotifications.OnsideNotice); - await NotificationSubscriptionManager - .SubscribeAsync( - context.TenantId, - userIdentifer, - DefaultNotifications.ActivityNotice); - // 订阅用户欢迎消息 - await NotificationSubscriptionManager - .SubscribeAsync( - context.TenantId, - userIdentifer, - UserNotificationNames.WelcomeToApplication); - } - public async virtual Task SeedWelcomeNotifierAsync(DataSeedContext context) { try diff --git a/aspnet-core/framework/navigation/LINGYUN.Abp.UI.Navigation/LINGYUN/Abp/UI/Navigation/ApplicationMenu.cs b/aspnet-core/framework/navigation/LINGYUN.Abp.UI.Navigation/LINGYUN/Abp/UI/Navigation/ApplicationMenu.cs index e1a5ad352..e8374f67d 100644 --- a/aspnet-core/framework/navigation/LINGYUN.Abp.UI.Navigation/LINGYUN/Abp/UI/Navigation/ApplicationMenu.cs +++ b/aspnet-core/framework/navigation/LINGYUN.Abp.UI.Navigation/LINGYUN/Abp/UI/Navigation/ApplicationMenu.cs @@ -105,6 +105,19 @@ public class ApplicationMenu : IHasMenuItems, IHasExtraProperties return menuItem; } + public ApplicationMenu WithRoles(string[] roles) + { + this.SetProperty("roles", roles.JoinAsString(";")); + return this; + } + + public string[] GetRoles() + { + var roles = this.GetProperty("roles") ?? ""; + + return roles.Split(";"); + } + public override string ToString() { return $"[ApplicationMenu] Name = {Name}"; diff --git a/aspnet-core/migrations/LY.MicroService.AuthServer.DbMigrator/AuthServerDbMigratorHostedService.cs b/aspnet-core/migrations/LY.MicroService.AuthServer.DbMigrator/AuthServerDbMigratorHostedService.cs index e75054f19..012bc81e9 100644 --- a/aspnet-core/migrations/LY.MicroService.AuthServer.DbMigrator/AuthServerDbMigratorHostedService.cs +++ b/aspnet-core/migrations/LY.MicroService.AuthServer.DbMigrator/AuthServerDbMigratorHostedService.cs @@ -42,6 +42,11 @@ public class AuthServerDbMigratorHostedService : IHostedService .GetRequiredService() .CheckAndApplyDatabaseMigrationsAsync(); + await application + .ServiceProvider + .GetRequiredService() + .SeedAsync(new DataSeedContext()); + await application.ShutdownAsync(); _hostApplicationLifetime.StopApplication(); diff --git a/aspnet-core/migrations/LY.MicroService.AuthServer.DbMigrator/AuthServerDbMigratorModule.cs b/aspnet-core/migrations/LY.MicroService.AuthServer.DbMigrator/AuthServerDbMigratorModule.cs index 113b88e51..6020b2320 100644 --- a/aspnet-core/migrations/LY.MicroService.AuthServer.DbMigrator/AuthServerDbMigratorModule.cs +++ b/aspnet-core/migrations/LY.MicroService.AuthServer.DbMigrator/AuthServerDbMigratorModule.cs @@ -1,4 +1,7 @@ -using LY.MicroService.AuthServer.EntityFrameworkCore; +using LINGYUN.Abp.Identity.Notifications; +using LINGYUN.Abp.Notifications.Common; +using LINGYUN.Abp.Notifications.EntityFrameworkCore; +using LY.MicroService.AuthServer.EntityFrameworkCore; using Volo.Abp.Autofac; using Volo.Abp.Modularity; @@ -6,6 +9,9 @@ namespace LY.MicroService.AuthServer.DbMigrator; [DependsOn( typeof(AuthServerMigrationsEntityFrameworkCoreModule), + typeof(AbpNotificationsEntityFrameworkCoreModule), + typeof(AbpNotificationsCommonModule), + typeof(AbpIdentityNotificationsModule), typeof(AbpAutofacModule) )] public partial class AuthServerDbMigratorModule : AbpModule diff --git a/aspnet-core/migrations/LY.MicroService.AuthServer.DbMigrator/AuthServerInitializeDataSeeder.cs b/aspnet-core/migrations/LY.MicroService.AuthServer.DbMigrator/AuthServerInitializeDataSeeder.cs new file mode 100644 index 000000000..0f7eb8b93 --- /dev/null +++ b/aspnet-core/migrations/LY.MicroService.AuthServer.DbMigrator/AuthServerInitializeDataSeeder.cs @@ -0,0 +1,20 @@ +using LY.MicroService.AuthServer.DbMigrator.DataSeeds; +using Volo.Abp.Data; +using Volo.Abp.DependencyInjection; + +namespace LY.MicroService.AuthServer.DbMigrator; + +public class AuthServerInitializeDataSeeder : ITransientDependency +{ + protected IdentityUserNotificationDataSeeder UserNotificationDataSeeder { get; } + public AuthServerInitializeDataSeeder(IdentityUserNotificationDataSeeder userNotificationDataSeeder) + { + UserNotificationDataSeeder = userNotificationDataSeeder; + } + + public virtual async Task SeedAsync(DataSeedContext context) + { + await UserNotificationDataSeeder.SeedAsync(context); + } +} + diff --git a/aspnet-core/migrations/LY.MicroService.AuthServer.DbMigrator/DataSeeds/IdentityUserNotificationDataSeeder.cs b/aspnet-core/migrations/LY.MicroService.AuthServer.DbMigrator/DataSeeds/IdentityUserNotificationDataSeeder.cs new file mode 100644 index 000000000..56a7d5abc --- /dev/null +++ b/aspnet-core/migrations/LY.MicroService.AuthServer.DbMigrator/DataSeeds/IdentityUserNotificationDataSeeder.cs @@ -0,0 +1,89 @@ +using LINGYUN.Abp.Identity.Notifications; +using LINGYUN.Abp.Notifications; +using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Logging.Abstractions; +using Volo.Abp.Data; +using Volo.Abp.DependencyInjection; +using Volo.Abp.Identity; +using Volo.Abp.Users; + +namespace LY.MicroService.AuthServer.DbMigrator.DataSeeds; + +public class IdentityUserNotificationDataSeeder : ITransientDependency +{ + public ILogger Logger { protected get; set; } + protected IdentityUserManager IdentityUserManager { get; } + protected INotificationSender NotificationSender { get; } + protected INotificationSubscriptionManager NotificationSubscriptionManager { get; } + public IdentityUserNotificationDataSeeder( + IdentityUserManager identityUserManager, + INotificationSender notificationSender, + INotificationSubscriptionManager notificationSubscriptionManager) + { + IdentityUserManager = identityUserManager; + NotificationSender = notificationSender; + NotificationSubscriptionManager = notificationSubscriptionManager; + + Logger = NullLogger.Instance; + } + + public virtual async Task SeedAsync(DataSeedContext context) + { + await SubscribeDefaultNotifierAsync(context); + } + + protected async virtual Task SubscribeDefaultNotifierAsync(DataSeedContext context) + { + var user = await IdentityUserManager.FindByNameAsync("admin"); + if (user == null) + { + Logger.LogInformation("No user information named {UserName} was found, so default messages cannot be subscribed to.", "admin"); + return; + } + Logger.LogInformation("User {UserId} has subscribed to default notifications.", user.Id); + var userIdentifer = new UserIdentifier(user.Id, user.UserName); + // 订阅内置通知 + await NotificationSubscriptionManager + .SubscribeAsync( + context.TenantId, + userIdentifer, + DefaultNotifications.SystemNotice); + await NotificationSubscriptionManager + .SubscribeAsync( + context.TenantId, + userIdentifer, + DefaultNotifications.OnsideNotice); + await NotificationSubscriptionManager + .SubscribeAsync( + context.TenantId, + userIdentifer, + DefaultNotifications.ActivityNotice); + + // 新用户订阅会话过期通知 + await NotificationSubscriptionManager + .SubscribeAsync( + context.TenantId, + userIdentifer, + IdentityNotificationNames.Session.ExpirationSession); + // 新用户订阅不活跃用户相关通知 + await NotificationSubscriptionManager + .SubscribeAsync( + context.TenantId, + userIdentifer, + IdentityNotificationNames.IdentityUser.InactiveUserReminderNotifier); + await NotificationSubscriptionManager + .SubscribeAsync( + context.TenantId, + userIdentifer, + IdentityNotificationNames.IdentityUser.InactiveUserDeactivationNotifier); + + // 订阅用户欢迎消息 + await NotificationSubscriptionManager + .SubscribeAsync( + context.TenantId, + userIdentifer, + UserNotificationNames.WelcomeToApplication); + + Logger.LogInformation("User {UserId} is subscribed to notifications by default.", user.Id); + } +} diff --git a/aspnet-core/migrations/LY.MicroService.AuthServer.DbMigrator/LY.MicroService.AuthServer.DbMigrator.csproj b/aspnet-core/migrations/LY.MicroService.AuthServer.DbMigrator/LY.MicroService.AuthServer.DbMigrator.csproj index 45c00f202..52fc6311b 100644 --- a/aspnet-core/migrations/LY.MicroService.AuthServer.DbMigrator/LY.MicroService.AuthServer.DbMigrator.csproj +++ b/aspnet-core/migrations/LY.MicroService.AuthServer.DbMigrator/LY.MicroService.AuthServer.DbMigrator.csproj @@ -32,6 +32,9 @@ + + + diff --git a/aspnet-core/migrations/LY.MicroService.RealtimeMessage.EntityFrameworkCore/DataSeeds/NotificationDataSeeder.cs b/aspnet-core/migrations/LY.MicroService.RealtimeMessage.EntityFrameworkCore/DataSeeds/NotificationDataSeeder.cs new file mode 100644 index 000000000..4be1c0958 --- /dev/null +++ b/aspnet-core/migrations/LY.MicroService.RealtimeMessage.EntityFrameworkCore/DataSeeds/NotificationDataSeeder.cs @@ -0,0 +1,139 @@ +using LINGYUN.Abp.Notifications; +using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Logging.Abstractions; +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Volo.Abp.Data; +using Volo.Abp.DependencyInjection; +using Volo.Abp.MultiTenancy; +using Volo.Abp.Users; + +namespace LY.MicroService.RealtimeMessage.EntityFrameworkCore.DataSeeds; + +public class NotificationDataSeeder : ITransientDependency +{ + public ILogger Logger { protected get; set; } + protected INotificationSender NotificationSender { get; } + protected INotificationSubscriptionManager NotificationSubscriptionManager { get; } + public NotificationDataSeeder( + INotificationSender notificationSender, + INotificationSubscriptionManager notificationSubscriptionManager) + { + NotificationSender = notificationSender; + NotificationSubscriptionManager = notificationSubscriptionManager; + + Logger = NullLogger.Instance; + } + + public virtual async Task SeedAsync(DataSeedContext context) + { + await SubscribeDefaultNotifierAsync(context); + await SeedWelcomeNotifierAsync(context); + } + + public async virtual Task SubscribeDefaultNotifierAsync(DataSeedContext context) + { + if (!context.Properties.TryGetValue(RealtimeMessageDataSeedConsts.AdminUserIdPropertyName, out var userIdString) || + !Guid.TryParse(userIdString?.ToString(), out var adminUserId)) + { + return; + } + var adminUserName = context.Properties.GetOrDefault(RealtimeMessageDataSeedConsts.AdminUserNamePropertyName)?.ToString() + ?? RealtimeMessageDataSeedConsts.AdminUserNameDefaultValue; + var userIdentifer = new UserIdentifier(adminUserId, adminUserName); + // 订阅内置通知 + await NotificationSubscriptionManager + .SubscribeAsync( + context.TenantId, + userIdentifer, + DefaultNotifications.SystemNotice); + await NotificationSubscriptionManager + .SubscribeAsync( + context.TenantId, + userIdentifer, + DefaultNotifications.OnsideNotice); + await NotificationSubscriptionManager + .SubscribeAsync( + context.TenantId, + userIdentifer, + DefaultNotifications.ActivityNotice); + + // 新用户订阅会话过期通知 + await NotificationSubscriptionManager + .SubscribeAsync( + context.TenantId, + userIdentifer, + "AbpIdentity.Session.Expiration"); + // 新用户订阅不活跃用户相关通知 + await NotificationSubscriptionManager + .SubscribeAsync( + context.TenantId, + userIdentifer, + "AbpIdentity.IdentityUser.InactiveUserReminderNotifier"); + await NotificationSubscriptionManager + .SubscribeAsync( + context.TenantId, + userIdentifer, + "AbpIdentity.IdentityUser.InactiveUserDeactivationNotifier"); + + // 订阅用户欢迎消息 + await NotificationSubscriptionManager + .SubscribeAsync( + context.TenantId, + userIdentifer, + UserNotificationNames.WelcomeToApplication); + } + + public async virtual Task SeedWelcomeNotifierAsync(DataSeedContext context) + { + try + { + if (!context.TenantId.HasValue) + { + return; + } + if (!context.Properties.TryGetValue(RealtimeMessageDataSeedConsts.AdminUserIdPropertyName, out var userIdString) || + !Guid.TryParse(userIdString?.ToString(), out var adminUserId)) + { + return; + } + var adminEmailAddress = context.Properties.GetOrDefault(RealtimeMessageDataSeedConsts.AdminEmailPropertyName)?.ToString() + ?? RealtimeMessageDataSeedConsts.AdminEmailDefaultValue; + var adminUserName = context.Properties.GetOrDefault(RealtimeMessageDataSeedConsts.AdminUserNamePropertyName)?.ToString() + ?? RealtimeMessageDataSeedConsts.AdminUserNameDefaultValue; + + var tenantAdminUserIdentifier = new UserIdentifier(adminUserId, adminEmailAddress); + + // 租户管理员订阅事件 + await NotificationSubscriptionManager + .SubscribeAsync( + context.TenantId, + tenantAdminUserIdentifier, + TenantNotificationNames.NewTenantRegistered); + + Logger.LogInformation("publish new tenant notification.."); + await NotificationSender.SendNofiterAsync( + TenantNotificationNames.NewTenantRegistered, + new NotificationTemplate( + TenantNotificationNames.NewTenantRegistered, + formUser: adminEmailAddress, + data: new Dictionary + { + { "name", adminUserName }, + { "email", adminEmailAddress }, + { "id", context.TenantId }, + }), + tenantAdminUserIdentifier, + context.TenantId, + NotificationSeverity.Success); + + Logger.LogInformation("tenant administrator subscribes to new tenant events.."); + } + catch (Exception ex) + { + Logger.LogWarning(ex, "Failed to send the tenant initialization notification."); + } + } +} + diff --git a/aspnet-core/migrations/LY.MicroService.RealtimeMessage.EntityFrameworkCore/RealtimeMessageDataSeedConsts.cs b/aspnet-core/migrations/LY.MicroService.RealtimeMessage.EntityFrameworkCore/RealtimeMessageDataSeedConsts.cs new file mode 100644 index 000000000..76860e115 --- /dev/null +++ b/aspnet-core/migrations/LY.MicroService.RealtimeMessage.EntityFrameworkCore/RealtimeMessageDataSeedConsts.cs @@ -0,0 +1,10 @@ +namespace LY.MicroService.RealtimeMessage.EntityFrameworkCore; + +public class RealtimeMessageDataSeedConsts +{ + public const string AdminUserIdPropertyName = "AdminUserId"; + public const string AdminEmailPropertyName = "AdminEmail"; + public const string AdminEmailDefaultValue = "admin@abp.io"; + public const string AdminUserNamePropertyName = "AdminUserName"; + public const string AdminUserNameDefaultValue = "admin"; +} diff --git a/aspnet-core/migrations/LY.MicroService.RealtimeMessage.EntityFrameworkCore/RealtimeMessageDataSeeder.cs b/aspnet-core/migrations/LY.MicroService.RealtimeMessage.EntityFrameworkCore/RealtimeMessageDataSeeder.cs new file mode 100644 index 000000000..896c3640a --- /dev/null +++ b/aspnet-core/migrations/LY.MicroService.RealtimeMessage.EntityFrameworkCore/RealtimeMessageDataSeeder.cs @@ -0,0 +1,33 @@ +using LY.MicroService.RealtimeMessage.EntityFrameworkCore.DataSeeds; +using System.Threading.Tasks; +using Volo.Abp.Data; +using Volo.Abp.DependencyInjection; +using Volo.Abp.MultiTenancy; + +namespace LY.MicroService.RealtimeMessage.EntityFrameworkCore; + +public class RealtimeMessageDataSeeder : ITransientDependency +{ + protected NotificationDataSeeder NotificationDataSeeder { get; } + protected ICurrentTenant CurrentTenant { get; } + public RealtimeMessageDataSeeder( + ICurrentTenant currentTenant, + NotificationDataSeeder notificationDataSeeder) + { + CurrentTenant = currentTenant; + NotificationDataSeeder = notificationDataSeeder; + } + + public async virtual Task SeedAsync(DataSeedContext context) + { + using (CurrentTenant.Change(context.TenantId)) + { + await SeedNotificationAsync(context); + } + } + + private async Task SeedNotificationAsync(DataSeedContext context) + { + await NotificationDataSeeder.SeedAsync(context); + } +} diff --git a/aspnet-core/migrations/LY.MicroService.RealtimeMessage.EntityFrameworkCore/RealtimeMessageDbMigrationService.cs b/aspnet-core/migrations/LY.MicroService.RealtimeMessage.EntityFrameworkCore/RealtimeMessageDbMigrationService.cs index 19b14fbe8..4bbf9a0eb 100644 --- a/aspnet-core/migrations/LY.MicroService.RealtimeMessage.EntityFrameworkCore/RealtimeMessageDbMigrationService.cs +++ b/aspnet-core/migrations/LY.MicroService.RealtimeMessage.EntityFrameworkCore/RealtimeMessageDbMigrationService.cs @@ -1,6 +1,7 @@ using LINGYUN.Abp.Data.DbMigrator; using Microsoft.Extensions.Logging; using System; +using System.Threading.Tasks; using Volo.Abp.Data; using Volo.Abp.DependencyInjection; using Volo.Abp.DistributedLocking; @@ -12,7 +13,10 @@ namespace LY.MicroService.RealtimeMessage.EntityFrameworkCore; public class RealtimeMessageDbMigrationService : EfCoreRuntimeDbMigratorBase, ITransientDependency { + protected RealtimeMessageDataSeeder DataSeeder { get; } + public RealtimeMessageDbMigrationService( + RealtimeMessageDataSeeder dataSeeder, ICurrentTenant currentTenant, IUnitOfWorkManager unitOfWorkManager, IServiceProvider serviceProvider, @@ -23,5 +27,12 @@ public class RealtimeMessageDbMigrationService : EfCoreRuntimeDbMigratorBase(), unitOfWorkManager, serviceProvider, currentTenant, abpDistributedLock, distributedEventBus, loggerFactory) { + DataSeeder = dataSeeder; + } + + protected async override Task SeedAsync() + { + // DbMigrator迁移数据种子 + await DataSeeder.SeedAsync(new DataSeedContext()); } } \ No newline at end of file diff --git a/aspnet-core/modules/account/LINGYUN.Abp.Account.Web/Pages/Account/SendCode.cshtml b/aspnet-core/modules/account/LINGYUN.Abp.Account.Web/Pages/Account/SendCode.cshtml index cd7443628..e43f2f24c 100644 --- a/aspnet-core/modules/account/LINGYUN.Abp.Account.Web/Pages/Account/SendCode.cshtml +++ b/aspnet-core/modules/account/LINGYUN.Abp.Account.Web/Pages/Account/SendCode.cshtml @@ -15,11 +15,15 @@
- @L["SendVerifyCode"] + @L["SendVerifyCode"] + + + + + @L["Login"] +
- - @L["Login"] - + diff --git a/aspnet-core/modules/account/LINGYUN.Abp.Account.Web/Pages/Account/VerifyAuthenticatorCode.cshtml b/aspnet-core/modules/account/LINGYUN.Abp.Account.Web/Pages/Account/VerifyAuthenticatorCode.cshtml index bd578ad0c..919204564 100644 --- a/aspnet-core/modules/account/LINGYUN.Abp.Account.Web/Pages/Account/VerifyAuthenticatorCode.cshtml +++ b/aspnet-core/modules/account/LINGYUN.Abp.Account.Web/Pages/Account/VerifyAuthenticatorCode.cshtml @@ -13,14 +13,18 @@ -
- +
- @L["VerifyAuthenticatorCode"] - - @L["Login"] - +
+ @L["VerifyAuthenticatorCode"] + + + + + @L["Login"] + +
\ No newline at end of file diff --git a/aspnet-core/modules/account/LINGYUN.Abp.Account.Web/Pages/Account/VerifyCode.cshtml b/aspnet-core/modules/account/LINGYUN.Abp.Account.Web/Pages/Account/VerifyCode.cshtml index 54e1ae23f..da7d6bab3 100644 --- a/aspnet-core/modules/account/LINGYUN.Abp.Account.Web/Pages/Account/VerifyCode.cshtml +++ b/aspnet-core/modules/account/LINGYUN.Abp.Account.Web/Pages/Account/VerifyCode.cshtml @@ -13,17 +13,18 @@
- - - - - +
+ +
- @L["VerifyAuthenticatorCode"] + @L["VerifyAuthenticatorCode"] + + + + + @L["ReSendVerifyCode"] +
- - @L["ReSendVerifyCode"] - diff --git a/aspnet-core/modules/platform/LINGYUN.Abp.UI.Navigation.VueVbenAdmin5/LINGYUN/Abp/UI/Navigation/VueVbenAdmin5/AbpUINavigationVueVbenAdmin5NavigationDefinitionProvider.cs b/aspnet-core/modules/platform/LINGYUN.Abp.UI.Navigation.VueVbenAdmin5/LINGYUN/Abp/UI/Navigation/VueVbenAdmin5/AbpUINavigationVueVbenAdmin5NavigationDefinitionProvider.cs index 95c979535..35e7488bf 100644 --- a/aspnet-core/modules/platform/LINGYUN.Abp.UI.Navigation.VueVbenAdmin5/LINGYUN/Abp/UI/Navigation/VueVbenAdmin5/AbpUINavigationVueVbenAdmin5NavigationDefinitionProvider.cs +++ b/aspnet-core/modules/platform/LINGYUN.Abp.UI.Navigation.VueVbenAdmin5/LINGYUN/Abp/UI/Navigation/VueVbenAdmin5/AbpUINavigationVueVbenAdmin5NavigationDefinitionProvider.cs @@ -106,6 +106,7 @@ public class AbpUINavigationVueVbenAdmin5NavigationDefinitionProvider : Navigati component: "", description: "账户管理", icon: "mdi:account-outline") + .WithRoles(["Users"]) .SetProperty("hideInMenu", "true") .SetProperty("title", "abp.account.title"); @@ -117,6 +118,8 @@ public class AbpUINavigationVueVbenAdmin5NavigationDefinitionProvider : Navigati component: "/account/my-settings/index", icon: "tdesign:user-setting", description: "个人设置") + .WithRoles(["Users"]) + .SetProperty("hideInMenu", "true") .SetProperty("title", "abp.account.settings.title") ); @@ -133,6 +136,7 @@ public class AbpUINavigationVueVbenAdmin5NavigationDefinitionProvider : Navigati description: "仪表盘", icon: "lucide:layout-dashboard", order: -1) + .WithRoles(["Users"]) .SetProperty("title", "page.dashboard.title"); dashboard.AddItem( @@ -155,6 +159,7 @@ public class AbpUINavigationVueVbenAdmin5NavigationDefinitionProvider : Navigati component: "/dashboard/workspace/index", icon: "carbon:workspace", description: "工作台") + .WithRoles(["Users"]) .SetProperty("title", "page.dashboard.workspace") ); diff --git a/aspnet-core/modules/platform/LINGYUN.Abp.UI.Navigation.VueVbenAdmin5/LINGYUN/Abp/UI/Navigation/VueVbenAdmin5/VueVbenAdmin5NavigationSeedContributor.cs b/aspnet-core/modules/platform/LINGYUN.Abp.UI.Navigation.VueVbenAdmin5/LINGYUN/Abp/UI/Navigation/VueVbenAdmin5/VueVbenAdmin5NavigationSeedContributor.cs index e0d3bd1eb..41c5f820d 100644 --- a/aspnet-core/modules/platform/LINGYUN.Abp.UI.Navigation.VueVbenAdmin5/LINGYUN/Abp/UI/Navigation/VueVbenAdmin5/VueVbenAdmin5NavigationSeedContributor.cs +++ b/aspnet-core/modules/platform/LINGYUN.Abp.UI.Navigation.VueVbenAdmin5/LINGYUN/Abp/UI/Navigation/VueVbenAdmin5/VueVbenAdmin5NavigationSeedContributor.cs @@ -6,6 +6,7 @@ using LINGYUN.Platform.Utils; using Microsoft.Extensions.Options; using System; using System.Collections.Generic; +using System.Linq; using System.Threading; using System.Threading.Tasks; using Volo.Abp.Data; @@ -81,6 +82,7 @@ public class VueVbenAdmin5NavigationSeedContributor : NavigationSeedContributor ["icon"] = menu.Icon ?? "", ["order"] = menu.Order }; + var roles = menu.GetRoles(); var seedMenu = await SeedMenuAsync( layout: layout, @@ -95,7 +97,7 @@ public class VueVbenAdmin5NavigationSeedContributor : NavigationSeedContributor parentId: null, tenantId: layout.TenantId, meta: menuMeta, - roles: new string[] { "admin" }); + roles: roles.Union(["admin"]).ToArray()); await SeedDefinitionMenuItemsAsync(layout, data, seedMenu, menu.Items, multiTenancySides); } @@ -121,21 +123,22 @@ public class VueVbenAdmin5NavigationSeedContributor : NavigationSeedContributor ["icon"] = item.Icon ?? "", ["order"] = item.Order }; + var roles = item.GetRoles(); var seedMenu = await SeedMenuAsync( - layout: layout, - data: data, - name: item.Name, - path: item.Url, - code: CodeNumberGenerator.AppendCode(menu.Code, CodeNumberGenerator.CreateCode(index)), - component: item.Component.IsNullOrWhiteSpace() ? layout.Path! : item.Component, - displayName: item.DisplayName, - redirect: item.Redirect, - description: item.Description, - parentId: menu.Id, - tenantId: menu.TenantId, - meta: menuMeta, - roles: new string[] { "admin" }); + layout: layout, + data: data, + name: item.Name, + path: item.Url, + code: CodeNumberGenerator.AppendCode(menu.Code, CodeNumberGenerator.CreateCode(index)), + component: item.Component.IsNullOrWhiteSpace() ? layout.Path! : item.Component, + displayName: item.DisplayName, + redirect: item.Redirect, + description: item.Description, + parentId: menu.Id, + tenantId: menu.TenantId, + meta: menuMeta, + roles: roles.Union(["admin"]).ToArray()); await SeedDefinitionMenuItemsAsync(layout, data, seedMenu, item.Items, multiTenancySides); @@ -189,7 +192,7 @@ public class VueVbenAdmin5NavigationSeedContributor : NavigationSeedContributor if (roles != null) { - foreach (var role in roles) + foreach (var role in roles.Distinct()) { await RouteDataSeeder.SeedRoleMenuAsync(role, menu, tenantId); } @@ -197,7 +200,7 @@ public class VueVbenAdmin5NavigationSeedContributor : NavigationSeedContributor if (users != null) { - foreach (var user in users) + foreach (var user in users.Distinct()) { await RouteDataSeeder.SeedUserMenuAsync(user, menu, tenantId); } diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Application/LINGYUN/Platform/Menus/MenuAppService.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Application/LINGYUN/Platform/Menus/MenuAppService.cs index 464194693..c650916d5 100644 --- a/aspnet-core/modules/platform/LINGYUN.Platform.Application/LINGYUN/Platform/Menus/MenuAppService.cs +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Application/LINGYUN/Platform/Menus/MenuAppService.cs @@ -86,8 +86,7 @@ public class MenuAppService : PlatformApplicationServiceBase, IMenuAppService public async virtual Task> GetAllAsync(MenuGetAllInput input) { var menus = await MenuRepository.GetAllAsync( - input.Filter, input.Sorting, - input.Framework, input.ParentId, input.LayoutId); + input.Filter, input.Framework, input.ParentId, input.LayoutId, input.Sorting); return new ListResultDto( ObjectMapper.Map, List>(menus)); diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Menus/IMenuRepository.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Menus/IMenuRepository.cs index 6467786b8..ed937a008 100644 --- a/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Menus/IMenuRepository.cs +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Menus/IMenuRepository.cs @@ -105,9 +105,9 @@ public interface IMenuRepository : IBasicRepository Task> GetAllAsync( string? filter = null, string? framework = null, - string? sorting = nameof(Menu.Code), Guid? parentId = null, Guid? layoutId = null, + string? sorting = nameof(Menu.Code), CancellationToken cancellationToken = default); Task RemoveAllRolesAsync( diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/Menus/EfCoreMenuRepository.cs b/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/Menus/EfCoreMenuRepository.cs index 68aa1c39e..c6c17f69e 100644 --- a/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/Menus/EfCoreMenuRepository.cs +++ b/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/Menus/EfCoreMenuRepository.cs @@ -165,9 +165,9 @@ public class EfCoreMenuRepository : EfCoreRepository> GetAllAsync( string? filter = null, string? framework = null, - string? sorting = nameof(Menu.Code), Guid? parentId = null, Guid? layoutId = null, + string? sorting = nameof(Menu.Code), CancellationToken cancellationToken = default) { if (sorting.IsNullOrWhiteSpace())