From 0b74af6f900ba78b1635fbac98364e8ea3c37b6a Mon Sep 17 00:00:00 2001 From: maliming Date: Fri, 21 Feb 2020 12:08:27 +0800 Subject: [PATCH 1/7] introduce AlwaysAllowMethodInvocationAuthorizationService. Resolve #2874 --- .../AbpAuthorizationServiceCollectionExtensions.cs | 1 + ...lwaysAllowMethodInvocationAuthorizationService.cs | 12 ++++++++++++ 2 files changed, 13 insertions(+) create mode 100644 framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/AlwaysAllowMethodInvocationAuthorizationService.cs diff --git a/framework/src/Volo.Abp.Authorization/Microsoft/Extensions/DependencyInjection/AbpAuthorizationServiceCollectionExtensions.cs b/framework/src/Volo.Abp.Authorization/Microsoft/Extensions/DependencyInjection/AbpAuthorizationServiceCollectionExtensions.cs index 093c9f3884..1cd3f5a0b7 100644 --- a/framework/src/Volo.Abp.Authorization/Microsoft/Extensions/DependencyInjection/AbpAuthorizationServiceCollectionExtensions.cs +++ b/framework/src/Volo.Abp.Authorization/Microsoft/Extensions/DependencyInjection/AbpAuthorizationServiceCollectionExtensions.cs @@ -11,6 +11,7 @@ namespace Microsoft.Extensions.DependencyInjection { services.Replace(ServiceDescriptor.Singleton()); services.Replace(ServiceDescriptor.Singleton()); + services.Replace(ServiceDescriptor.Singleton()); return services.Replace(ServiceDescriptor.Singleton()); } } diff --git a/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/AlwaysAllowMethodInvocationAuthorizationService.cs b/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/AlwaysAllowMethodInvocationAuthorizationService.cs new file mode 100644 index 0000000000..d4a30b56f5 --- /dev/null +++ b/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/AlwaysAllowMethodInvocationAuthorizationService.cs @@ -0,0 +1,12 @@ +using System.Threading.Tasks; + +namespace Volo.Abp.Authorization +{ + public class AlwaysAllowMethodInvocationAuthorizationService : IMethodInvocationAuthorizationService + { + public Task CheckAsync(MethodInvocationAuthorizationContext context) + { + return Task.CompletedTask; + } + } +} \ No newline at end of file From a18b8201bf636e046452ffb3302da7b48e9b684b Mon Sep 17 00:00:00 2001 From: AkinCam <172804016@ogr.cbu.edu.tr> Date: Fri, 21 Feb 2020 10:38:45 +0300 Subject: [PATCH 2/7] Added some localization keys --- .../Commercial/Localization/Resources/en.json | 7 ++++--- .../Volo/Abp/Users/UserLookupService.cs | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/abp_io/AbpIoLocalization/AbpIoLocalization/Commercial/Localization/Resources/en.json b/abp_io/AbpIoLocalization/AbpIoLocalization/Commercial/Localization/Resources/en.json index 7987b9ab32..3df70437b4 100644 --- a/abp_io/AbpIoLocalization/AbpIoLocalization/Commercial/Localization/Resources/en.json +++ b/abp_io/AbpIoLocalization/AbpIoLocalization/Commercial/Localization/Resources/en.json @@ -5,8 +5,9 @@ "OrganizationList": "Organization list", "Volo.AbpIo.Commercial:010003": "You are not owner of this organization!", "OrganizationNotFoundMessage": "No organization found!", - "DeveloperCount": "Developer count", - "QuestionCount": "Question count", + "DeveloperCount": "Allocated / total developers", + "QuestionCount": "Remaining / total questions", + "Unlimited": "Unlimited", "Owners": "Owners", "AddMember": "Add member", "AddOwner": "Add owner", @@ -30,5 +31,5 @@ "SuccessfullyAddedToNewsletter": "Thanks you for subscribing to our newsletter!", "ManageProfile": "Manage your profile", "EmailNotValid": "Please enter a valid email address." - } + } } \ No newline at end of file diff --git a/modules/users/src/Volo.Abp.Users.Domain/Volo/Abp/Users/UserLookupService.cs b/modules/users/src/Volo.Abp.Users.Domain/Volo/Abp/Users/UserLookupService.cs index 09979f00e1..d2a13d9ba4 100644 --- a/modules/users/src/Volo.Abp.Users.Domain/Volo/Abp/Users/UserLookupService.cs +++ b/modules/users/src/Volo.Abp.Users.Domain/Volo/Abp/Users/UserLookupService.cs @@ -32,7 +32,7 @@ namespace Volo.Abp.Users public async Task FindByIdAsync(Guid id, CancellationToken cancellationToken = default) { - var localUser = await _userRepository.FindAsync(id, cancellationToken: cancellationToken); + var localUser = await _userRepository.FindAsync(id,cancellationToken: cancellationToken); if (ExternalUserLookupServiceProvider == null) { From 570ff20382e27324ddba26aa78084e93c60b4f8c Mon Sep 17 00:00:00 2001 From: maliming Date: Mon, 24 Feb 2020 09:54:37 +0800 Subject: [PATCH 3/7] Update EfCoreAuditLogRepository.cs --- .../EntityFrameworkCore/EfCoreAuditLogRepository.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/audit-logging/src/Volo.Abp.AuditLogging.EntityFrameworkCore/Volo/Abp/AuditLogging/EntityFrameworkCore/EfCoreAuditLogRepository.cs b/modules/audit-logging/src/Volo.Abp.AuditLogging.EntityFrameworkCore/Volo/Abp/AuditLogging/EntityFrameworkCore/EfCoreAuditLogRepository.cs index 094f946777..1a13b702b0 100644 --- a/modules/audit-logging/src/Volo.Abp.AuditLogging.EntityFrameworkCore/Volo/Abp/AuditLogging/EntityFrameworkCore/EfCoreAuditLogRepository.cs +++ b/modules/audit-logging/src/Volo.Abp.AuditLogging.EntityFrameworkCore/Volo/Abp/AuditLogging/EntityFrameworkCore/EfCoreAuditLogRepository.cs @@ -106,6 +106,7 @@ namespace Volo.Abp.AuditLogging.EntityFrameworkCore HttpStatusCode? httpStatusCode = null, bool includeDetails = false) { + var nHttpStatusCode = (int?) httpStatusCode; return DbSet.AsNoTracking() .IncludeDetails(includeDetails) .WhereIf(startTime.HasValue, auditLog => auditLog.ExecutionTime >= startTime) @@ -117,7 +118,7 @@ namespace Volo.Abp.AuditLogging.EntityFrameworkCore .WhereIf(userName != null, auditLog => auditLog.UserName == userName) .WhereIf(applicationName != null, auditLog => auditLog.ApplicationName == applicationName) .WhereIf(correlationId != null, auditLog => auditLog.CorrelationId == correlationId) - .WhereIf(httpStatusCode != null && httpStatusCode > 0, auditLog => auditLog.HttpStatusCode == (int?)httpStatusCode) + .WhereIf(httpStatusCode != null && httpStatusCode > 0, auditLog => auditLog.HttpStatusCode == nHttpStatusCode) .WhereIf(maxExecutionDuration != null && maxExecutionDuration.Value > 0, auditLog => auditLog.ExecutionDuration <= maxExecutionDuration) .WhereIf(minExecutionDuration != null && minExecutionDuration.Value > 0, auditLog => auditLog.ExecutionDuration >= minExecutionDuration); } From 40bc8e3cc1697a3e88b7dd61f849c705755eb76d Mon Sep 17 00:00:00 2001 From: maliming Date: Mon, 24 Feb 2020 13:31:44 +0800 Subject: [PATCH 4/7] Audited*WithUser generic type wrong constraint. Resolve #2624 --- .../Domain/Entities/Auditing/AuditedAggregateRootWithUser.cs | 4 ++-- .../Abp/Domain/Entities/Auditing/AuditedEntityWithUser.cs | 4 ++-- .../Abp/Domain/Entities/Auditing/FullAuditedEntityWithUser.cs | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Auditing/AuditedAggregateRootWithUser.cs b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Auditing/AuditedAggregateRootWithUser.cs index ec490fbb50..477f8750fd 100644 --- a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Auditing/AuditedAggregateRootWithUser.cs +++ b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Auditing/AuditedAggregateRootWithUser.cs @@ -9,7 +9,7 @@ namespace Volo.Abp.Domain.Entities.Auditing /// Type of the user [Serializable] public abstract class AuditedAggregateRootWithUser : AuditedAggregateRoot, IAuditedObject - where TUser : IEntity + where TUser : IEntity { /// public virtual TUser Creator { get; set; } @@ -25,7 +25,7 @@ namespace Volo.Abp.Domain.Entities.Auditing /// Type of the user [Serializable] public abstract class AuditedAggregateRootWithUser : AuditedAggregateRoot, IAuditedObject - where TUser : IEntity + where TUser : IEntity { /// public virtual TUser Creator { get; set; } diff --git a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Auditing/AuditedEntityWithUser.cs b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Auditing/AuditedEntityWithUser.cs index fd6aeb9dd9..cc54209595 100644 --- a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Auditing/AuditedEntityWithUser.cs +++ b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Auditing/AuditedEntityWithUser.cs @@ -9,7 +9,7 @@ namespace Volo.Abp.Domain.Entities.Auditing /// Type of the user [Serializable] public abstract class AuditedEntityWithUser : AuditedEntity, IAuditedObject - where TUser : IEntity + where TUser : IEntity { /// public virtual TUser Creator { get; set; } @@ -25,7 +25,7 @@ namespace Volo.Abp.Domain.Entities.Auditing /// Type of the user [Serializable] public abstract class AuditedEntityWithUser : AuditedEntity, IAuditedObject - where TUser : IEntity + where TUser : IEntity { /// public virtual TUser Creator { get; set; } diff --git a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Auditing/FullAuditedEntityWithUser.cs b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Auditing/FullAuditedEntityWithUser.cs index 12458ebf99..3156813843 100644 --- a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Auditing/FullAuditedEntityWithUser.cs +++ b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Auditing/FullAuditedEntityWithUser.cs @@ -9,7 +9,7 @@ namespace Volo.Abp.Domain.Entities.Auditing /// Type of the user [Serializable] public abstract class FullAuditedEntityWithUser : FullAuditedEntity, IFullAuditedObject - where TUser : IEntity + where TUser : IEntity { /// public virtual TUser Deleter { get; set; } @@ -28,7 +28,7 @@ namespace Volo.Abp.Domain.Entities.Auditing /// Type of the user [Serializable] public abstract class FullAuditedEntityWithUser : FullAuditedEntity, IFullAuditedObject - where TUser : IEntity + where TUser : IEntity { /// public virtual TUser Deleter { get; set; } From 22b9756cccd4c9e4b600b039bfca9904b8018347 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arma=C4=9Fan=20=C3=9Cnl=C3=BC?= <36102404+armgnunlu@users.noreply.github.com> Date: Mon, 24 Feb 2020 09:48:23 +0300 Subject: [PATCH 5/7] blog edit --- .../src/Volo.Blogging.Web/Pages/Blogs/Posts/Index.cshtml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/Index.cshtml b/modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/Index.cshtml index b0f9dc4d46..8c0b63d998 100644 --- a/modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/Index.cshtml +++ b/modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/Index.cshtml @@ -142,15 +142,15 @@ var oddPost = index % 2 == 1;
-
-
+
+ -
+

@post.Title

From 8f7baa5bf971330f94c7b99f6ff0422105a9bda7 Mon Sep 17 00:00:00 2001 From: Alper Ebicoglu Date: Mon, 24 Feb 2020 10:40:42 +0300 Subject: [PATCH 6/7] Update UserLookupService.cs --- .../Volo.Abp.Users.Domain/Volo/Abp/Users/UserLookupService.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/users/src/Volo.Abp.Users.Domain/Volo/Abp/Users/UserLookupService.cs b/modules/users/src/Volo.Abp.Users.Domain/Volo/Abp/Users/UserLookupService.cs index d2a13d9ba4..2c28d71b80 100644 --- a/modules/users/src/Volo.Abp.Users.Domain/Volo/Abp/Users/UserLookupService.cs +++ b/modules/users/src/Volo.Abp.Users.Domain/Volo/Abp/Users/UserLookupService.cs @@ -32,7 +32,7 @@ namespace Volo.Abp.Users public async Task FindByIdAsync(Guid id, CancellationToken cancellationToken = default) { - var localUser = await _userRepository.FindAsync(id,cancellationToken: cancellationToken); + var localUser = await _userRepository.FindAsync(id, cancellationToken: cancellationToken); if (ExternalUserLookupServiceProvider == null) { @@ -149,4 +149,4 @@ namespace Volo.Abp.Users } } } -} \ No newline at end of file +} From 4391b4a852ef4a7744c9aa7d5f5392f2db31fe53 Mon Sep 17 00:00:00 2001 From: Yunus Emre Kalkan Date: Mon, 24 Feb 2020 11:07:46 +0300 Subject: [PATCH 7/7] refactor --- .../Services/AbpNuGetIndexUrlService.cs | 48 +++++++++++++++++++ .../Volo/Abp/Cli/Commands/SuiteCommand.cs | 38 +++------------ 2 files changed, 54 insertions(+), 32 deletions(-) create mode 100644 framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/Services/AbpNuGetIndexUrlService.cs diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/Services/AbpNuGetIndexUrlService.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/Services/AbpNuGetIndexUrlService.cs new file mode 100644 index 0000000000..0e1f987d4e --- /dev/null +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/Services/AbpNuGetIndexUrlService.cs @@ -0,0 +1,48 @@ +using System; +using System.Collections.Generic; +using System.Text; +using System.Threading.Tasks; +using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Logging.Abstractions; +using Volo.Abp.Cli.Licensing; +using Volo.Abp.DependencyInjection; + +namespace Volo.Abp.Cli.Commands.Services +{ + public class AbpNuGetIndexUrlService : ITransientDependency + { + private readonly IApiKeyService _apiKeyService; + public ILogger Logger { get; set; } + + public AbpNuGetIndexUrlService(IApiKeyService apiKeyService) + { + _apiKeyService = apiKeyService; + Logger = NullLogger.Instance; + } + + public async Task GetAsync() + { + var apiKeyResult = await _apiKeyService.GetApiKeyOrNullAsync(); + + if (apiKeyResult == null) + { + Logger.LogWarning("You are not signed in! Use the CLI command \"abp login \" to sign in, then try again."); + return null; + } + + if (!string.IsNullOrWhiteSpace(apiKeyResult.ErrorMessage)) + { + Logger.LogWarning(apiKeyResult.ErrorMessage); + return null; + } + + if (string.IsNullOrEmpty(apiKeyResult.ApiKey)) + { + Logger.LogError("Couldn't retrieve your NuGet API key! You can re-sign in with the CLI command \"abp login \"."); + return null; + } + + return CliUrls.GetNuGetServiceIndexUrl(apiKeyResult.ApiKey); + } + } +} diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/SuiteCommand.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/SuiteCommand.cs index a13621ea22..b4a4ff8bdd 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/SuiteCommand.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/SuiteCommand.cs @@ -1,11 +1,10 @@ using System; -using System.IO; using System.Text; using System.Threading.Tasks; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging.Abstractions; using Volo.Abp.Cli.Args; -using Volo.Abp.Cli.Licensing; +using Volo.Abp.Cli.Commands.Services; using Volo.Abp.Cli.Utils; using Volo.Abp.DependencyInjection; @@ -13,13 +12,13 @@ namespace Volo.Abp.Cli.Commands { public class SuiteCommand : IConsoleCommand, ITransientDependency { + private readonly AbpNuGetIndexUrlService _nuGetIndexUrlService; private const string SuitePackageName = "Volo.Abp.Suite"; public ILogger Logger { get; set; } - private readonly IApiKeyService _apiKeyService; - public SuiteCommand(IApiKeyService apiKeyService) + public SuiteCommand(AbpNuGetIndexUrlService nuGetIndexUrlService) { - _apiKeyService = apiKeyService; + _nuGetIndexUrlService = nuGetIndexUrlService; Logger = NullLogger.Instance; } @@ -53,7 +52,7 @@ namespace Volo.Abp.Cli.Commands private async Task InstallSuiteAsync() { - var nugetIndexUrl = await GetNuGetIndexUrlAsync(); + var nugetIndexUrl = await _nuGetIndexUrlService.GetAsync(); if (nugetIndexUrl == null) { @@ -71,7 +70,7 @@ namespace Volo.Abp.Cli.Commands private async Task UpdateSuiteAsync() { - var nugetIndexUrl = await GetNuGetIndexUrlAsync(); + var nugetIndexUrl = await _nuGetIndexUrlService.GetAsync(); if (nugetIndexUrl == null) { @@ -104,31 +103,6 @@ namespace Volo.Abp.Cli.Commands CmdHelper.RunCmd("abp-suite"); } - private async Task GetNuGetIndexUrlAsync() - { - var apiKeyResult = await _apiKeyService.GetApiKeyOrNullAsync(); - - if (apiKeyResult == null) - { - Logger.LogWarning("You are not signed in! Use the CLI command \"abp login \" to sign in, then try again."); - return null; - } - - if (!string.IsNullOrWhiteSpace(apiKeyResult.ErrorMessage)) - { - Logger.LogWarning(apiKeyResult.ErrorMessage); - return null; - } - - if (string.IsNullOrEmpty(apiKeyResult.ApiKey)) - { - Logger.LogError("Couldn't retrieve your NuGet API key! You can re-sign in with the CLI command \"abp login \"."); - return null; - } - - return CliUrls.GetNuGetServiceIndexUrl(apiKeyResult.ApiKey); - } - public string GetUsageInfo() { var sb = new StringBuilder();