diff --git a/abp_io/AbpIoLocalization/AbpIoLocalization/Commercial/Localization/Resources/en.json b/abp_io/AbpIoLocalization/AbpIoLocalization/Commercial/Localization/Resources/en.json index c6eb1ad645..4de287778f 100644 --- a/abp_io/AbpIoLocalization/AbpIoLocalization/Commercial/Localization/Resources/en.json +++ b/abp_io/AbpIoLocalization/AbpIoLocalization/Commercial/Localization/Resources/en.json @@ -34,6 +34,13 @@ "JoinOurMarketingNewsletter": "Join our marketing newsletter", "WouldLikeToReceiveMarketingMaterials": "I would like to receive marketing materials like product deals & special offers.", "StartUsingYourLicenseNow": "Start using your license now!", - "WelcomePage": "Welcome Page" + "WelcomePage": "Welcome Page", + "UnsubscriptionExpireEmail": "Unsubscribe from license expire date reminder emails", + "UnsubscribeLicenseExpireEmailReminderMessage": "This email subscription only contains reminding your license expiration date.", + "UnsubscribeFromLicenseExpireEmails": "If you don't want to receive the emails about your license expiration date, you can unsubscribe at any time you want.", + "Unsubscribe": "Unsubscribe", + "NotOrganizationMember": "You are not member of any organization.", + "UnsubscribeLicenseExpirationEmailSuccessTitle": "Successfully unsubscribed", + "UnsubscribeLicenseExpirationEmailSuccessMessage": "You will not receive license expiration date reminder emails anymore." } } \ No newline at end of file diff --git a/framework/Volo.Abp.sln b/framework/Volo.Abp.sln index 963472ada8..8c2670fa27 100644 --- a/framework/Volo.Abp.sln +++ b/framework/Volo.Abp.sln @@ -359,6 +359,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Volo.Abp.Json.Tests", "test EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Volo.Abp.Http.Tests", "test\Volo.Abp.Http.Tests\Volo.Abp.Http.Tests.csproj", "{A37BFEB5-7C57-4CDC-93B8-B5CE4BB9ACE1}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Volo.Abp.EventBus.Abstractions", "src\Volo.Abp.EventBus.Abstractions\Volo.Abp.EventBus.Abstractions.csproj", "{8FDB3BF7-AD89-43F6-8DEB-C3E29B8801FE}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -1069,6 +1071,10 @@ Global {A37BFEB5-7C57-4CDC-93B8-B5CE4BB9ACE1}.Debug|Any CPU.Build.0 = Debug|Any CPU {A37BFEB5-7C57-4CDC-93B8-B5CE4BB9ACE1}.Release|Any CPU.ActiveCfg = Release|Any CPU {A37BFEB5-7C57-4CDC-93B8-B5CE4BB9ACE1}.Release|Any CPU.Build.0 = Release|Any CPU + {8FDB3BF7-AD89-43F6-8DEB-C3E29B8801FE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8FDB3BF7-AD89-43F6-8DEB-C3E29B8801FE}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8FDB3BF7-AD89-43F6-8DEB-C3E29B8801FE}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8FDB3BF7-AD89-43F6-8DEB-C3E29B8801FE}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -1250,6 +1256,7 @@ Global {DD9519E0-5A68-48DC-A051-7BF2AC922F3E} = {5DF0E140-0513-4D0D-BE2E-3D4D85CD70E6} {00D07595-993C-40FC-BD90-0DD6331414D3} = {447C8A77-E5F0-4538-8687-7383196D04EA} {A37BFEB5-7C57-4CDC-93B8-B5CE4BB9ACE1} = {447C8A77-E5F0-4538-8687-7383196D04EA} + {8FDB3BF7-AD89-43F6-8DEB-C3E29B8801FE} = {5DF0E140-0513-4D0D-BE2E-3D4D85CD70E6} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {BB97ECF4-9A84-433F-A80B-2A3285BDD1D5} diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/wwwroot/libs/abp/aspnetcore-mvc-ui-theme-shared/bootstrap/dom-event-handlers.js b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/wwwroot/libs/abp/aspnetcore-mvc-ui-theme-shared/bootstrap/dom-event-handlers.js index 431d9093f7..55c604cf4a 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/wwwroot/libs/abp/aspnetcore-mvc-ui-theme-shared/bootstrap/dom-event-handlers.js +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/wwwroot/libs/abp/aspnetcore-mvc-ui-theme-shared/bootstrap/dom-event-handlers.js @@ -159,7 +159,7 @@ abp.dom.initializers.initializeDatepickers = function ($rootElement) { $rootElement - .findWithSelf('input.datepicker,input[type=date]') + .findWithSelf('input.datepicker,input[type=date][abp-data-datepicker!=false]') .each(function () { var $input = $(this); $input diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/wwwroot/libs/abp/aspnetcore-mvc-ui-theme-shared/bootstrap/modal-manager.js b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/wwwroot/libs/abp/aspnetcore-mvc-ui-theme-shared/bootstrap/modal-manager.js index a4d32550f8..75d080feda 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/wwwroot/libs/abp/aspnetcore-mvc-ui-theme-shared/bootstrap/modal-manager.js +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/wwwroot/libs/abp/aspnetcore-mvc-ui-theme-shared/bootstrap/modal-manager.js @@ -39,7 +39,7 @@ $.validator.defaults.ignore = ''; //TODO: Would be better if we can apply only f var _$modal = null; var _$form = null; - var _modalId = 'Modal_' + (Math.floor((Math.random() * 1000000))) + new Date().getTime(); + var _modalId = 'Abp_Modal_' + (Math.floor((Math.random() * 1000000))) + new Date().getTime(); var _modalObject = null; var _publicApi = null; @@ -56,7 +56,12 @@ $.validator.defaults.ignore = ''; //TODO: Would be better if we can apply only f function _createContainer() { _removeContainer(); _$modalContainer = $('
'); - $('body').prepend(_$modalContainer); + var existsModals = $('[id^="Abp_Modal_"]'); + if (existsModals.length) { + existsModals.last().after(_$modalContainer) + } else { + $('body').prepend(_$modalContainer); + } return _$modalContainer; } diff --git a/framework/src/Volo.Abp.BlazoriseUI/Volo.Abp.BlazoriseUI.csproj b/framework/src/Volo.Abp.BlazoriseUI/Volo.Abp.BlazoriseUI.csproj index 9405337b89..3f41412a9e 100644 --- a/framework/src/Volo.Abp.BlazoriseUI/Volo.Abp.BlazoriseUI.csproj +++ b/framework/src/Volo.Abp.BlazoriseUI/Volo.Abp.BlazoriseUI.csproj @@ -12,9 +12,9 @@ - - - + + + diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/Services/ConnectionStringProvider.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/Services/ConnectionStringProvider.cs index 32e09b3339..b0da7f9db0 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/Services/ConnectionStringProvider.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/Services/ConnectionStringProvider.cs @@ -16,7 +16,7 @@ namespace Volo.Abp.Cli.Commands.Services case DatabaseManagementSystem.MySQL: return "Server=localhost;Port=3306;Database=MyProjectName;Uid=root;Pwd=myPassword;"; case DatabaseManagementSystem.PostgreSQL: - return "User ID=root;Password=myPassword;Host=localhost;Port=5432;Database=MyProjectName;Pooling=true;Min Pool Size=0;Max Pool Size=100;Connection Lifetime=0;"; + return "Host=localhost;Port=5432;Database=MyProjectName;User ID=root;Password=myPassword;Pooling=true;MinimumPoolSize=0;MaximumPoolSize=100;Connection Lifetime=0;"; //case DatabaseManagementSystem.Oracle: case DatabaseManagementSystem.OracleDevart: return "Data Source=MyProjectName;Integrated Security=yes;"; diff --git a/framework/src/Volo.Abp.Core/Volo/Abp/Modularity/PlugIns/FolderPlugInSource.cs b/framework/src/Volo.Abp.Core/Volo/Abp/Modularity/PlugIns/FolderPlugInSource.cs index b0544d0338..eb54a19900 100644 --- a/framework/src/Volo.Abp.Core/Volo/Abp/Modularity/PlugIns/FolderPlugInSource.cs +++ b/framework/src/Volo.Abp.Core/Volo/Abp/Modularity/PlugIns/FolderPlugInSource.cs @@ -18,7 +18,7 @@ namespace Volo.Abp.Modularity.PlugIns public Func Filter { get; set; } public FolderPlugInSource( - [NotNull] string folder, + [NotNull] string folder, SearchOption searchOption = SearchOption.TopDirectoryOnly) { Check.NotNull(folder, nameof(folder)); @@ -52,7 +52,7 @@ namespace Volo.Abp.Modularity.PlugIns return modules.ToArray(); } - private IEnumerable GetAssemblies() + private List GetAssemblies() { var assemblyFiles = AssemblyHelper.GetAssemblyFiles(Folder, SearchOption); @@ -61,7 +61,7 @@ namespace Volo.Abp.Modularity.PlugIns assemblyFiles = assemblyFiles.Where(Filter); } - return assemblyFiles.Select(AssemblyLoadContext.Default.LoadFromAssemblyPath); + return assemblyFiles.Select(AssemblyLoadContext.Default.LoadFromAssemblyPath).ToList(); } } -} \ No newline at end of file +} diff --git a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/IRepository.cs b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/IRepository.cs index 3bda51bd2e..f1136c4ea2 100644 --- a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/IRepository.cs +++ b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/IRepository.cs @@ -20,8 +20,10 @@ namespace Volo.Abp.Domain.Repositories { /// /// Get a single entity by the given . - /// It returns null if no entity with the given . + /// + /// It returns null if there is no entity with the given . /// It throws if there are multiple entities with the given . + /// /// /// A condition to find the entity /// Set true to include all children of this entity @@ -34,8 +36,10 @@ namespace Volo.Abp.Domain.Repositories /// /// Get a single entity by the given . + /// /// It throws if there is no entity with the given . /// It throws if there are multiple entities with the given . + /// /// /// A condition to filter entities /// Set true to include all children of this entity @@ -47,10 +51,11 @@ namespace Volo.Abp.Domain.Repositories ); /// - /// Deletes many entities by function. - /// Notice that: All entities fits to given predicate are retrieved and deleted. - /// This may cause major performance problems if there are too many entities with - /// given predicate. + /// Deletes many entities by the given . + /// + /// Please note: This may cause major performance problems if there are too many entities returned for a + /// given predicate and the database provider doesn't have a way to efficiently delete many entities. + /// /// /// A condition to filter entities /// @@ -69,4 +74,4 @@ namespace Volo.Abp.Domain.Repositories where TEntity : class, IEntity { } -} \ No newline at end of file +} diff --git a/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/Domain/Repositories/EntityFrameworkCore/EfCoreRepository.cs b/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/Domain/Repositories/EntityFrameworkCore/EfCoreRepository.cs index 055c9c2de9..d673ff2c28 100644 --- a/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/Domain/Repositories/EntityFrameworkCore/EfCoreRepository.cs +++ b/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/Domain/Repositories/EntityFrameworkCore/EfCoreRepository.cs @@ -289,10 +289,7 @@ namespace Volo.Abp.Domain.Repositories.EntityFrameworkCore .Where(predicate) .ToListAsync(GetCancellationToken(cancellationToken)); - foreach (var entity in entities) - { - dbSet.Remove(entity); - } + await DeleteManyAsync(entities, autoSave, cancellationToken); if (autoSave) { diff --git a/framework/src/Volo.Abp.EventBus.Abstractions/FodyWeavers.xml b/framework/src/Volo.Abp.EventBus.Abstractions/FodyWeavers.xml new file mode 100644 index 0000000000..bc5a74a236 --- /dev/null +++ b/framework/src/Volo.Abp.EventBus.Abstractions/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + diff --git a/framework/src/Volo.Abp.EventBus.Abstractions/FodyWeavers.xsd b/framework/src/Volo.Abp.EventBus.Abstractions/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/framework/src/Volo.Abp.EventBus.Abstractions/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.EventBus.Abstractions/Volo.Abp.EventBus.Abstractions.csproj b/framework/src/Volo.Abp.EventBus.Abstractions/Volo.Abp.EventBus.Abstractions.csproj new file mode 100644 index 0000000000..ae0cef7f59 --- /dev/null +++ b/framework/src/Volo.Abp.EventBus.Abstractions/Volo.Abp.EventBus.Abstractions.csproj @@ -0,0 +1,15 @@ + + + + + + + netstandard2.0 + + + + + + + + diff --git a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Events/Distributed/EtoBase.cs b/framework/src/Volo.Abp.EventBus.Abstractions/Volo/Abp/Domain/Entities/Events/Distributed/EtoBase.cs similarity index 100% rename from framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Events/Distributed/EtoBase.cs rename to framework/src/Volo.Abp.EventBus.Abstractions/Volo/Abp/Domain/Entities/Events/Distributed/EtoBase.cs diff --git a/framework/src/Volo.Abp.EventBus.Abstractions/Volo/Abp/EventBus/Abstractions/AbpEventBusAbstractionsModule.cs b/framework/src/Volo.Abp.EventBus.Abstractions/Volo/Abp/EventBus/Abstractions/AbpEventBusAbstractionsModule.cs new file mode 100644 index 0000000000..bb9d4585b9 --- /dev/null +++ b/framework/src/Volo.Abp.EventBus.Abstractions/Volo/Abp/EventBus/Abstractions/AbpEventBusAbstractionsModule.cs @@ -0,0 +1,9 @@ +using Volo.Abp.Modularity; + +namespace Volo.Abp.EventBus.Abstractions +{ + public class AbpEventBusAbstractionsModule : AbpModule + { + + } +} diff --git a/framework/src/Volo.Abp.EventBus/Volo/Abp/EventBus/EventNameAttribute.cs b/framework/src/Volo.Abp.EventBus.Abstractions/Volo/Abp/EventBus/EventNameAttribute.cs similarity index 100% rename from framework/src/Volo.Abp.EventBus/Volo/Abp/EventBus/EventNameAttribute.cs rename to framework/src/Volo.Abp.EventBus.Abstractions/Volo/Abp/EventBus/EventNameAttribute.cs diff --git a/framework/src/Volo.Abp.EventBus/Volo/Abp/EventBus/GenericEventNameAttribute.cs b/framework/src/Volo.Abp.EventBus.Abstractions/Volo/Abp/EventBus/GenericEventNameAttribute.cs similarity index 100% rename from framework/src/Volo.Abp.EventBus/Volo/Abp/EventBus/GenericEventNameAttribute.cs rename to framework/src/Volo.Abp.EventBus.Abstractions/Volo/Abp/EventBus/GenericEventNameAttribute.cs diff --git a/framework/src/Volo.Abp.EventBus/Volo/Abp/EventBus/IEventNameProvider.cs b/framework/src/Volo.Abp.EventBus.Abstractions/Volo/Abp/EventBus/IEventNameProvider.cs similarity index 100% rename from framework/src/Volo.Abp.EventBus/Volo/Abp/EventBus/IEventNameProvider.cs rename to framework/src/Volo.Abp.EventBus.Abstractions/Volo/Abp/EventBus/IEventNameProvider.cs diff --git a/framework/src/Volo.Abp.EventBus/Volo.Abp.EventBus.csproj b/framework/src/Volo.Abp.EventBus/Volo.Abp.EventBus.csproj index a1799c6673..221454bed3 100644 --- a/framework/src/Volo.Abp.EventBus/Volo.Abp.EventBus.csproj +++ b/framework/src/Volo.Abp.EventBus/Volo.Abp.EventBus.csproj @@ -15,7 +15,7 @@ - + diff --git a/framework/src/Volo.Abp.EventBus/Volo/Abp/EventBus/AbpEventBusModule.cs b/framework/src/Volo.Abp.EventBus/Volo/Abp/EventBus/AbpEventBusModule.cs index 81c3393a50..eb9c17b129 100644 --- a/framework/src/Volo.Abp.EventBus/Volo/Abp/EventBus/AbpEventBusModule.cs +++ b/framework/src/Volo.Abp.EventBus/Volo/Abp/EventBus/AbpEventBusModule.cs @@ -1,6 +1,7 @@ using Microsoft.Extensions.DependencyInjection; using System; using System.Collections.Generic; +using Volo.Abp.EventBus.Abstractions; using Volo.Abp.EventBus.Distributed; using Volo.Abp.EventBus.Local; using Volo.Abp.Modularity; @@ -9,7 +10,9 @@ using Volo.Abp.Reflection; namespace Volo.Abp.EventBus { - [DependsOn(typeof(AbpMultiTenancyModule))] + [DependsOn( + typeof(AbpEventBusAbstractionsModule), + typeof(AbpMultiTenancyModule))] public class AbpEventBusModule : AbpModule { public override void PreConfigureServices(ServiceConfigurationContext context) diff --git a/framework/src/Volo.Abp.MemoryDb/Volo/Abp/Domain/Repositories/MemoryDb/MemoryDbRepository.cs b/framework/src/Volo.Abp.MemoryDb/Volo/Abp/Domain/Repositories/MemoryDb/MemoryDbRepository.cs index 8ab6753de3..fd8c5afd16 100644 --- a/framework/src/Volo.Abp.MemoryDb/Volo/Abp/Domain/Repositories/MemoryDb/MemoryDbRepository.cs +++ b/framework/src/Volo.Abp.MemoryDb/Volo/Abp/Domain/Repositories/MemoryDb/MemoryDbRepository.cs @@ -191,10 +191,7 @@ namespace Volo.Abp.Domain.Repositories.MemoryDb { var entities = (await GetQueryableAsync()).Where(predicate).ToList(); - foreach (var entity in entities) - { - await DeleteAsync(entity, autoSave, cancellationToken); - } + await DeleteManyAsync(entities, autoSave, cancellationToken); } public override async Task InsertAsync( diff --git a/framework/src/Volo.Abp.MongoDB/Volo/Abp/Domain/Repositories/MongoDB/MongoDbRepository.cs b/framework/src/Volo.Abp.MongoDB/Volo/Abp/Domain/Repositories/MongoDB/MongoDbRepository.cs index fc520bce81..e6030246aa 100644 --- a/framework/src/Volo.Abp.MongoDB/Volo/Abp/Domain/Repositories/MongoDB/MongoDbRepository.cs +++ b/framework/src/Volo.Abp.MongoDB/Volo/Abp/Domain/Repositories/MongoDB/MongoDbRepository.cs @@ -71,16 +71,18 @@ namespace Volo.Abp.Domain.Repositories.MongoDB protected Task GetDbContextAsync(CancellationToken cancellationToken = default) { + cancellationToken = GetCancellationToken(cancellationToken); + // Multi-tenancy unaware entities should always use the host connection string if (!EntityHelper.IsMultiTenant()) { using (CurrentTenant.Change(null)) { - return DbContextProvider.GetDbContextAsync(GetCancellationToken(cancellationToken)); + return DbContextProvider.GetDbContextAsync(cancellationToken); } } - return DbContextProvider.GetDbContextAsync(GetCancellationToken(cancellationToken)); + return DbContextProvider.GetDbContextAsync(cancellationToken); } protected IMongoDbContextProvider DbContextProvider { get; } @@ -107,9 +109,11 @@ namespace Volo.Abp.Domain.Repositories.MongoDB bool autoSave = false, CancellationToken cancellationToken = default) { + cancellationToken = GetCancellationToken(cancellationToken); + await ApplyAbpConceptsForAddedEntityAsync(entity); - var dbContext = await GetDbContextAsync(GetCancellationToken(cancellationToken)); + var dbContext = await GetDbContextAsync(cancellationToken); var collection = dbContext.Collection(); if (dbContext.SessionHandle != null) @@ -117,14 +121,14 @@ namespace Volo.Abp.Domain.Repositories.MongoDB await collection.InsertOneAsync( dbContext.SessionHandle, entity, - cancellationToken: GetCancellationToken(cancellationToken) + cancellationToken: cancellationToken ); } else { await collection.InsertOneAsync( entity, - cancellationToken: GetCancellationToken(cancellationToken) + cancellationToken: cancellationToken ); } @@ -133,6 +137,8 @@ namespace Volo.Abp.Domain.Repositories.MongoDB public override async Task InsertManyAsync(IEnumerable entities, bool autoSave = false, CancellationToken cancellationToken = default) { + cancellationToken = GetCancellationToken(cancellationToken); + var entityArray = entities.ToArray(); foreach (var entity in entityArray) @@ -140,7 +146,7 @@ namespace Volo.Abp.Domain.Repositories.MongoDB await ApplyAbpConceptsForAddedEntityAsync(entity); } - var dbContext = await GetDbContextAsync(GetCancellationToken(cancellationToken)); + var dbContext = await GetDbContextAsync(cancellationToken); var collection = dbContext.Collection(); if (BulkOperationProvider != null) @@ -169,6 +175,8 @@ namespace Volo.Abp.Domain.Repositories.MongoDB bool autoSave = false, CancellationToken cancellationToken = default) { + cancellationToken = GetCancellationToken(cancellationToken); + SetModificationAuditProperties(entity); if (entity is ISoftDelete softDeleteEntity && softDeleteEntity.IsDeleted) @@ -186,7 +194,7 @@ namespace Volo.Abp.Domain.Repositories.MongoDB var oldConcurrencyStamp = SetNewConcurrencyStamp(entity); ReplaceOneResult result; - var dbContext = await GetDbContextAsync(GetCancellationToken(cancellationToken)); + var dbContext = await GetDbContextAsync(cancellationToken); var collection = dbContext.Collection(); if (dbContext.SessionHandle != null) @@ -195,7 +203,7 @@ namespace Volo.Abp.Domain.Repositories.MongoDB dbContext.SessionHandle, CreateEntityFilter(entity, true, oldConcurrencyStamp), entity, - cancellationToken: GetCancellationToken(cancellationToken) + cancellationToken: cancellationToken ); } else @@ -203,7 +211,7 @@ namespace Volo.Abp.Domain.Repositories.MongoDB result = await collection.ReplaceOneAsync( CreateEntityFilter(entity, true, oldConcurrencyStamp), entity, - cancellationToken: GetCancellationToken(cancellationToken) + cancellationToken: cancellationToken ); } @@ -277,15 +285,18 @@ namespace Volo.Abp.Domain.Repositories.MongoDB bool autoSave = false, CancellationToken cancellationToken = default) { - await ApplyAbpConceptsForDeletedEntityAsync(entity); - var oldConcurrencyStamp = SetNewConcurrencyStamp(entity); + cancellationToken = GetCancellationToken(cancellationToken); - var dbContext = await GetDbContextAsync(GetCancellationToken(cancellationToken)); + var dbContext = await GetDbContextAsync(cancellationToken); var collection = dbContext.Collection(); - if (entity is ISoftDelete softDeleteEntity && !IsHardDeleted(entity)) + var oldConcurrencyStamp = SetNewConcurrencyStamp(entity); + + if (typeof(ISoftDelete).IsAssignableFrom(typeof(TEntity)) && !IsHardDeleted(entity)) { - softDeleteEntity.IsDeleted = true; + ((ISoftDelete)entity).IsDeleted = true; + await ApplyAbpConceptsForDeletedEntityAsync(entity); + ReplaceOneResult result; if (dbContext.SessionHandle != null) @@ -294,7 +305,7 @@ namespace Volo.Abp.Domain.Repositories.MongoDB dbContext.SessionHandle, CreateEntityFilter(entity, true, oldConcurrencyStamp), entity, - cancellationToken: GetCancellationToken(cancellationToken) + cancellationToken: cancellationToken ); } else @@ -302,7 +313,7 @@ namespace Volo.Abp.Domain.Repositories.MongoDB result = await collection.ReplaceOneAsync( CreateEntityFilter(entity, true, oldConcurrencyStamp), entity, - cancellationToken: GetCancellationToken(cancellationToken) + cancellationToken: cancellationToken ); } @@ -313,6 +324,8 @@ namespace Volo.Abp.Domain.Repositories.MongoDB } else { + await ApplyAbpConceptsForDeletedEntityAsync(entity); + DeleteResult result; if (dbContext.SessionHandle != null) @@ -320,14 +333,14 @@ namespace Volo.Abp.Domain.Repositories.MongoDB result = await collection.DeleteOneAsync( dbContext.SessionHandle, CreateEntityFilter(entity, true, oldConcurrencyStamp), - cancellationToken: GetCancellationToken(cancellationToken) + cancellationToken: cancellationToken ); } else { result = await collection.DeleteOneAsync( CreateEntityFilter(entity, true, oldConcurrencyStamp), - GetCancellationToken(cancellationToken) + cancellationToken ); } @@ -343,55 +356,55 @@ namespace Volo.Abp.Domain.Repositories.MongoDB bool autoSave = false, CancellationToken cancellationToken = default) { - var softDeletedEntities = new List(); + cancellationToken = GetCancellationToken(cancellationToken); + + var softDeletedEntities = new Dictionary(); var hardDeletedEntities = new List(); foreach (var entity in entities) { - await ApplyAbpConceptsForDeletedEntityAsync(entity); - SetNewConcurrencyStamp(entity); - if (typeof(ISoftDelete).IsAssignableFrom(typeof(TEntity)) && !IsHardDeleted(entity)) { - softDeletedEntities.Add(entity); + ((ISoftDelete)entity).IsDeleted = true; + + softDeletedEntities.Add(entity, SetNewConcurrencyStamp(entity)); } else { hardDeletedEntities.Add(entity); } + + await ApplyAbpConceptsForDeletedEntityAsync(entity); } - var dbContext = await GetDbContextAsync(GetCancellationToken(cancellationToken)); + var dbContext = await GetDbContextAsync(cancellationToken); var collection = dbContext.Collection(); if (BulkOperationProvider != null) { - await BulkOperationProvider.DeleteManyAsync(this, entities.ToArray(), dbContext.SessionHandle, autoSave, cancellationToken); + await BulkOperationProvider.DeleteManyAsync(this, entities, dbContext.SessionHandle, autoSave, cancellationToken); return; } if (softDeletedEntities.Count > 0) { - UpdateResult updateResult; - var softDeleteEntitiesCount = softDeletedEntities.Count; + BulkWriteResult updateResult; + + var replaceRequests = new List>( + softDeletedEntities.Select(entity => new ReplaceOneModel( + CreateEntityFilter(entity.Key, true, entity.Value), entity.Key)) + ); if (dbContext.SessionHandle != null) { - updateResult = await collection.UpdateManyAsync( - dbContext.SessionHandle, - CreateEntitiesFilter(softDeletedEntities), - Builders.Update.Set(x => ((ISoftDelete)x).IsDeleted, true) - ); + updateResult = await collection.BulkWriteAsync(dbContext.SessionHandle, replaceRequests, cancellationToken: cancellationToken); } else { - updateResult = await collection.UpdateManyAsync( - CreateEntitiesFilter(softDeletedEntities), - Builders.Update.Set(x => ((ISoftDelete)x).IsDeleted, true) - ); + updateResult = await collection.BulkWriteAsync(replaceRequests, cancellationToken: cancellationToken); } - if (updateResult.MatchedCount < softDeleteEntitiesCount) + if (updateResult.MatchedCount < softDeletedEntities.Count) { ThrowOptimisticConcurrencyException(); } @@ -406,14 +419,14 @@ namespace Volo.Abp.Domain.Repositories.MongoDB { deleteResult = await collection.DeleteManyAsync( dbContext.SessionHandle, - CreateEntitiesFilter(hardDeletedEntities) - ); + CreateEntitiesFilter(hardDeletedEntities), + cancellationToken: cancellationToken); } else { deleteResult = await collection.DeleteManyAsync( - CreateEntitiesFilter(hardDeletedEntities) - ); + CreateEntitiesFilter(hardDeletedEntities), + cancellationToken: cancellationToken); } if (deleteResult.DeletedCount < hardDeletedEntitiesCount) @@ -462,10 +475,7 @@ namespace Volo.Abp.Domain.Repositories.MongoDB .Where(predicate) .ToListAsync(cancellationToken); - foreach (var entity in entities) - { - await DeleteAsync(entity, autoSave, cancellationToken); - } + await DeleteManyAsync(entities, autoSave, cancellationToken); } [Obsolete("Use GetQueryableAsync method.")] @@ -484,9 +494,11 @@ namespace Volo.Abp.Domain.Repositories.MongoDB bool includeDetails = true, CancellationToken cancellationToken = default) { + cancellationToken = GetCancellationToken(cancellationToken); + return await (await GetMongoQueryableAsync(cancellationToken)) .Where(predicate) - .SingleOrDefaultAsync(GetCancellationToken(cancellationToken)); + .SingleOrDefaultAsync(cancellationToken); } [Obsolete("Use GetMongoQueryableAsync method.")] @@ -501,6 +513,8 @@ namespace Volo.Abp.Domain.Repositories.MongoDB public async Task> GetMongoQueryableAsync(CancellationToken cancellationToken = default) { + cancellationToken = GetCancellationToken(cancellationToken); + var dbContext = await GetDbContextAsync(cancellationToken); var collection = dbContext.Collection(); @@ -513,6 +527,8 @@ namespace Volo.Abp.Domain.Repositories.MongoDB public async Task> GetAggregateAsync(CancellationToken cancellationToken = default) { + cancellationToken = GetCancellationToken(cancellationToken); + var dbContext = await GetDbContextAsync(cancellationToken); var collection = await GetCollectionAsync(cancellationToken); @@ -695,13 +711,13 @@ namespace Volo.Abp.Domain.Repositories.MongoDB [Obsolete("This method will be removed in future versions.")] public IAsyncCursor ToCursor(CancellationToken cancellationToken = new CancellationToken()) { - return GetMongoQueryable().ToCursor(cancellationToken); + return GetMongoQueryable().ToCursor(GetCancellationToken(cancellationToken)); } [Obsolete("This method will be removed in future versions.")] public Task> ToCursorAsync(CancellationToken cancellationToken = new CancellationToken()) { - return GetMongoQueryable().ToCursorAsync(cancellationToken); + return GetMongoQueryable().ToCursorAsync(GetCancellationToken(cancellationToken)); } } @@ -724,7 +740,7 @@ namespace Volo.Abp.Domain.Repositories.MongoDB bool includeDetails = true, CancellationToken cancellationToken = default) { - var entity = await FindAsync(id, includeDetails, cancellationToken); + var entity = await FindAsync(id, includeDetails, GetCancellationToken(cancellationToken)); if (entity == null) { diff --git a/framework/src/Volo.Abp.MultiTenancy/Volo.Abp.MultiTenancy.csproj b/framework/src/Volo.Abp.MultiTenancy/Volo.Abp.MultiTenancy.csproj index 951712c7f0..344dbfdec0 100644 --- a/framework/src/Volo.Abp.MultiTenancy/Volo.Abp.MultiTenancy.csproj +++ b/framework/src/Volo.Abp.MultiTenancy/Volo.Abp.MultiTenancy.csproj @@ -16,6 +16,7 @@ + diff --git a/framework/src/Volo.Abp.MultiTenancy/Volo/Abp/MultiTenancy/AbpMultiTenancyModule.cs b/framework/src/Volo.Abp.MultiTenancy/Volo/Abp/MultiTenancy/AbpMultiTenancyModule.cs index 9dc64ef7f8..c51daf99aa 100644 --- a/framework/src/Volo.Abp.MultiTenancy/Volo/Abp/MultiTenancy/AbpMultiTenancyModule.cs +++ b/framework/src/Volo.Abp.MultiTenancy/Volo/Abp/MultiTenancy/AbpMultiTenancyModule.cs @@ -1,5 +1,6 @@ using Microsoft.Extensions.DependencyInjection; using Volo.Abp.Data; +using Volo.Abp.EventBus.Abstractions; using Volo.Abp.Modularity; using Volo.Abp.MultiTenancy.ConfigurationStore; using Volo.Abp.Security; @@ -10,7 +11,8 @@ namespace Volo.Abp.MultiTenancy [DependsOn( typeof(AbpDataModule), - typeof(AbpSecurityModule) + typeof(AbpSecurityModule), + typeof(AbpEventBusAbstractionsModule) )] public class AbpMultiTenancyModule : AbpModule { diff --git a/framework/src/Volo.Abp.MultiTenancy/Volo/Abp/MultiTenancy/TenantConnectionStringUpdatedEto.cs b/framework/src/Volo.Abp.MultiTenancy/Volo/Abp/MultiTenancy/TenantConnectionStringUpdatedEto.cs new file mode 100644 index 0000000000..022343821b --- /dev/null +++ b/framework/src/Volo.Abp.MultiTenancy/Volo/Abp/MultiTenancy/TenantConnectionStringUpdatedEto.cs @@ -0,0 +1,21 @@ +using System; +using Volo.Abp.Domain.Entities.Events.Distributed; +using Volo.Abp.EventBus; + +namespace Volo.Abp.MultiTenancy +{ + [Serializable] + [EventName("abp.multi_tenancy.tenant.connection_string.updated")] + public class TenantConnectionStringUpdatedEto : EtoBase + { + public Guid Id { get; set; } + + public string Name { get; set; } + + public string ConnectionStringName { get; set; } + + public string OldValue { get; set; } + + public string NewValue { get; set; } + } +} diff --git a/framework/src/Volo.Abp.MultiTenancy/Volo/Abp/MultiTenancy/TenantCreatedEto.cs b/framework/src/Volo.Abp.MultiTenancy/Volo/Abp/MultiTenancy/TenantCreatedEto.cs new file mode 100644 index 0000000000..317995c971 --- /dev/null +++ b/framework/src/Volo.Abp.MultiTenancy/Volo/Abp/MultiTenancy/TenantCreatedEto.cs @@ -0,0 +1,15 @@ +using System; +using Volo.Abp.Domain.Entities.Events.Distributed; +using Volo.Abp.EventBus; + +namespace Volo.Abp.MultiTenancy +{ + [Serializable] + [EventName("abp.multi_tenancy.tenant.created")] + public class TenantCreatedEto : EtoBase + { + public Guid Id { get; set; } + + public string Name { get; set; } + } +} diff --git a/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/SoftDelete_Tests.cs b/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/SoftDelete_Tests.cs index b8618fd6a3..4b313d2127 100644 --- a/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/SoftDelete_Tests.cs +++ b/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/SoftDelete_Tests.cs @@ -56,6 +56,23 @@ namespace Volo.Abp.TestApp.Testing douglas.DeletionTime.ShouldNotBeNull(); } } + + [Fact] + public async Task Should_Cancel_Deletion_For_Soft_Delete_Many_Entities_ById() + { + await PersonRepository.DeleteManyAsync(new []{ TestDataBuilder.UserDouglasId }); + + var douglas = await PersonRepository.FindAsync(TestDataBuilder.UserDouglasId); + douglas.ShouldBeNull(); + + using (DataFilter.Disable()) + { + douglas = await PersonRepository.FindAsync(TestDataBuilder.UserDouglasId); + douglas.ShouldNotBeNull(); + douglas.IsDeleted.ShouldBeTrue(); + douglas.DeletionTime.ShouldNotBeNull(); + } + } [Fact] public async Task Should_Handle_Deletion_On_Update_For_Soft_Delete_Entities() diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.HttpApi/Volo/CmsKit/Admin/Tags/TagAdminController.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.HttpApi/Volo/CmsKit/Admin/Tags/TagAdminController.cs index afc9a83fc8..4655c60bd6 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.HttpApi/Volo/CmsKit/Admin/Tags/TagAdminController.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.HttpApi/Volo/CmsKit/Admin/Tags/TagAdminController.cs @@ -62,6 +62,8 @@ namespace Volo.CmsKit.Admin.Tags return TagAdminAppService.UpdateAsync(id, input); } + [HttpGet] + [Route("tag-definitions")] public Task> GetTagDefinitionsAsync() { return TagAdminAppService.GetTagDefinitionsAsync(); diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.Web/CmsKitPublicWebModule.cs b/modules/cms-kit/src/Volo.CmsKit.Public.Web/CmsKitPublicWebModule.cs index 8cb5644256..953102aa79 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Public.Web/CmsKitPublicWebModule.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Public.Web/CmsKitPublicWebModule.cs @@ -1,5 +1,4 @@ -using System.Linq; -using Microsoft.AspNetCore.Mvc.RazorPages; +using Microsoft.AspNetCore.Mvc.RazorPages; using Microsoft.Extensions.DependencyInjection; using Volo.Abp.AspNetCore.Mvc.Localization; using Volo.Abp.AutoMapper; @@ -56,13 +55,15 @@ namespace Volo.CmsKit.Public.Web { options.AddMaps(validate: true); }); + } + public override void PostConfigureServices(ServiceConfigurationContext context) + { Configure(options => { if (GlobalFeatureManager.Instance.IsEnabled()) { - // TODO: Work on this route logic. Blocks some routes with this logic. - options.Conventions.AddPageRoute("/CmsKit/Pages/Index", "/{*pageUrl}"); + options.Conventions.AddPageRoute("/CmsKit/Pages/Index", @"{*pageUrl:minlength(1)}"); } }); } diff --git a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/AbpIdentityDomainModule.cs b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/AbpIdentityDomainModule.cs index 4269ae2e01..4326d1aeb8 100644 --- a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/AbpIdentityDomainModule.cs +++ b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/AbpIdentityDomainModule.cs @@ -1,4 +1,5 @@ -using Microsoft.AspNetCore.Identity; +using System.Collections.Generic; +using Microsoft.AspNetCore.Identity; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection.Extensions; using Microsoft.Extensions.Options; diff --git a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityDataSeeder.cs b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityDataSeeder.cs index f6bed1b914..9051dc7d66 100644 --- a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityDataSeeder.cs +++ b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityDataSeeder.cs @@ -49,58 +49,61 @@ namespace Volo.Abp.Identity Check.NotNullOrWhiteSpace(adminEmail, nameof(adminEmail)); Check.NotNullOrWhiteSpace(adminPassword, nameof(adminPassword)); - await IdentityOptions.SetAsync(); - - var result = new IdentityDataSeedResult(); - using (CurrentTenant.Change(tenantId)) { - //"admin" user - const string adminUserName = "admin"; - var adminUser = await UserRepository.FindByNormalizedUserNameAsync( - LookupNormalizer.NormalizeName(adminUserName) - ); + await IdentityOptions.SetAsync(); - if (adminUser != null) + using (IdentityOptions.Value.Password.ClearRequirements()) { - return result; - } + var result = new IdentityDataSeedResult(); + //"admin" user + const string adminUserName = "admin"; + var adminUser = await UserRepository.FindByNormalizedUserNameAsync( + LookupNormalizer.NormalizeName(adminUserName) + ); - adminUser = new IdentityUser( - GuidGenerator.Create(), - adminUserName, - adminEmail, - tenantId - ) - { - Name = adminUserName - }; - - (await UserManager.CreateAsync(adminUser, adminPassword)).CheckErrors(); - result.CreatedAdminUser = true; + if (adminUser != null) + { + return result; + } - //"admin" role - const string adminRoleName = "admin"; - var adminRole = await RoleRepository.FindByNormalizedNameAsync(LookupNormalizer.NormalizeName(adminRoleName)); - if (adminRole == null) - { - adminRole = new IdentityRole( + adminUser = new IdentityUser( GuidGenerator.Create(), - adminRoleName, + adminUserName, + adminEmail, tenantId ) { - IsStatic = true, - IsPublic = true + Name = adminUserName }; - (await RoleManager.CreateAsync(adminRole)).CheckErrors(); - result.CreatedAdminRole = true; - } + (await UserManager.CreateAsync(adminUser, adminPassword)).CheckErrors(); + result.CreatedAdminUser = true; + + //"admin" role + const string adminRoleName = "admin"; + var adminRole = + await RoleRepository.FindByNormalizedNameAsync(LookupNormalizer.NormalizeName(adminRoleName)); + if (adminRole == null) + { + adminRole = new IdentityRole( + GuidGenerator.Create(), + adminRoleName, + tenantId + ) + { + IsStatic = true, + IsPublic = true + }; - (await UserManager.AddToRoleAsync(adminUser, adminRoleName)).CheckErrors(); + (await RoleManager.CreateAsync(adminRole)).CheckErrors(); + result.CreatedAdminRole = true; + } - return result; + (await UserManager.AddToRoleAsync(adminUser, adminRoleName)).CheckErrors(); + + return result; + } } } } diff --git a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/PasswordOptionsExtensions.cs b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/PasswordOptionsExtensions.cs new file mode 100644 index 0000000000..793cc6349e --- /dev/null +++ b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/PasswordOptionsExtensions.cs @@ -0,0 +1,35 @@ +using System; +using Microsoft.AspNetCore.Identity; + +namespace Volo.Abp.Identity +{ + public static class PasswordOptionsExtensions + { + public static IDisposable ClearRequirements(this PasswordOptions options) + { + var oldRequireDigit = options.RequireDigit; + var oldRequiredLength = options.RequiredLength; + var oldRequireLowercase = options.RequireLowercase; + var oldRequireUppercase = options.RequireUppercase; + var oldRequiredUniqueChars = options.RequiredUniqueChars; + var oldRequireNonAlphanumeric = options.RequireNonAlphanumeric; + + options.RequireDigit = false; + options.RequiredLength = 1; + options.RequireLowercase = false; + options.RequireUppercase = false; + options.RequiredUniqueChars = 1; + options.RequireNonAlphanumeric = false; + + return new DisposeAction(() => + { + options.RequireDigit = oldRequireDigit; + options.RequiredLength = oldRequiredLength; + options.RequireLowercase = oldRequireLowercase; + options.RequireUppercase = oldRequireUppercase; + options.RequiredUniqueChars = oldRequiredUniqueChars; + options.RequireNonAlphanumeric = oldRequireNonAlphanumeric; + }); + } + } +} diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/AbpPermissionManagementDomainModule.cs b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/AbpPermissionManagementDomainModule.cs index c199a2130b..f437802c6b 100644 --- a/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/AbpPermissionManagementDomainModule.cs +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/AbpPermissionManagementDomainModule.cs @@ -1,4 +1,7 @@ -using Volo.Abp.Authorization; +using System.Collections.Generic; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Options; +using Volo.Abp.Authorization; using Volo.Abp.Caching; using Volo.Abp.Domain; using Volo.Abp.Json; @@ -13,6 +16,6 @@ namespace Volo.Abp.PermissionManagement [DependsOn(typeof(AbpJsonModule))] public class AbpPermissionManagementDomainModule : AbpModule { - + } } diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/PermissionDataSeedContributor.cs b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/PermissionDataSeedContributor.cs index ac8274d445..8260df895f 100644 --- a/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/PermissionDataSeedContributor.cs +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/PermissionDataSeedContributor.cs @@ -10,7 +10,6 @@ namespace Volo.Abp.PermissionManagement public class PermissionDataSeedContributor : IDataSeedContributor, ITransientDependency { protected ICurrentTenant CurrentTenant { get; } - protected IPermissionDefinitionManager PermissionDefinitionManager { get; } protected IPermissionDataSeeder PermissionDataSeeder { get; } diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/PermissionManagementOptions.cs b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/PermissionManagementOptions.cs index 674f5daa88..2e29ab9c29 100644 --- a/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/PermissionManagementOptions.cs +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/PermissionManagementOptions.cs @@ -5,7 +5,6 @@ namespace Volo.Abp.PermissionManagement { public class PermissionManagementOptions { - //TODO: rename to Providers public ITypeList ManagementProviders { get; } public Dictionary ProviderPolicies { get; } diff --git a/npm/ng-packs/packages/core/src/lib/models/common.ts b/npm/ng-packs/packages/core/src/lib/models/common.ts index d4d44faae0..db03b1cea7 100644 --- a/npm/ng-packs/packages/core/src/lib/models/common.ts +++ b/npm/ng-packs/packages/core/src/lib/models/common.ts @@ -12,6 +12,10 @@ export namespace ABP { sendNullsAsQueryParam?: boolean; } + export interface HasPolicy { + requiredPolicy?: string; + } + export interface Test extends Partial { baseHref?: string; listQueryDebounceTime?: number; diff --git a/npm/ng-packs/packages/core/src/lib/services/permission.service.ts b/npm/ng-packs/packages/core/src/lib/services/permission.service.ts index c549c5a7a8..eb6b3fc75e 100644 --- a/npm/ng-packs/packages/core/src/lib/services/permission.service.ts +++ b/npm/ng-packs/packages/core/src/lib/services/permission.service.ts @@ -3,6 +3,7 @@ import { map } from 'rxjs/operators'; import snq from 'snq'; import { ApplicationConfigurationDto } from '../proxy/volo/abp/asp-net-core/mvc/application-configurations/models'; import { ConfigStateService } from './config-state.service'; +import { ABP } from '../models/common'; @Injectable({ providedIn: 'root' }) export class PermissionService { @@ -19,6 +20,23 @@ export class PermissionService { return this.isPolicyGranted(key, policies); } + filterItemsByPolicy(items: Array) { + const policies = this.getSnapshot(); + return items.filter( + item => !item.requiredPolicy || this.isPolicyGranted(item.requiredPolicy, policies), + ); + } + + filterItemsByPolicy$(items: Array) { + return this.getStream().pipe( + map(policies => + items.filter( + item => !item.requiredPolicy || this.isPolicyGranted(item.requiredPolicy, policies), + ), + ), + ); + } + protected isPolicyGranted(key: string, grantedPolicies: Record) { if (!key) return true; diff --git a/npm/ng-packs/packages/theme-shared/src/lib/components/modal/modal.component.ts b/npm/ng-packs/packages/theme-shared/src/lib/components/modal/modal.component.ts index 0142adeb25..c5829c8e79 100644 --- a/npm/ng-packs/packages/theme-shared/src/lib/components/modal/modal.component.ts +++ b/npm/ng-packs/packages/theme-shared/src/lib/components/modal/modal.component.ts @@ -154,6 +154,7 @@ export class ModalComponent implements OnDestroy { } ngOnDestroy(): void { + this.toggle(false); this.destroy$.next(); } diff --git a/npm/ng-packs/yarn.lock b/npm/ng-packs/yarn.lock index c87d4f36e2..bae49929de 100644 --- a/npm/ng-packs/yarn.lock +++ b/npm/ng-packs/yarn.lock @@ -2,12 +2,12 @@ # yarn lockfile v1 -"@abp/ng.core@~4.2.0-rc.2": - version "4.2.0-rc.2" - resolved "https://registry.yarnpkg.com/@abp/ng.core/-/ng.core-4.2.0-rc.2.tgz#d5ae888cd6beba0ab7cc92a9759e8f3b4095f5dc" - integrity sha512-uPsxulybSdGyBpR08d9XR3i/YdG/ILvo1Gzyz2wTOG/gay12hh/p83S50kWeBuPkh8uOiT3ezO9BY/GPVrRI+Q== +"@abp/ng.core@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/ng.core/-/ng.core-4.2.0.tgz#cd6848291699b9bc60303c58162074d80a0c4428" + integrity sha512-HhTpOeK5RdzlfK5zy5t7v68DDqNqAB75if6E4Lt2CwgY8pQUuY0EIzD0+AXhkC5+bjyULNHV2/HW3q/Fm75TVg== dependencies: - "@abp/utils" "^4.2.0-rc.1" + "@abp/utils" "^4.2.0-rc.2" "@angular/localize" "~10.0.10" "@ngxs/store" "^3.7.0" angular-oauth2-oidc "^10.0.0" @@ -17,35 +17,35 @@ ts-toolbelt "6.15.4" tslib "^2.0.0" -"@abp/ng.feature-management@~4.2.0-rc.2": - version "4.2.0-rc.2" - resolved "https://registry.yarnpkg.com/@abp/ng.feature-management/-/ng.feature-management-4.2.0-rc.2.tgz#c0273a07f73d95e7133ec90c1facd5de51121430" - integrity sha512-sGQfh0plQGtm3qCGYs1qmCtWt2EOwVgRyUcNd2ipzorH55S5/dX7or9dYKZofPz7GF55FohbfpxBqnKnBo0WOQ== +"@abp/ng.feature-management@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/ng.feature-management/-/ng.feature-management-4.2.0.tgz#2c89d64845533c23560325f806289c131457ced9" + integrity sha512-IftgAecb2bygNQhMCvQ6m6BxTq7eAvKE36jBZ1s72S658PtO9xx1LIjCql/QNKyu8YpI88Uc5OXZM8mJOVsYuw== dependencies: - "@abp/ng.theme.shared" "~4.2.0-rc.2" + "@abp/ng.theme.shared" "~4.2.0" tslib "^2.0.0" -"@abp/ng.identity@~4.2.0-rc.2": - version "4.2.0-rc.2" - resolved "https://registry.yarnpkg.com/@abp/ng.identity/-/ng.identity-4.2.0-rc.2.tgz#fe20f05b60980561218f8357df55c00d85af8eb2" - integrity sha512-zrY5oPhDq8lPcvDvxYM/hS5CtRj71Zlu04Slz4f+ljlStWHBOBZx1VVBl4OQvbDGxDGC04Pf2Sj3PtppEU28gw== +"@abp/ng.identity@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/ng.identity/-/ng.identity-4.2.0.tgz#e6e321545a612b37f7f1ff8d0df43086319e77fa" + integrity sha512-yNSxscWa9Po9H+7b7m94oAzMNLe360yJq9s/yw2EhEnkUTJ5bBbbrnSKK35NNRhziYp9V5CwYsW7uhjxQ3NGqQ== dependencies: - "@abp/ng.permission-management" "~4.2.0-rc.2" - "@abp/ng.theme.shared" "~4.2.0-rc.2" + "@abp/ng.permission-management" "~4.2.0" + "@abp/ng.theme.shared" "~4.2.0" tslib "^2.0.0" -"@abp/ng.permission-management@~4.2.0-rc.2": - version "4.2.0-rc.2" - resolved "https://registry.yarnpkg.com/@abp/ng.permission-management/-/ng.permission-management-4.2.0-rc.2.tgz#771285283bf3c82dcdd6a07ef444ada73b918d4a" - integrity sha512-FSMSiXGhalTMZIJzQCS6fYRdFH2eVmk73aPeFn1NnMxNdhzCXfbsHpX/lVes+UMw7CddEEgriv0GQYi8dYMnDw== +"@abp/ng.permission-management@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/ng.permission-management/-/ng.permission-management-4.2.0.tgz#ad2970796b8b1aecfcd5b0a0136c508a0e18e9d4" + integrity sha512-wG26+7clnqll7d2+Uypd4xleA2DjpSkkctMOGai7EDaHqgVFDjfX3lZHtz/u7Xt9y9wHltGhqONjh/FuRkrgBA== dependencies: - "@abp/ng.theme.shared" "~4.2.0-rc.2" + "@abp/ng.theme.shared" "~4.2.0" tslib "^2.0.0" -"@abp/ng.schematics@~4.2.0-rc.2": - version "4.2.0-rc.2" - resolved "https://registry.yarnpkg.com/@abp/ng.schematics/-/ng.schematics-4.2.0-rc.2.tgz#93774148f57964c72498fa060c04eb99f6c3987d" - integrity sha512-Ul/+nPTnGpNhi0NMfeYY9fDnsTVzVxP4iSIdqXevPxugeY6pqCefC84i0XHdkVsxIi1UR7VP84tqE9SCv7KnCw== +"@abp/ng.schematics@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/ng.schematics/-/ng.schematics-4.2.0.tgz#db1a8ae787cf028452774a51cb62e784a1670e25" + integrity sha512-44bDoLRqDzcJ/X75KH1O0AoQev7zKh0IkAe4N7KQNgjgRiIuWe3h/SQPfqTSlZNT2ZYo/SZMZyX5Nv8OSKXydg== dependencies: "@angular-devkit/core" "~11.0.2" "@angular-devkit/schematics" "~11.0.2" @@ -53,37 +53,37 @@ jsonc-parser "^2.3.0" typescript "~3.9.2" -"@abp/ng.setting-management@~4.2.0-rc.2": - version "4.2.0-rc.2" - resolved "https://registry.yarnpkg.com/@abp/ng.setting-management/-/ng.setting-management-4.2.0-rc.2.tgz#a7c5bb30e881f8efe702fcc8f3b95bf442b0289a" - integrity sha512-5sOk19EzFBIIdeTAx6EEmgh2pYOj5oRXq6uuAOmGVzZiX7arFoyqvTR4OAypIBQdMlZ0Iv4EApvJLD6/1IIrqw== +"@abp/ng.setting-management@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/ng.setting-management/-/ng.setting-management-4.2.0.tgz#4a4b685ee74ac5030b7e9e73ee67110219df9065" + integrity sha512-Ldl+I2jWgMuQdMOnnOBIfk0OoTao5QN9zzQwCGMPgu7dOGjD8IT9h9CpkG4ROKw9YAT1R+P8QlQ6502jQWOMYQ== dependencies: - "@abp/ng.theme.shared" "~4.2.0-rc.2" + "@abp/ng.theme.shared" "~4.2.0" tslib "^2.0.0" -"@abp/ng.tenant-management@~4.2.0-rc.2": - version "4.2.0-rc.2" - resolved "https://registry.yarnpkg.com/@abp/ng.tenant-management/-/ng.tenant-management-4.2.0-rc.2.tgz#dc5c019f16ac679589dbeac85317628ec6682096" - integrity sha512-O2Lb0Fe+L11yC69DAcgX4hY6KwI9ojaDnPTFxGtvvTjaUVKnxxchQrJwP0ITsudZe5cWKbF7cME3b3uH4jorBA== +"@abp/ng.tenant-management@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/ng.tenant-management/-/ng.tenant-management-4.2.0.tgz#e42aa4b81036c653abcc0144b74c287587a4ec9f" + integrity sha512-EWfwKAH4wjA37xigikXzI+jTNGopV3WEP/ezQj1KO7pbW1peiTXwIPHN7GDc8MJ6f2olZki7kXypzmgJn9A6KQ== dependencies: - "@abp/ng.feature-management" "~4.2.0-rc.2" - "@abp/ng.theme.shared" "~4.2.0-rc.2" + "@abp/ng.feature-management" "~4.2.0" + "@abp/ng.theme.shared" "~4.2.0" tslib "^2.0.0" -"@abp/ng.theme.basic@~4.2.0-rc.2": - version "4.2.0-rc.2" - resolved "https://registry.yarnpkg.com/@abp/ng.theme.basic/-/ng.theme.basic-4.2.0-rc.2.tgz#83c6ae4d0d95fc0271386a02c2f22531325c3b26" - integrity sha512-VGEDWIIRnmHPrhcjIhhBcqILI8NUsuVIX7K5XfJUuf3WmEzH9Ru9Yyi81AYZNuBNXNAjyjRH/nIxwljnHxO8bA== +"@abp/ng.theme.basic@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/ng.theme.basic/-/ng.theme.basic-4.2.0.tgz#bc239a9c014cca926c80196eb751a40ceeb7446c" + integrity sha512-xTy/AjuPujVNVb/cUenwRiKAS/BoYRR2Hh+AMksfgndIPMUEXYtJ8eSG+XOAtu0+QE/QI5RYk7FzcbfxDBeuvQ== dependencies: - "@abp/ng.theme.shared" "~4.2.0-rc.2" + "@abp/ng.theme.shared" "~4.2.0" tslib "^2.0.0" -"@abp/ng.theme.shared@~4.2.0-rc.2": - version "4.2.0-rc.2" - resolved "https://registry.yarnpkg.com/@abp/ng.theme.shared/-/ng.theme.shared-4.2.0-rc.2.tgz#935ca3aa32d8ced85d277139ce790f3cc3faa184" - integrity sha512-UjYPd6KL3bO9PN9XEmBlKQSc0C3EJsLHhifoV+rgtqAHvortOygSHHknOthRA4PN+cg2/PiuWA5gpvMHP1K7Ow== +"@abp/ng.theme.shared@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/ng.theme.shared/-/ng.theme.shared-4.2.0.tgz#4b7925c61224d4d1b182c50e11ef915b50b78dda" + integrity sha512-LfatA+lk/Wn6MOAZlHlJIiTH5uxqRWBl4QyWXhFrXhYYpJG4je06Y9KA3h+BP4dIQIe06gwAVYpE7D/ur3CbEQ== dependencies: - "@abp/ng.core" "~4.2.0-rc.2" + "@abp/ng.core" "~4.2.0" "@fortawesome/fontawesome-free" "^5.14.0" "@ng-bootstrap/ng-bootstrap" "^7.0.0" "@ngx-validate/core" "^0.0.13" @@ -92,10 +92,10 @@ chart.js "^2.9.3" tslib "^2.0.0" -"@abp/utils@^4.2.0-rc.1": - version "4.2.0-rc.1" - resolved "https://registry.yarnpkg.com/@abp/utils/-/utils-4.2.0-rc.1.tgz#397615ec208150f46ae626b67ea71053750f612f" - integrity sha512-MkXq5pKf/ZzJJT9oHYgBlUOL5wTx03qdxJeD82nxwJx6w5JFdshBWKj5iJixE1aM5HnzwSGn7bxFqe5QOKST+Q== +"@abp/utils@^4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/utils/-/utils-4.2.0.tgz#073330e3e3f6ee61892f50260e48dbe1b05df35e" + integrity sha512-75qR3SdiAa75wqleAx9sUMXLj4m9duuBo5+2sVv7Y29GcEyKUPvm8B1s6tksvSGA0e3vnFTHeVEc10eD1xKHSQ== dependencies: just-compare "^1.3.0" diff --git a/nupkg/common.ps1 b/nupkg/common.ps1 index 29249ef3f4..16f13513ee 100644 --- a/nupkg/common.ps1 +++ b/nupkg/common.ps1 @@ -91,6 +91,7 @@ $projects = ( "framework/src/Volo.Abp.EntityFrameworkCore.PostgreSql", "framework/src/Volo.Abp.EntityFrameworkCore.Sqlite", "framework/src/Volo.Abp.EntityFrameworkCore.SqlServer", + "framework/src/Volo.Abp.EventBus.Abstractions", "framework/src/Volo.Abp.EventBus", "framework/src/Volo.Abp.EventBus.RabbitMQ", "framework/src/Volo.Abp.EventBus.Kafka", diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor/MyCompanyName.MyProjectName.Blazor.csproj b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor/MyCompanyName.MyProjectName.Blazor.csproj index 96a8f791ee..bdb87e04c7 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor/MyCompanyName.MyProjectName.Blazor.csproj +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor/MyCompanyName.MyProjectName.Blazor.csproj @@ -8,8 +8,8 @@ - - + + diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Blazor.Host/MyCompanyName.MyProjectName.Blazor.Host.csproj b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Blazor.Host/MyCompanyName.MyProjectName.Blazor.Host.csproj index 57625cfd81..b166dc8898 100644 --- a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Blazor.Host/MyCompanyName.MyProjectName.Blazor.Host.csproj +++ b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Blazor.Host/MyCompanyName.MyProjectName.Blazor.Host.csproj @@ -8,8 +8,8 @@ - - + +