diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index c947e5371..be01cda7c 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -2,7 +2,7 @@ name: "Publish" on: push: - branches: [ rel-8.1.0 ] + branches: [ rel-8.1.1 ] env: DOTNET_VERSION: "8.0.200" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2d8261e13..3c4323a4a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -2,7 +2,7 @@ name: "Tagged Release" on: push: - branches: [ rel-8.1.0 ] + branches: [ rel-8.1.1 ] jobs: tagged-release: @@ -14,4 +14,4 @@ jobs: with: repo_token: "${{ secrets.GITHUB_TOKEN }}" prerelease: false - automatic_release_tag: "8.1.0" + automatic_release_tag: "8.1.1" diff --git a/Directory.Packages.props b/Directory.Packages.props index cb0e20c59..b6ac7c4b6 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -1,8 +1,8 @@ - 8.1.0 + 8.1.1 2.14.1 - 8.1.0 + 8.1.1 8.0.0 8.0.0 8.0.0 @@ -229,7 +229,7 @@ - + diff --git a/aspnet-core/migrations/LY.MicroService.Platform.EntityFrameworkCore/PlatformDbMigrationEventHandler.cs b/aspnet-core/migrations/LY.MicroService.Platform.EntityFrameworkCore/PlatformDbMigrationEventHandler.cs index 165b966dd..a1381495c 100644 --- a/aspnet-core/migrations/LY.MicroService.Platform.EntityFrameworkCore/PlatformDbMigrationEventHandler.cs +++ b/aspnet-core/migrations/LY.MicroService.Platform.EntityFrameworkCore/PlatformDbMigrationEventHandler.cs @@ -1,5 +1,4 @@ -using LINGYUN.Abp.Saas.Features; -using LINGYUN.Abp.Saas.Tenants; +using LINGYUN.Abp.Saas.Tenants; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Logging; @@ -53,37 +52,31 @@ public async virtual Task HandleEventAsync(TenantDeletedEto eventData) var hostDefaultConnectionString = Configuration.GetConnectionString(ConnectionStrings.DefaultConnectionStringName); using (CurrentTenant.Change(eventData.Id)) { - // 租户删除时的资源回收策略 - var strategyFeature = await FeatureChecker.GetOrNullAsync(SaasFeatureNames.Tenant.RecycleStrategy); - if (!strategyFeature.IsNullOrWhiteSpace() && Enum.TryParse(strategyFeature, out var strategy)) + // 需要回收策略为回收且存在默认连接字符串且默认连接字符串与宿主不同 + if (eventData.Strategy == RecycleStrategy.Recycle && !eventData.DefaultConnectionString.IsNullOrWhiteSpace()) { - // 需要回收策略为回收且存在默认连接字符串且默认连接字符串与宿主不同 - if (strategy == RecycleStrategy.Recycle && !eventData.DefaultConnectionString.IsNullOrWhiteSpace()) + var hostConnection = new DbConnectionStringBuilder() { - var hostConnection = new DbConnectionStringBuilder() - { - ConnectionString = hostDefaultConnectionString, - }; - var tenantConnection = new DbConnectionStringBuilder() - { - ConnectionString = eventData.DefaultConnectionString, - }; - if (hostConnection.EquivalentTo(tenantConnection)) - { - return; - } + ConnectionString = hostDefaultConnectionString, + }; + var tenantConnection = new DbConnectionStringBuilder() + { + ConnectionString = eventData.DefaultConnectionString, + }; + if (hostConnection.EquivalentTo(tenantConnection)) + { + return; + } - using var uow = UnitOfWorkManager.Begin(requiresNew: true, isTransactional: true); - var buildr = new DbContextOptionsBuilder(); - buildr.UseMySql(eventData.DefaultConnectionString, ServerVersion.AutoDetect(eventData.DefaultConnectionString)); - await using var dbConnection = new DbContext(buildr.Options); - if ((await dbConnection.Database.GetAppliedMigrationsAsync()).Any()) - { - await dbConnection.Database.EnsureDeletedAsync(); - } + using var uow = UnitOfWorkManager.Begin(requiresNew: true, isTransactional: true); + var buildr = new DbContextOptionsBuilder(); + buildr.UseMySql(eventData.DefaultConnectionString, ServerVersion.AutoDetect(eventData.DefaultConnectionString)); + await using var dbConnection = new DbContext(buildr.Options); + if ((await dbConnection.Database.GetAppliedMigrationsAsync()).Any()) + { + await dbConnection.Database.EnsureDeletedAsync(); } } } - } } diff --git a/aspnet-core/modules/account/LINGYUN.Abp.Account.Application/LINGYUN/Abp/Account/MyClaimAppService.cs b/aspnet-core/modules/account/LINGYUN.Abp.Account.Application/LINGYUN/Abp/Account/MyClaimAppService.cs index 3d49538fd..6bc45473b 100644 --- a/aspnet-core/modules/account/LINGYUN.Abp.Account.Application/LINGYUN/Abp/Account/MyClaimAppService.cs +++ b/aspnet-core/modules/account/LINGYUN.Abp.Account.Application/LINGYUN/Abp/Account/MyClaimAppService.cs @@ -19,6 +19,7 @@ public async virtual Task ChangeAvatarAsync(ChangeAvatarInput input) { var user = await GetCurrentUserAsync(); + // TODO: Use AbpClaimTypes.Picture user.Claims.RemoveAll(x => x.ClaimType.Equals(IdentityConsts.ClaimType.Avatar.Name)); user.AddClaim(GuidGenerator, new Claim(IdentityConsts.ClaimType.Avatar.Name, input.AvatarUrl)); diff --git a/aspnet-core/modules/saas/LINGYUN.Abp.Saas.Application/LINGYUN/Abp/Saas/Tenants/TenantAppService.cs b/aspnet-core/modules/saas/LINGYUN.Abp.Saas.Application/LINGYUN/Abp/Saas/Tenants/TenantAppService.cs index 03b652c3f..ffbbec1e3 100644 --- a/aspnet-core/modules/saas/LINGYUN.Abp.Saas.Application/LINGYUN/Abp/Saas/Tenants/TenantAppService.cs +++ b/aspnet-core/modules/saas/LINGYUN.Abp.Saas.Application/LINGYUN/Abp/Saas/Tenants/TenantAppService.cs @@ -1,4 +1,5 @@ -using Microsoft.AspNetCore.Authorization; +using LINGYUN.Abp.Saas.Features; +using Microsoft.AspNetCore.Authorization; using System; using System.Collections.Generic; using System.Linq; @@ -7,6 +8,7 @@ using Volo.Abp.Application.Dtos; using Volo.Abp.Data; using Volo.Abp.EventBus.Distributed; +using Volo.Abp.Features; using Volo.Abp.MultiTenancy; using Volo.Abp.ObjectExtending; @@ -153,10 +155,14 @@ public async virtual Task DeleteAsync(Guid id) { return; } + + // 租户删除时查询会失效, 在删除前确认 + var strategy = await FeatureChecker.GetAsync(SaasFeatureNames.Tenant.RecycleStrategy, RecycleStrategy.Recycle); var eto = new TenantDeletedEto { Id = tenant.Id, Name = tenant.Name, + Strategy = strategy, EntityVersion = tenant.EntityVersion, DefaultConnectionString = tenant.FindDefaultConnectionString(), }; diff --git a/aspnet-core/modules/saas/LINGYUN.Abp.Saas.Domain.Shared/LINGYUN/Abp/Saas/Tenants/TenantDeletedEto.cs b/aspnet-core/modules/saas/LINGYUN.Abp.Saas.Domain.Shared/LINGYUN/Abp/Saas/Tenants/TenantDeletedEto.cs index 34dc7c772..7a27bcf73 100644 --- a/aspnet-core/modules/saas/LINGYUN.Abp.Saas.Domain.Shared/LINGYUN/Abp/Saas/Tenants/TenantDeletedEto.cs +++ b/aspnet-core/modules/saas/LINGYUN.Abp.Saas.Domain.Shared/LINGYUN/Abp/Saas/Tenants/TenantDeletedEto.cs @@ -7,5 +7,6 @@ namespace LINGYUN.Abp.Saas.Tenants; [EventName("abp.saas.tenant.deleted")] public class TenantDeletedEto : TenantEto { + public RecycleStrategy Strategy { get; set; } public string DefaultConnectionString { get; set; } } diff --git a/aspnet-core/modules/saas/LINGYUN.Abp.Saas.Domain/LINGYUN/Abp/Saas/Features/SaasFeatureDefinitionProvider.cs b/aspnet-core/modules/saas/LINGYUN.Abp.Saas.Domain/LINGYUN/Abp/Saas/Features/SaasFeatureDefinitionProvider.cs index b1b503389..62f036f69 100644 --- a/aspnet-core/modules/saas/LINGYUN.Abp.Saas.Domain/LINGYUN/Abp/Saas/Features/SaasFeatureDefinitionProvider.cs +++ b/aspnet-core/modules/saas/LINGYUN.Abp.Saas.Domain/LINGYUN/Abp/Saas/Features/SaasFeatureDefinitionProvider.cs @@ -43,14 +43,14 @@ public override void Define(IFeatureDefinitionContext context) defaultValue: 15.ToString(), displayName: L("Features:ExpirationReminderDays"), description: L("Features:ExpirationReminderDaysDesc"), - valueType: new ToggleStringValueType(new NumericValueValidator(1, 30)), + valueType: new FreeTextStringValueType(new NumericValueValidator(1, 30)), isAvailableToHost: false); saas.AddFeature( name: SaasFeatureNames.Tenant.ExpiredRecoveryTime, defaultValue: 15.ToString(), displayName: L("Features:ExpiredRecoveryTime"), description: L("Features:ExpiredRecoveryTimeDesc"), - valueType: new ToggleStringValueType(new NumericValueValidator(1, 30)), + valueType: new FreeTextStringValueType(new NumericValueValidator(1, 30)), isAvailableToHost: false); } diff --git a/common.props b/common.props index 9a5de77bd..7424842cf 100644 --- a/common.props +++ b/common.props @@ -1,12 +1,12 @@ latest - 8.1.0 + 8.1.1 colin $(NoWarn);CS1591;CS0436;CS8618;NU1803 https://github.com/colinin/abp-next-admin $(SolutionDir)LocalNuget - 8.1.0 + 8.1.1 MIT git https://github.com/colinin/abp-next-admin