From cd50b57357ed591d0d08adaf90e981661737a0a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Fri, 15 Nov 2019 19:01:38 +0300 Subject: [PATCH 01/25] Resolved #2181: Introduce IDistributedCacheKeyNormalizer. --- .../Volo/Abp/Caching/DistributedCache.cs | 37 +++++++++++-------- .../DistributedCacheKeyNormalizeArgs.cs | 21 +++++++++++ .../Caching/DistributedCacheKeyNormalizer.cs | 33 +++++++++++++++++ .../Caching/IDistributedCacheKeyNormalizer.cs | 7 ++++ 4 files changed, 83 insertions(+), 15 deletions(-) create mode 100644 framework/src/Volo.Abp.Caching/Volo/Abp/Caching/DistributedCacheKeyNormalizeArgs.cs create mode 100644 framework/src/Volo.Abp.Caching/Volo/Abp/Caching/DistributedCacheKeyNormalizer.cs create mode 100644 framework/src/Volo.Abp.Caching/Volo/Abp/Caching/IDistributedCacheKeyNormalizer.cs diff --git a/framework/src/Volo.Abp.Caching/Volo/Abp/Caching/DistributedCache.cs b/framework/src/Volo.Abp.Caching/Volo/Abp/Caching/DistributedCache.cs index 4140cceeb3..dbcfb184eb 100644 --- a/framework/src/Volo.Abp.Caching/Volo/Abp/Caching/DistributedCache.cs +++ b/framework/src/Volo.Abp.Caching/Volo/Abp/Caching/DistributedCache.cs @@ -23,12 +23,12 @@ namespace Volo.Abp.Caching IDistributedCache cache, ICancellationTokenProvider cancellationTokenProvider, IDistributedCacheSerializer serializer, - ICurrentTenant currentTenant) : base( + IDistributedCacheKeyNormalizer keyNormalizer) : base( distributedCacheOption: distributedCacheOption, cache: cache, cancellationTokenProvider: cancellationTokenProvider, serializer: serializer, - currentTenant: currentTenant) + keyNormalizer: keyNormalizer) { } @@ -54,7 +54,7 @@ namespace Volo.Abp.Caching protected IDistributedCacheSerializer Serializer { get; } - protected ICurrentTenant CurrentTenant { get; } + protected IDistributedCacheKeyNormalizer KeyNormalizer { get; } protected SemaphoreSlim SyncSemaphore { get; } @@ -67,29 +67,29 @@ namespace Volo.Abp.Caching IDistributedCache cache, ICancellationTokenProvider cancellationTokenProvider, IDistributedCacheSerializer serializer, - ICurrentTenant currentTenant) + IDistributedCacheKeyNormalizer keyNormalizer) { _distributedCacheOption = distributedCacheOption.Value; Cache = cache; CancellationTokenProvider = cancellationTokenProvider; Logger = NullLogger>.Instance; Serializer = serializer; - CurrentTenant = currentTenant; + KeyNormalizer = keyNormalizer; SyncSemaphore = new SemaphoreSlim(1, 1); SetDefaultOptions(); } + protected virtual string NormalizeKey(TCacheKey key) { - var normalizedKey = "c:" + CacheName + ",k:" + _distributedCacheOption.KeyPrefix + key.ToString(); - - if (!IgnoreMultiTenancy && CurrentTenant.Id.HasValue) - { - normalizedKey = "t:" + CurrentTenant.Id.Value + "," + normalizedKey; - } - - return normalizedKey; + return KeyNormalizer.NormalizeKey( + new DistributedCacheKeyNormalizeArgs( + key.ToString(), + CacheName, + IgnoreMultiTenancy + ) + ); } protected virtual DistributedCacheEntryOptions GetDefaultCacheEntryOptions() @@ -102,6 +102,7 @@ namespace Volo.Abp.Caching return options; } } + return _distributedCacheOption.GlobalCacheEntryOptions; } @@ -115,6 +116,7 @@ namespace Volo.Abp.Caching //Configure default cache entry options DefaultCacheOptions = GetDefaultCacheEntryOptions(); } + /// /// Gets a cache item with the given key. If no cache item is found for the given key then returns null. /// @@ -193,6 +195,7 @@ namespace Volo.Abp.Caching return Serializer.Deserialize(cachedBytes); } + /// /// Gets or Adds a cache item with the given key. If no cache item is found for the given key then adds a cache item /// provided by delegate and returns the provided cache item. @@ -228,6 +231,7 @@ namespace Volo.Abp.Caching return value; } + /// /// Gets or Adds a cache item with the given key. If no cache item is found for the given key then adds a cache item /// provided by delegate and returns the provided cache item. @@ -266,6 +270,7 @@ namespace Volo.Abp.Caching return value; } + /// /// Sets the cache item value for the provided key. /// @@ -300,6 +305,7 @@ namespace Volo.Abp.Caching throw; } } + /// /// Sets the cache item value for the provided key. /// @@ -338,6 +344,7 @@ namespace Volo.Abp.Caching throw; } } + /// /// Refreshes the cache value of the given key, and resets its sliding expiration timeout. /// @@ -393,6 +400,7 @@ namespace Volo.Abp.Caching throw; } } + /// /// Removes the cache item for given key from cache. /// @@ -418,6 +426,7 @@ namespace Volo.Abp.Caching throw; } } + /// /// Removes the cache item for given key from cache. /// @@ -447,7 +456,5 @@ namespace Volo.Abp.Caching throw; } } - } - } \ No newline at end of file diff --git a/framework/src/Volo.Abp.Caching/Volo/Abp/Caching/DistributedCacheKeyNormalizeArgs.cs b/framework/src/Volo.Abp.Caching/Volo/Abp/Caching/DistributedCacheKeyNormalizeArgs.cs new file mode 100644 index 0000000000..791a1630eb --- /dev/null +++ b/framework/src/Volo.Abp.Caching/Volo/Abp/Caching/DistributedCacheKeyNormalizeArgs.cs @@ -0,0 +1,21 @@ +namespace Volo.Abp.Caching +{ + public class DistributedCacheKeyNormalizeArgs + { + public string Key { get; } + + public string CacheName { get; } + + public bool IgnoreMultiTenancy { get; } + + public DistributedCacheKeyNormalizeArgs( + string key, + string cacheName, + bool ignoreMultiTenancy) + { + Key = key; + CacheName = cacheName; + IgnoreMultiTenancy = ignoreMultiTenancy; + } + } +} \ No newline at end of file diff --git a/framework/src/Volo.Abp.Caching/Volo/Abp/Caching/DistributedCacheKeyNormalizer.cs b/framework/src/Volo.Abp.Caching/Volo/Abp/Caching/DistributedCacheKeyNormalizer.cs new file mode 100644 index 0000000000..aca22705dd --- /dev/null +++ b/framework/src/Volo.Abp.Caching/Volo/Abp/Caching/DistributedCacheKeyNormalizer.cs @@ -0,0 +1,33 @@ +using Microsoft.Extensions.Options; +using Volo.Abp.DependencyInjection; +using Volo.Abp.MultiTenancy; + +namespace Volo.Abp.Caching +{ + public class DistributedCacheKeyNormalizer : IDistributedCacheKeyNormalizer, ITransientDependency + { + protected ICurrentTenant CurrentTenant { get; } + + protected AbpDistributedCacheOptions DistributedCacheOptions { get; } + + public DistributedCacheKeyNormalizer( + ICurrentTenant currentTenant, + IOptions distributedCacheOptions) + { + CurrentTenant = currentTenant; + DistributedCacheOptions = distributedCacheOptions.Value; + } + + public virtual string NormalizeKey(DistributedCacheKeyNormalizeArgs args) + { + var normalizedKey = $"c:{args.CacheName},k:{DistributedCacheOptions.KeyPrefix}{args.Key}"; + + if (!args.IgnoreMultiTenancy && CurrentTenant.Id.HasValue) + { + normalizedKey = $"t:{CurrentTenant.Id.Value},{normalizedKey}"; + } + + return normalizedKey; + } + } +} \ No newline at end of file diff --git a/framework/src/Volo.Abp.Caching/Volo/Abp/Caching/IDistributedCacheKeyNormalizer.cs b/framework/src/Volo.Abp.Caching/Volo/Abp/Caching/IDistributedCacheKeyNormalizer.cs new file mode 100644 index 0000000000..5d4499a325 --- /dev/null +++ b/framework/src/Volo.Abp.Caching/Volo/Abp/Caching/IDistributedCacheKeyNormalizer.cs @@ -0,0 +1,7 @@ +namespace Volo.Abp.Caching +{ + public interface IDistributedCacheKeyNormalizer + { + string NormalizeKey(DistributedCacheKeyNormalizeArgs args); + } +} From f321f8aea06e0ffb1cdf062e4c8c1dc5b6050502 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Sat, 16 Nov 2019 22:11:08 +0300 Subject: [PATCH 02/25] Update Index.md --- docs/en/Modules/Index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/en/Modules/Index.md b/docs/en/Modules/Index.md index 97af3db132..1e25d67f86 100644 --- a/docs/en/Modules/Index.md +++ b/docs/en/Modules/Index.md @@ -19,7 +19,7 @@ There are some **free and open source** application modules developed and mainta * **Identity**: Used to manage roles, users and their permissions. * **Identity Server**: Integrates to IdentityServer4. * **Permission Management**: Used to persist permissions. -* **[Setting Management](Setting-Management.md)**: Used to persist and manage the [settings](../Settings.md). +* [**Setting Management**](Setting-Management.md): Used to persist and manage the [settings](../Settings.md). * **Tenant Management**: Used to manage tenants for a [multi-tenant](../Multi-Tenancy.md) application. * **Users**: Used to abstract users, so other modules can depend on this instead of the Identity module. From 3bb802da6b7cc36b78c61f625ce6090fc8223555 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mehmet=20Tu=CC=88ken?= Date: Sun, 17 Nov 2019 16:02:26 +0300 Subject: [PATCH 03/25] Adding cli namespace normalizer. Reference: https://stackoverflow.com/questions/773557/which-characters-are-allowed-in-a-vs-project-name Reference: https://github.com/dotnet/templating/blob/dcf5adbd4b5665887f22ad19592dedfb9f1e1b68/src/Microsoft.TemplateEngine.Orchestrator.RunnableProjects/ValueForms/DefaultSafeNamespaceValueFormModel.cs#L35 --- .../Abp/Cli/Args/CommandLineArgumentParser.cs | 2 ++ .../Volo/Abp/Cli/Utils/NamespaceHelper.cs | 21 +++++++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Utils/NamespaceHelper.cs diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Args/CommandLineArgumentParser.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Args/CommandLineArgumentParser.cs index 1dd29e5df7..52ddfafae5 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Args/CommandLineArgumentParser.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Args/CommandLineArgumentParser.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Linq; +using Volo.Abp.Cli.Utils; using Volo.Abp.DependencyInjection; namespace Volo.Abp.Cli.Args @@ -40,6 +41,7 @@ namespace Volo.Abp.Cli.Args if (!argumentList.Any()) { + target = NamespaceHelper.NormalizeNamespace(target); return new CommandLineArgs(command, target); } diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Utils/NamespaceHelper.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Utils/NamespaceHelper.cs new file mode 100644 index 0000000000..9001cd51e3 --- /dev/null +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Utils/NamespaceHelper.cs @@ -0,0 +1,21 @@ +using System.Text.RegularExpressions; +using JetBrains.Annotations; + +namespace Volo.Abp.Cli.Utils +{ + public static class NamespaceHelper + { + public static string NormalizeNamespace([CanBeNull] string value) + { + if (string.IsNullOrEmpty(value)) + { + return value; + } + + value = Regex.Replace(value, @"(^\s+|\s+$)", ""); + value = Regex.Replace(value, @"(((?<=\.)|^)((?=\d)|\.)|[^\w\.])|(\.$)", "_"); + + return value; + } + } +} \ No newline at end of file From 668bbbc407398c83d73030c38bfc5b4d66fa2417 Mon Sep 17 00:00:00 2001 From: Thiago Coelho Date: Sun, 17 Nov 2019 23:11:15 -0300 Subject: [PATCH 04/25] Updating pt-BR account localization --- .../Localization/Resources/AbpUi/pt-BR.json | 9 ++++++++- .../Volo/Abp/Account/Localization/Resources/pt-BR.json | 10 ++++++---- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/pt-BR.json b/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/pt-BR.json index c589a46e38..34682c9d28 100644 --- a/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/pt-BR.json +++ b/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/pt-BR.json @@ -46,6 +46,13 @@ "DatatableActionDropdownDefaultText": "Ações", "ChangePassword": "Alterar Senha", "PersonalInfo": "Perfil", - "AreYouSureYouWantToCancelEditingWarningMessage": "Há alterações não salvas." + "AreYouSureYouWantToCancelEditingWarningMessage": "Há alterações não salvas.", + "UnhandledException": "Exceção não tratada!", + "401Message": "Autenticação inválida", + "403Message": "Não autorizado", + "404Message": "Página não encontrada", + "500Message": "Erro interno do servidor", + "GoHomePage": "Voltar à página principal", + "GoBack": "Voltar" } } \ No newline at end of file diff --git a/modules/account/src/Volo.Abp.Account.Application.Contracts/Volo/Abp/Account/Localization/Resources/pt-BR.json b/modules/account/src/Volo.Abp.Account.Application.Contracts/Volo/Abp/Account/Localization/Resources/pt-BR.json index bfc1293cb5..a533acd4f2 100644 --- a/modules/account/src/Volo.Abp.Account.Application.Contracts/Volo/Abp/Account/Localization/Resources/pt-BR.json +++ b/modules/account/src/Volo.Abp.Account.Application.Contracts/Volo/Abp/Account/Localization/Resources/pt-BR.json @@ -3,7 +3,7 @@ "texts": { "UserName": "Usuário", "EmailAddress": "E-mail", - "UserNameOrEmailAddress": "Utilize seu nome de usuário ou e-mail", + "UserNameOrEmailAddress": "Usuário ou e-mail", "Password": "Senha", "RememberMe": "Lembrar", "UseAnotherServiceToLogin": "Usar outro serviço para entrar", @@ -13,10 +13,12 @@ "SelfRegistrationDisabledMessage": "Não é permitido que você crie uma nova conta neste site. Contate um administrador para que ele crie uma conta para você.", "Login": "Entrar", "Cancel": "Cancelar", - "Register": "Registrar-se", - "InvalidLoginRequest": "Requisição de acesso inválida!", + "Register": "Registre-se", + "AreYouANewUser": "Você é um novo usuário?", + "AlreadyRegistered": "Já registrado?", + "InvalidLoginRequest": "Requisição de acesso inválido!", "ThereAreNoLoginSchemesConfiguredForThisClient": "Não existe um esquema de acesso para este usuário", - "LogInUsingYourProviderAccount": "Acessse utilizando sua conta {0}", + "LogInUsingYourProviderAccount": "Acesse utilizando sua conta {0}", "DisplayName:CurrentPassword": "Senha atual", "DisplayName:NewPassword": "Nova Senha", "DisplayName:NewPasswordConfirm": "Confirmação de senha", From 7b273bc22e1c28ae6470248041e6e54ba3fcd1ee Mon Sep 17 00:00:00 2001 From: YinChang Date: Mon, 18 Nov 2019 12:15:03 +0800 Subject: [PATCH 05/25] feature(theme-basic) resolve #2193 hide language dropdown when only one language --- .../application-layout/application-layout.component.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/ng-packs/packages/theme-basic/src/lib/components/application-layout/application-layout.component.html b/npm/ng-packs/packages/theme-basic/src/lib/components/application-layout/application-layout.component.html index a5460b782b..3046313407 100644 --- a/npm/ng-packs/packages/theme-basic/src/lib/components/application-layout/application-layout.component.html +++ b/npm/ng-packs/packages/theme-basic/src/lib/components/application-layout/application-layout.component.html @@ -158,7 +158,7 @@ -