Merge branch 'dev' into maliming/MongoDbDateTime

pull/10149/head
maliming 4 years ago
commit 3c0f5ae197

@ -5,7 +5,7 @@
<MicrosoftPackageVersion>6.0.0-rc.*</MicrosoftPackageVersion>
<!-- Microsoft.NET.Test.Sdk https://www.nuget.org/packages/Microsoft.NET.Test.Sdk -->
<MicrosoftNETTestSdkPackageVersion>16.9.1</MicrosoftNETTestSdkPackageVersion>
<MicrosoftNETTestSdkPackageVersion>16.11.0</MicrosoftNETTestSdkPackageVersion>
<!-- NSubstitute https://www.nuget.org/packages/NSubstitute -->
<NSubstitutePackageVersion>4.2.2</NSubstitutePackageVersion>
@ -23,7 +23,7 @@
<xUnitRunnerVisualstudioPackageVersion>2.4.3</xUnitRunnerVisualstudioPackageVersion>
<!-- Mongo2Go https://www.nuget.org/packages/Mongo2Go -->
<Mongo2GoPackageVersion>3.1.1</Mongo2GoPackageVersion>
<Mongo2GoPackageVersion>3.1.3</Mongo2GoPackageVersion>
</PropertyGroup>
</Project>

@ -310,6 +310,45 @@
"DeleteInvoice" : "Delete Invoice",
"SuccessfullyDeleted": "Successfully deleted!",
"PaymentStateSetTo" : "Payment state set to {0}",
"ChangeState": "Change State"
"ChangeState": "Change State",
"Permission:TrialLicense" : "Trial License",
"Permission:ManageTrialLicense": "Manage Trial License",
"Menu:TrialLicenses": "Trial Licenses",
"TrialLicenses": "Trial Licenses",
"UserNameFilter": "Username",
"TrialLicenseStatusFilter": "Status",
"TrialLicenseStartDateFilter": "Start date",
"TrialLicenseEndDateFilter": "End date",
"FirsName": "First name",
"LastName": "Last name",
"Status": "Status",
"StartDate": "Start date",
"EndDate": "End date",
"CompanyName": "Company name",
"PurchasedDate": "Purchased date",
"OrganizationDetail": "Organization Detail",
"SendActivationMail": "Send Activation Mail",
"ActivationMailSentSuccessfully": "Activation mail sent successfully!",
"TrialLicenseStatus": "Trial license status",
"TrialLicenseDetail": "Trial License Detail",
"AcceptsMarketingCommunications": "Marketing Communications",
"PurposeOfUsage": "Purpose of usage",
"CountryName": "Country name",
"CompanySize": "Company size",
"DetailTrialLicense": "Details",
"Requested": "Requested",
"Activated": "Activated",
"PurchasedToNormalLicense": "Purchased",
"Expired": "Expired",
"TrialLicenseDeletionWarningMessage": "Trial license and if any organization and qa organization will be deleted!",
"IsTrial": "Is trial",
"Volo.AbpIo.Commercial:030000": "You already used your trial period.",
"Volo.AbpIo.Commercial:030001": "This organization name already exists.",
"Volo.AbpIo.Commercial:030002": "Once activated, trial license cannot be set to requested!",
"Volo.AbpIo.Commercial:030003": "There is no such status!",
"Volo.AbpIo.Commercial:030004": "Status could not be changed due to an unexpected error!",
"Volo.AbpIo.Commercial:030005": "Start date and end date cannot be given when the trial license is in the requested state!",
"Volo.AbpIo.Commercial:030006": "End date must always be greater than start date!",
"Volo.AbpIo.Commercial:030007": "This trial license has already been activated once!"
}
}

@ -1,7 +1,7 @@
<Project>
<ItemGroup>
<PackageReference Include="ConfigureAwait.Fody" Version="3.3.1" PrivateAssets="All" />
<PackageReference Include="Fody" Version="6.5.0">
<PackageReference Include="Fody" Version="6.5.3">
<PrivateAssets>All</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>

@ -0,0 +1,88 @@
# How to override localization strings of depending modules
## Source Code
You can find the source of the example solution used in this article [here](https://github.com/abpframework/abp-samples/tree/master/DocumentationSamples/ExtendLocalizationResource).
## Getting Started
This example is based on the following document
https://docs.abp.io/en/abp/latest/Localization#extending-existing-resource
We will change the default `DisplayName:Abp.Timing.Timezone` and `Description:Abp.Timing.Timezone` of [`AbpTimingResource`](https://github.com/abpframework/abp/blob/dev/framework/src/Volo.Abp.Timing/Volo/Abp/Timing/Localization/AbpTimingResource.cs) and add localized text in [Russian language(`ru`)](https://github.com/abpframework/abp/blob/dev/framework/src/Volo.Abp.Timing/Volo/Abp/Timing/Localization/en.json).
I created the `AbpTiming` folder in the `Localization` directory of the `ExtendLocalizationResource.Domain.Shared` project.
Create `en.json` and `ru.json` in its directory.
`en.json`
```json
{
"culture": "en",
"texts": {
"DisplayName:Abp.Timing.Timezone": "My Time zone",
"Description:Abp.Timing.Timezone": "My Application time zone"
}
}
```
`ru.json`
```json
{
"culture": "ru",
"texts": {
"DisplayName:Abp.Timing.Timezone": "Часовой пояс",
"Description:Abp.Timing.Timezone": "Часовой пояс приложения"
}
}
```
![](1.png)
We have below content in `ExtendLocalizationResource.Domain.Shared.csproj` file, See [Virtual-File-System](https://docs.abp.io/en/abp/latest/Virtual-File-System#working-with-the-embedded-files) understand how it works.
```xml
<ItemGroup>
<EmbeddedResource Include="Localization\ExtendLocalizationResource\*.json" />
<Content Remove="Localization\ExtendLocalizationResource\*.json" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.FileProviders.Embedded" Version="5.0.*" />
</ItemGroup>
```
Change the code of the `ConfigureServices` method in `ExtendLocalizationResourceDomainSharedModule`.
```cs
Configure<AbpLocalizationOptions>(options =>
{
options.Resources
.Add<ExtendLocalizationResourceResource>("en")
.AddBaseTypes(typeof(AbpValidationResource))
.AddVirtualJson("/Localization/ExtendLocalizationResource");
//add following code
options.Resources
.Get<AbpTimingResource>()
.AddVirtualJson("/Localization/AbpTiming");
options.DefaultResourceType = typeof(ExtendLocalizationResourceResource);
});
```
Execute `ExtendLocalizationResource.DbMigrator` to migrate the database and run `ExtendLocalizationResource.Web`.
We have changed the English localization text and added Russian localization.
### Index page
```cs
<p>@AbpTimingResource["DisplayName:Abp.Timing.Timezone"]</p>
@using(CultureHelper.Use("ru"))
{
<p>@AbpTimingResource["DisplayName:Abp.Timing.Timezone"]</p>
}
```
![](2.png)

@ -389,6 +389,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Volo.Abp.Threading.Tests",
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Volo.Abp.Auditing.Contracts", "src\Volo.Abp.Auditing.Contracts\Volo.Abp.Auditing.Contracts.csproj", "{508B6355-AD28-4E60-8549-266D21DBF2CF}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Volo.Abp.Http.Client.Web", "src\Volo.Abp.Http.Client.Web\Volo.Abp.Http.Client.Web.csproj", "{F7407459-8AFA-45E4-83E9-9BB01412CC08}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -1159,6 +1161,10 @@ Global
{508B6355-AD28-4E60-8549-266D21DBF2CF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{508B6355-AD28-4E60-8549-266D21DBF2CF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{508B6355-AD28-4E60-8549-266D21DBF2CF}.Release|Any CPU.Build.0 = Release|Any CPU
{F7407459-8AFA-45E4-83E9-9BB01412CC08}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F7407459-8AFA-45E4-83E9-9BB01412CC08}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F7407459-8AFA-45E4-83E9-9BB01412CC08}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F7407459-8AFA-45E4-83E9-9BB01412CC08}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -1355,6 +1361,7 @@ Global
{40C6740E-BFCA-4D37-8344-3D84E2044BB2} = {447C8A77-E5F0-4538-8687-7383196D04EA}
{7B2FCAD6-86E6-49C8-ADBE-A61B4F4B101B} = {447C8A77-E5F0-4538-8687-7383196D04EA}
{508B6355-AD28-4E60-8549-266D21DBF2CF} = {5DF0E140-0513-4D0D-BE2E-3D4D85CD70E6}
{F7407459-8AFA-45E4-83E9-9BB01412CC08} = {5DF0E140-0513-4D0D-BE2E-3D4D85CD70E6}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {BB97ECF4-9A84-433F-A80B-2A3285BDD1D5}

@ -15,7 +15,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="NUglify" Version="1.13.8" />
<PackageReference Include="NUglify" Version="1.16.0" />
</ItemGroup>
<ItemGroup>

@ -0,0 +1,25 @@
using JetBrains.Annotations;
using Microsoft.AspNetCore.Authorization;
namespace Volo.Abp.Authorization
{
public class PermissionsRequirement : IAuthorizationRequirement
{
public string[] PermissionNames { get; }
public bool RequiresAll { get; }
public PermissionsRequirement([NotNull]string[] permissionNames, bool requiresAll)
{
Check.NotNull(permissionNames, nameof(permissionNames));
PermissionNames = permissionNames;
RequiresAll = requiresAll;
}
public override string ToString()
{
return $"PermissionsRequirement: {string.Join(", ", PermissionNames)}";
}
}
}

@ -0,0 +1,31 @@
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authorization;
using Volo.Abp.Authorization.Permissions;
namespace Volo.Abp.Authorization
{
public class PermissionsRequirementHandler : AuthorizationHandler<PermissionsRequirement>
{
private readonly IPermissionChecker _permissionChecker;
public PermissionsRequirementHandler(IPermissionChecker permissionChecker)
{
_permissionChecker = permissionChecker;
}
protected override async Task HandleRequirementAsync(
AuthorizationHandlerContext context,
PermissionsRequirement requirement)
{
var multiplePermissionGrantResult = await _permissionChecker.IsGrantedAsync(context.User, requirement.PermissionNames);
if (requirement.RequiresAll ?
multiplePermissionGrantResult.AllGranted :
multiplePermissionGrantResult.Result.Any(x => x.Value == PermissionGrantResult.Granted))
{
context.Succeed(requirement);
}
}
}
}

@ -31,6 +31,7 @@ namespace Volo.Abp.Authorization
context.Services.AddAuthorizationCore();
context.Services.AddSingleton<IAuthorizationHandler, PermissionRequirementHandler>();
context.Services.AddSingleton<IAuthorizationHandler, PermissionsRequirementHandler>();
context.Services.TryAddTransient<DefaultAuthorizationPolicyProvider>();

@ -15,7 +15,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Autofac" Version="6.1.0" />
<PackageReference Include="Autofac" Version="6.2.0" />
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="7.1.0" />
<PackageReference Include="Autofac.Extras.DynamicProxy" Version="6.0.0" />
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" Version="$(MicrosoftPackageVersion)" />

@ -17,8 +17,8 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="AWSSDK.S3" Version="3.7.0.2" />
<PackageReference Include="AWSSDK.SecurityToken" Version="3.7.0.1" />
<PackageReference Include="AWSSDK.S3" Version="3.7.3.1" />
<PackageReference Include="AWSSDK.SecurityToken" Version="3.7.1.58" />
</ItemGroup>
</Project>

@ -16,7 +16,7 @@
<ItemGroup>
<ProjectReference Include="..\Volo.Abp.BlobStoring\Volo.Abp.BlobStoring.csproj" />
<PackageReference Include="Azure.Storage.Blobs" Version="12.8.0" />
<PackageReference Include="Azure.Storage.Blobs" Version="12.10.0" />
</ItemGroup>
</Project>

@ -16,7 +16,7 @@
<ItemGroup>
<ProjectReference Include="..\Volo.Abp.BlobStoring\Volo.Abp.BlobStoring.csproj" />
<PackageReference Include="Polly" Version="7.2.1" />
<PackageReference Include="Polly" Version="7.2.2" />
</ItemGroup>
</Project>

@ -14,13 +14,13 @@
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.FileSystemGlobbing" Version="$(MicrosoftPackageVersion)" />
<PackageReference Include="SharpZipLib" Version="1.3.1" />
<PackageReference Include="SharpZipLib" Version="1.3.3" />
<PackageReference Include="Microsoft.AspNetCore.Hosting.Abstractions" Version="2.2.0" />
<PackageReference Include="NuGet.Versioning" Version="5.9.0" />
<PackageReference Include="NuGet.Versioning" Version="5.11.0" />
<PackageReference Include="System.Text.Encoding.CodePages" Version="$(MicrosoftPackageVersion)" />
<PackageReference Include="System.Security.Permissions" Version="$(MicrosoftPackageVersion)" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.0.0-4.final" />
<PackageReference Include="Polly" Version="7.2.1" />
<PackageReference Include="Polly" Version="7.2.2" />
<PackageReference Include="Polly.Extensions.Http" Version="3.0.0" />
<PackageReference Include="LibGit2Sharp" Version="0.26.2" />
</ItemGroup>

@ -206,7 +206,7 @@ namespace Volo.Abp.Cli.ServiceProxying.CSharp
{
var methodBuilder = new StringBuilder();
var returnTypeName = GetRealTypeName(usingNamespaceList, action.ReturnValue.Type);
var returnTypeName = GetRealTypeName(action.ReturnValue.Type, usingNamespaceList);
if(!action.Name.EndsWith("Async"))
{
@ -225,7 +225,7 @@ namespace Volo.Abp.Cli.ServiceProxying.CSharp
foreach (var parameter in action.Parameters.GroupBy(x => x.Name).Select( x=> x.First()))
{
methodBuilder.Replace("<args>", $"{GetRealTypeName(usingNamespaceList, parameter.Type)} {parameter.Name}, <args>");
methodBuilder.Replace("<args>", $"{GetRealTypeName(parameter.Type, usingNamespaceList)} {parameter.Name}, <args>");
}
methodBuilder.Replace("<args>", string.Empty);
@ -249,7 +249,7 @@ namespace Volo.Abp.Cli.ServiceProxying.CSharp
foreach (var parameter in action.ParametersOnMethod)
{
methodBuilder.Replace("<args>", $"{GetRealTypeName(usingNamespaceList, parameter.Type)} {parameter.Name}, <args>");
methodBuilder.Replace("<args>", $"{GetRealTypeName(parameter.Type, usingNamespaceList)} {parameter.Name}, <args>");
}
methodBuilder.Replace("<args>", string.Empty);
@ -257,21 +257,27 @@ namespace Volo.Abp.Cli.ServiceProxying.CSharp
methodBuilder.AppendLine(" {");
var argsTemplate = "new ClientProxyRequestTypeValue" +
$"{Environment.NewLine} {{<args>" +
$"{Environment.NewLine} }}";
var args = action.ParametersOnMethod.Any() ? argsTemplate : string.Empty;
if (returnTypeName == "void")
{
methodBuilder.AppendLine($" await RequestAsync(nameof({action.Name}), <args>);");
methodBuilder.AppendLine($" await RequestAsync(nameof({action.Name}), {args});");
}
else
{
methodBuilder.AppendLine($" return await RequestAsync<{returnTypeName}>(nameof({action.Name}), <args>);");
methodBuilder.AppendLine($" return await RequestAsync<{returnTypeName}>(nameof({action.Name}), {args});");
}
foreach (var parameter in action.ParametersOnMethod)
{
methodBuilder.Replace("<args>", $"{parameter.Name}, <args>");
methodBuilder.Replace("<args>", $"{Environment.NewLine} {{ typeof({GetRealTypeName(parameter.Type)}), {parameter.Name} }},<args>");
}
methodBuilder.Replace("<args>", string.Empty);
methodBuilder.Replace(",<args>", string.Empty);
methodBuilder.Replace(", )", ")");
methodBuilder.AppendLine(" }");
}
@ -297,7 +303,7 @@ namespace Volo.Abp.Cli.ServiceProxying.CSharp
return typeFullName.Substring(0, typeFullName.LastIndexOf('.'));
}
private string GetRealTypeName(List<string> usingNamespaceList, string typeName)
private string GetRealTypeName(string typeName, List<string> usingNamespaceList = null)
{
var filter = new []{"<", ",", ">"};
var stringBuilder = new StringBuilder();
@ -305,7 +311,11 @@ namespace Volo.Abp.Cli.ServiceProxying.CSharp
if (typeNames.All(x => !filter.Any(x.Contains)))
{
AddUsingNamespace(usingNamespaceList, typeName);
if (usingNamespaceList != null)
{
AddUsingNamespace(usingNamespaceList, typeName);
}
return NormalizeTypeName(typeNames.Last());
}
@ -315,7 +325,11 @@ namespace Volo.Abp.Cli.ServiceProxying.CSharp
{
if (filter.Any(x => item.Contains(x)))
{
AddUsingNamespace(usingNamespaceList, $"{fullName}.{item}".TrimStart('.'));
if (usingNamespaceList != null)
{
AddUsingNamespace(usingNamespaceList, $"{fullName}.{item}".TrimStart('.'));
}
fullName = string.Empty;
if (item.Contains('<') || item.Contains(','))

@ -16,8 +16,8 @@
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
<PackageReference Include="NETStandard.Library" Version="2.0.3" />
<PackageReference Include="Serilog.Extensions.Logging" Version="3.0.1" />
<PackageReference Include="Serilog.Sinks.File" Version="4.1.0" />
<PackageReference Include="Serilog.Sinks.Console" Version="3.1.1" />
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
<PackageReference Include="Serilog.Sinks.Console" Version="4.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="$(MicrosoftPackageVersion)" />
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="$(MicrosoftPackageVersion)" />
</ItemGroup>

@ -26,9 +26,9 @@
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="$(MicrosoftPackageVersion)" />
<PackageReference Include="System.Text.Encodings.Web" Version="$(MicrosoftPackageVersion)" />
<PackageReference Include="System.Runtime.Loader" Version="4.3.0" />
<PackageReference Include="System.Linq.Dynamic.Core" Version="1.2.9" />
<PackageReference Include="System.Linq.Dynamic.Core" Version="1.2.12" />
<PackageReference Include="System.Linq.Queryable" Version="4.3.0" />
<PackageReference Include="JetBrains.Annotations" Version="2020.3.0" />
<PackageReference Include="JetBrains.Annotations" Version="2021.2.0" />
<PackageReference Include="Nito.AsyncEx.Coordination" Version="5.1.0" />
<PackageReference Include="Nito.AsyncEx.Context" Version="5.1.0" />
</ItemGroup>

@ -19,7 +19,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Dapper" Version="2.0.78" />
<PackageReference Include="Dapper" Version="2.0.90" />
</ItemGroup>
</Project>

@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Runtime.CompilerServices;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.DependencyInjection;
@ -54,16 +55,7 @@ namespace Volo.Abp.Domain.Repositories
)
where TEntity : class, IEntity, ISoftDelete
{
if (!(ProxyHelper.UnProxy(repository) is IUnitOfWorkManagerAccessor unitOfWorkManagerAccessor))
{
throw new AbpException($"The given repository (of type {repository.GetType().AssemblyQualifiedName}) should implement the {typeof(IUnitOfWorkManagerAccessor).AssemblyQualifiedName} interface in order to invoke the {nameof(HardDeleteAsync)} method!");
}
var uowManager = unitOfWorkManagerAccessor.UnitOfWorkManager;
if (uowManager == null)
{
throw new AbpException($"{nameof(unitOfWorkManagerAccessor.UnitOfWorkManager)} property of the given {nameof(repository)} object is null!");
}
var uowManager = repository.GetUnitOfWorkManager();
if (uowManager.Current == null)
{
@ -79,29 +71,27 @@ namespace Volo.Abp.Domain.Repositories
}
}
private static async Task HardDeleteWithUnitOfWorkAsync<TEntity>(
IRepository<TEntity> repository,
Expression<Func<TEntity, bool>> predicate,
bool autoSave,
CancellationToken cancellationToken, IUnitOfWork currentUow
public static async Task HardDeleteAsync<TEntity>(
this IBasicRepository<TEntity> repository,
IEnumerable<TEntity> entities,
bool autoSave = false,
CancellationToken cancellationToken = default
)
where TEntity : class, IEntity, ISoftDelete
{
var hardDeleteEntities = (HashSet<IEntity>) currentUow.Items.GetOrAdd(
UnitOfWorkItemNames.HardDeletedEntities,
() => new HashSet<IEntity>()
);
var uowManager = repository.GetUnitOfWorkManager();
List<TEntity> entities;
using (currentUow.ServiceProvider.GetRequiredService<IDataFilter<ISoftDelete>>().Disable())
if (uowManager.Current == null)
{
entities = await repository.AsyncExecuter.ToListAsync((await repository.GetQueryableAsync()).Where(predicate), cancellationToken);
using (var uow = uowManager.Begin())
{
await HardDeleteWithUnitOfWorkAsync(repository, entities, autoSave, cancellationToken, uowManager.Current);
await uow.CompleteAsync(cancellationToken);
}
}
foreach (var entity in entities)
else
{
hardDeleteEntities.Add(entity);
await repository.DeleteAsync(entity, autoSave, cancellationToken);
await HardDeleteWithUnitOfWorkAsync(repository, entities, autoSave, cancellationToken, uowManager.Current);
}
}
@ -113,16 +103,7 @@ namespace Volo.Abp.Domain.Repositories
)
where TEntity : class, IEntity, ISoftDelete
{
if (!(ProxyHelper.UnProxy(repository) is IUnitOfWorkManagerAccessor unitOfWorkManagerAccessor))
{
throw new AbpException($"The given repository (of type {repository.GetType().AssemblyQualifiedName}) should implement the {typeof(IUnitOfWorkManagerAccessor).AssemblyQualifiedName} interface in order to invoke the {nameof(HardDeleteAsync)} method!");
}
var uowManager = unitOfWorkManagerAccessor.UnitOfWorkManager;
if (uowManager == null)
{
throw new AbpException($"{nameof(unitOfWorkManagerAccessor.UnitOfWorkManager)} property of the given {nameof(repository)} object is null!");
}
var uowManager = repository.GetUnitOfWorkManager();
if (uowManager.Current == null)
{
@ -138,11 +119,66 @@ namespace Volo.Abp.Domain.Repositories
}
}
private static IUnitOfWorkManager GetUnitOfWorkManager<TEntity>(
this IBasicRepository<TEntity> repository,
[CallerMemberName] string callingMethodName = nameof(GetUnitOfWorkManager)
)
where TEntity : class, IEntity
{
if (ProxyHelper.UnProxy(repository) is not IUnitOfWorkManagerAccessor unitOfWorkManagerAccessor)
{
throw new AbpException($"The given repository (of type {repository.GetType().AssemblyQualifiedName}) should implement the " +
$"{typeof(IUnitOfWorkManagerAccessor).AssemblyQualifiedName} interface in order to invoke the {callingMethodName} method!");
}
if (unitOfWorkManagerAccessor.UnitOfWorkManager == null)
{
throw new AbpException($"{nameof(unitOfWorkManagerAccessor.UnitOfWorkManager)} property of the given {nameof(repository)} object is null!");
}
return unitOfWorkManagerAccessor.UnitOfWorkManager;
}
private static async Task HardDeleteWithUnitOfWorkAsync<TEntity>(
IRepository<TEntity> repository,
Expression<Func<TEntity, bool>> predicate,
bool autoSave,
CancellationToken cancellationToken,
IUnitOfWork currentUow
)
where TEntity : class, IEntity, ISoftDelete
{
using (currentUow.ServiceProvider.GetRequiredService<IDataFilter<ISoftDelete>>().Disable())
{
var entities = await repository.AsyncExecuter.ToListAsync((await repository.GetQueryableAsync()).Where(predicate), cancellationToken);
await HardDeleteWithUnitOfWorkAsync(repository, entities, autoSave, cancellationToken, currentUow);
}
}
private static async Task HardDeleteWithUnitOfWorkAsync<TEntity>(
IBasicRepository<TEntity> repository,
IEnumerable<TEntity> entities,
bool autoSave,
CancellationToken cancellationToken,
IUnitOfWork currentUow
)
where TEntity : class, IEntity, ISoftDelete
{
var hardDeleteEntities = (HashSet<IEntity>)currentUow.Items.GetOrAdd(
UnitOfWorkItemNames.HardDeletedEntities,
() => new HashSet<IEntity>()
);
hardDeleteEntities.UnionWith(entities);
await repository.DeleteManyAsync(entities, autoSave, cancellationToken);
}
private static async Task HardDeleteWithUnitOfWorkAsync<TEntity>(
IBasicRepository<TEntity> repository,
TEntity entity,
bool autoSave,
CancellationToken cancellationToken, IUnitOfWork currentUow
CancellationToken cancellationToken,
IUnitOfWork currentUow
)
where TEntity : class, IEntity, ISoftDelete
{

@ -19,7 +19,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="5.0.0" />
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="6.0.0-preview.5" />
</ItemGroup>
</Project>

@ -19,7 +19,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Devart.Data.Oracle.EFCore" Version="9.14.1234" />
<PackageReference Include="Devart.Data.Oracle.EFCore" Version="9.14.1353" />
</ItemGroup>
</Project>

@ -18,8 +18,8 @@
<ProjectReference Include="..\Volo.Abp.EntityFrameworkCore\Volo.Abp.EntityFrameworkCore.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Oracle.EntityFrameworkCore" Version="5.21.1" />
<ItemGroup>
<PackageReference Include="Oracle.EntityFrameworkCore" Version="5.21.3" />
</ItemGroup>
</Project>

@ -19,7 +19,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="5.0.2" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="6.0.0-preview7" />
</ItemGroup>
</Project>

@ -15,7 +15,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="FluentValidation" Version="9.5.3" />
<PackageReference Include="FluentValidation" Version="10.3.3" />
</ItemGroup>
<ItemGroup>

@ -0,0 +1,3 @@
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
<ConfigureAwait ContinueOnCapturedContext="false" />
</Weavers>

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<!-- This file was generated by Fody. Manual changes to this file will be lost when your project is rebuilt. -->
<xs:element name="Weavers">
<xs:complexType>
<xs:all>
<xs:element name="ConfigureAwait" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:attribute name="ContinueOnCapturedContext" type="xs:boolean" />
</xs:complexType>
</xs:element>
</xs:all>
<xs:attribute name="VerifyAssembly" type="xs:boolean">
<xs:annotation>
<xs:documentation>'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="VerifyIgnoreCodes" type="xs:string">
<xs:annotation>
<xs:documentation>A comma-separated list of error codes that can be safely ignored in assembly verification.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="GenerateXsd" type="xs:boolean">
<xs:annotation>
<xs:documentation>'false' to turn off automatic generation of the XML Schema file.</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
</xs:element>
</xs:schema>

@ -0,0 +1,25 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<Import Project="..\..\..\configureawait.props" />
<Import Project="..\..\..\common.props" />
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<AssemblyName>Volo.Abp.Http.Client.Web</AssemblyName>
<PackageId>Volo.Abp.Http.Client.Web</PackageId>
<AssetTargetFallback>$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;</AssetTargetFallback>
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
<IsPackable>true</IsPackable>
<OutputType>Library</OutputType>
<NoDefaultLaunchSettingsFile>true</NoDefaultLaunchSettingsFile>
<RootNamespace />
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Volo.Abp.AspNetCore.Mvc\Volo.Abp.AspNetCore.Mvc.csproj" />
<ProjectReference Include="..\Volo.Abp.Http.Client\Volo.Abp.Http.Client.csproj" />
</ItemGroup>
</Project>

@ -0,0 +1,42 @@
using System.Linq;
using Microsoft.AspNetCore.Mvc.ApplicationParts;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
using Volo.Abp.AspNetCore.Mvc;
using Volo.Abp.AspNetCore.Mvc.Conventions;
using Volo.Abp.Http.Client.Web.Conventions;
using Volo.Abp.Modularity;
namespace Volo.Abp.Http.Client.Web
{
[DependsOn(
typeof(AbpAspNetCoreMvcModule),
typeof(AbpHttpClientModule)
)]
public class AbpHttpClientWebModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
context.Services.Replace(ServiceDescriptor.Transient<IAbpServiceConvention, AbpHttpClientProxyServiceConvention>());
context.Services.AddTransient<AbpHttpClientProxyServiceConvention>();
var partManager = context.Services.GetSingletonInstance<ApplicationPartManager>();
partManager.FeatureProviders.Add(new AbpHttpClientProxyControllerFeatureProvider());
}
public override void OnApplicationInitialization(ApplicationInitializationContext context)
{
var partManager = context.ServiceProvider.GetRequiredService<ApplicationPartManager>();
foreach (var moduleAssembly in context
.ServiceProvider
.GetRequiredService<IModuleContainer>()
.Modules
.Select(m => m.Type.Assembly)
.Where(a => a.GetTypes().Any(AbpHttpClientProxyHelper.IsClientProxyService))
.Distinct())
{
partManager.ApplicationParts.AddIfNotContains(moduleAssembly);
}
}
}
}

@ -0,0 +1,13 @@
using System.Reflection;
using Microsoft.AspNetCore.Mvc.Controllers;
namespace Volo.Abp.Http.Client.Web.Conventions
{
public class AbpHttpClientProxyControllerFeatureProvider : ControllerFeatureProvider
{
protected override bool IsController(TypeInfo typeInfo)
{
return AbpHttpClientProxyHelper.IsClientProxyService(typeInfo);
}
}
}

@ -3,9 +3,9 @@ using System.Linq;
using Volo.Abp.Application.Services;
using Volo.Abp.Http.Client.ClientProxying;
namespace Volo.Abp.Swashbuckle.Conventions
namespace Volo.Abp.Http.Client.Web.Conventions
{
public static class AbpSwaggerClientProxyHelper
public static class AbpHttpClientProxyHelper
{
public static bool IsClientProxyService(Type type)
{

@ -14,15 +14,15 @@ using Volo.Abp.Http.Client.ClientProxying;
using Volo.Abp.Http.Modeling;
using Volo.Abp.Reflection;
namespace Volo.Abp.Swashbuckle.Conventions
namespace Volo.Abp.Http.Client.Web.Conventions
{
[DisableConventionalRegistration]
public class AbpSwaggerServiceConvention : AbpServiceConvention
public class AbpHttpClientProxyServiceConvention : AbpServiceConvention
{
protected readonly IClientProxyApiDescriptionFinder ClientProxyApiDescriptionFinder;
protected readonly List<ActionModel> ActionWithAttributeRoute;
public AbpSwaggerServiceConvention(
public AbpHttpClientProxyServiceConvention(
IOptions<AbpAspNetCoreMvcOptions> options,
IConventionalRouteBuilder conventionalRouteBuilder,
IClientProxyApiDescriptionFinder clientProxyApiDescriptionFinder)
@ -34,12 +34,12 @@ namespace Volo.Abp.Swashbuckle.Conventions
protected override IList<ControllerModel> GetControllers(ApplicationModel application)
{
return application.Controllers.Where(c => !AbpSwaggerClientProxyHelper.IsClientProxyService(c.ControllerType)).ToList();
return application.Controllers.Where(c => !AbpHttpClientProxyHelper.IsClientProxyService(c.ControllerType)).ToList();
}
protected virtual IList<ControllerModel> GetClientProxyControllers(ApplicationModel application)
{
return application.Controllers.Where(c => AbpSwaggerClientProxyHelper.IsClientProxyService(c.ControllerType)).ToList();
return application.Controllers.Where(c => AbpHttpClientProxyHelper.IsClientProxyService(c.ControllerType)).ToList();
}
protected override void ApplyForControllers(ApplicationModel application)

@ -9,7 +9,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Confluent.Kafka" Version="1.6.3" />
<PackageReference Include="Confluent.Kafka" Version="1.8.0" />
<ProjectReference Include="..\Volo.Abp.Json\Volo.Abp.Json.csproj" />
<ProjectReference Include="..\Volo.Abp.Threading\Volo.Abp.Threading.csproj" />
</ItemGroup>

@ -15,7 +15,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="LdapForNet" Version="2.7.11" />
<PackageReference Include="LdapForNet" Version="2.7.13" />
</ItemGroup>
<ItemGroup>

@ -15,7 +15,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="MailKit" Version="2.11.1" />
<PackageReference Include="MailKit" Version="2.15.0" />
</ItemGroup>
<ItemGroup>

@ -19,7 +19,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="NUglify" Version="1.13.8" />
<PackageReference Include="NUglify" Version="1.16.0" />
</ItemGroup>
</Project>

@ -15,7 +15,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="MongoDB.Driver" Version="2.12.1" />
<PackageReference Include="MongoDB.Driver" Version="2.13.1" />
</ItemGroup>
<ItemGroup>

@ -15,9 +15,9 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Quartz" Version="3.2.4" />
<PackageReference Include="Quartz.Extensions.DependencyInjection" Version="3.2.4" />
<PackageReference Include="Quartz.Plugins.TimeZoneConverter" Version="3.2.4" />
<PackageReference Include="Quartz" Version="3.3.3" />
<PackageReference Include="Quartz.Extensions.DependencyInjection" Version="3.3.3" />
<PackageReference Include="Quartz.Plugins.TimeZoneConverter" Version="3.3.3" />
</ItemGroup>
<ItemGroup>

@ -15,7 +15,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="RabbitMQ.Client" Version="6.2.1" />
<PackageReference Include="RabbitMQ.Client" Version="6.2.2" />
<ProjectReference Include="..\Volo.Abp.Json\Volo.Abp.Json.csproj" />
<ProjectReference Include="..\Volo.Abp.Threading\Volo.Abp.Threading.csproj" />
</ItemGroup>

@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\..\configureawait.props"/>
<Import Project="..\..\..\common.props"/>
<Import Project="..\..\..\configureawait.props" />
<Import Project="..\..\..\common.props" />
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
@ -10,16 +10,15 @@
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
<RootNamespace/>
<RootNamespace />
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Volo.Abp.Sms\Volo.Abp.Sms.csproj"/>
<ProjectReference Include="..\Volo.Abp.Sms\Volo.Abp.Sms.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="AlibabaCloud.OpenApiUtil" Version="1.0.10" />
<PackageReference Include="AlibabaCloud.SDK.Dysmsapi20170525" Version="1.0.2"/>
<PackageReference Include="AlibabaCloud.SDK.Dysmsapi20170525" Version="1.0.3" />
</ItemGroup>
</Project>

@ -15,12 +15,11 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.1.3" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.2.1" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Volo.Abp.AspNetCore.Mvc\Volo.Abp.AspNetCore.Mvc.csproj" />
<ProjectReference Include="..\Volo.Abp.Http.Client\Volo.Abp.Http.Client.csproj" />
<ProjectReference Include="..\Volo.Abp.VirtualFileSystem\Volo.Abp.VirtualFileSystem.csproj" />
</ItemGroup>

@ -1,21 +1,12 @@
using System.Linq;
using Microsoft.AspNetCore.Mvc.ApplicationParts;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
using Microsoft.Extensions.Options;
using Volo.Abp.AspNetCore.Mvc;
using Volo.Abp.AspNetCore.Mvc.Conventions;
using Volo.Abp.Http.Client;
using Volo.Abp.AspNetCore.Mvc;
using Volo.Abp.Modularity;
using Volo.Abp.Swashbuckle.Conventions;
using Volo.Abp.VirtualFileSystem;
namespace Volo.Abp.Swashbuckle
{
[DependsOn(
typeof(AbpVirtualFileSystemModule),
typeof(AbpAspNetCoreMvcModule),
typeof(AbpHttpClientModule))]
typeof(AbpAspNetCoreMvcModule))]
public class AbpSwashbuckleModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
@ -24,35 +15,6 @@ namespace Volo.Abp.Swashbuckle
{
options.FileSets.AddEmbedded<AbpSwashbuckleModule>();
});
var swaggerConventionOptions = context.Services.ExecutePreConfiguredActions<AbpSwaggerClientProxyOptions>();
if (swaggerConventionOptions.IsEnabled)
{
context.Services.Replace(ServiceDescriptor.Transient<IAbpServiceConvention, AbpSwaggerServiceConvention>());
context.Services.AddTransient<AbpSwaggerServiceConvention>();
var partManager = context.Services.GetSingletonInstance<ApplicationPartManager>();
partManager.FeatureProviders.Add(new AbpSwaggerClientProxyControllerFeatureProvider());
}
}
public override void OnApplicationInitialization(ApplicationInitializationContext context)
{
var swaggerConventionOptions = context.ServiceProvider.GetRequiredService<IOptions<AbpSwaggerClientProxyOptions>>().Value;
if (swaggerConventionOptions.IsEnabled)
{
var partManager = context.ServiceProvider.GetRequiredService<ApplicationPartManager>();
foreach (var moduleAssembly in context
.ServiceProvider
.GetRequiredService<IModuleContainer>()
.Modules
.Select(m => m.Type.Assembly)
.Where(a => a.GetTypes().Any(AbpSwaggerClientProxyHelper.IsClientProxyService))
.Distinct())
{
partManager.ApplicationParts.AddIfNotContains(moduleAssembly);
}
}
}
}
}

@ -1,13 +0,0 @@
using System.Reflection;
using Microsoft.AspNetCore.Mvc.Controllers;
namespace Volo.Abp.Swashbuckle.Conventions
{
public class AbpSwaggerClientProxyControllerFeatureProvider : ControllerFeatureProvider
{
protected override bool IsController(TypeInfo typeInfo)
{
return AbpSwaggerClientProxyHelper.IsClientProxyService(typeInfo);
}
}
}

@ -1,12 +0,0 @@
namespace Volo.Abp.Swashbuckle.Conventions
{
public class AbpSwaggerClientProxyOptions
{
public bool IsEnabled { get; set; }
public AbpSwaggerClientProxyOptions()
{
IsEnabled = true;
}
}
}

@ -13,7 +13,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Scriban" Version="3.6.0" />
<PackageReference Include="Scriban" Version="4.0.2" />
</ItemGroup>
</Project>

@ -25,7 +25,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="TimeZoneConverter" Version="3.4.0" />
<PackageReference Include="TimeZoneConverter" Version="3.5.0" />
</ItemGroup>
</Project>

@ -11,6 +11,7 @@ using Volo.Abp.AspNetCore.Mvc.Localization;
using Volo.Abp.AspNetCore.Mvc.Localization.Resource;
using Volo.Abp.AspNetCore.Security.Claims;
using Volo.Abp.AspNetCore.TestBase;
using Volo.Abp.Authorization;
using Volo.Abp.Autofac;
using Volo.Abp.GlobalFeatures;
using Volo.Abp.Localization;
@ -65,6 +66,16 @@ namespace Volo.Abp.AspNetCore.Mvc
{
policy.RequireClaim("MyCustomClaimType", "42");
});
options.AddPolicy("TestPermission1_And_TestPermission2", policy =>
{
policy.Requirements.Add(new PermissionsRequirement(new []{"TestPermission1", "TestPermission2"}, requiresAll: true));
});
options.AddPolicy("TestPermission1_Or_TestPermission2", policy =>
{
policy.Requirements.Add(new PermissionsRequirement(new []{"TestPermission1", "TestPermission2"}, requiresAll: false));
});
});
Configure<AbpAspNetCoreMvcOptions>(options =>

@ -38,5 +38,19 @@ namespace Volo.Abp.AspNetCore.Mvc.Authorization
CurrentUser.Id.ShouldBe(FakeUserId);
return Content("OK");
}
[Authorize("TestPermission1_And_TestPermission2")]
public ActionResult Custom_And_PolicyTest()
{
CurrentUser.Id.ShouldBe(FakeUserId);
return Content("OK");
}
[Authorize("TestPermission1_Or_TestPermission2")]
public ActionResult Custom_Or_PolicyTest()
{
CurrentUser.Id.ShouldBe(FakeUserId);
return Content("OK");
}
}
}

@ -1,5 +1,4 @@
using System;
using System.Net;
using System.Net;
using System.Security.Claims;
using System.Threading.Tasks;
using Shouldly;
@ -72,5 +71,29 @@ namespace Volo.Abp.AspNetCore.Mvc.Authorization
var result = await GetResponseAsStringAsync("/AuthTest/PermissionTest");
result.ShouldBe("OK");
}
[Fact]
public async Task Custom_And_Policy_Should_Not_Work_When_Permissions_Not_Granted()
{
_fakeRequiredService.Claims.AddRange(new[]
{
new Claim(AbpClaimTypes.UserId, AuthTestController.FakeUserId.ToString())
});
var response = await GetResponseAsync("/AuthTest/Custom_And_PolicyTest", HttpStatusCode.Forbidden, xmlHttpRequest: true);
response.StatusCode.ShouldBe(HttpStatusCode.Forbidden);
}
[Fact]
public async Task Custom_Or_Policy_Should_Work_When_Permissions_Are_Granted()
{
_fakeRequiredService.Claims.AddRange(new[]
{
new Claim(AbpClaimTypes.UserId, AuthTestController.FakeUserId.ToString())
});
var result = await GetResponseAsStringAsync("/AuthTest/Custom_Or_PolicyTest");
result.ShouldBe("OK");
}
}
}

@ -9,6 +9,7 @@ namespace Volo.Abp.AspNetCore.Mvc.Authorization
var testGroup = context.AddGroup("TestGroup");
testGroup.AddPermission("TestPermission1");
testGroup.AddPermission("TestPermission2");
}
}
}

@ -3,6 +3,7 @@ using System.Net;
using System.Net.Http;
using System.Text.Json;
using System.Threading.Tasks;
using Microsoft.Net.Http.Headers;
using Shouldly;
using Volo.Abp.AspNetCore.TestBase;
@ -30,11 +31,15 @@ namespace Volo.Abp.AspNetCore
}
}
protected virtual async Task<HttpResponseMessage> GetResponseAsync(string url, HttpStatusCode expectedStatusCode = HttpStatusCode.OK)
protected virtual async Task<HttpResponseMessage> GetResponseAsync(string url, HttpStatusCode expectedStatusCode = HttpStatusCode.OK, bool xmlHttpRequest = false)
{
using (var requestMessage = new HttpRequestMessage(HttpMethod.Get, url))
{
requestMessage.Headers.Add("Accept-Language", CultureInfo.CurrentUICulture.Name);
if (xmlHttpRequest)
{
requestMessage.Headers.Add(HeaderNames.XRequestedWith, "XMLHttpRequest");
}
var response = await Client.SendAsync(requestMessage);
response.StatusCode.ShouldBe(expectedStatusCode);
return response;

@ -54,6 +54,19 @@ namespace Volo.Abp.TestApp.Testing
}
}
[Fact]
public async Task Should_HardDelete_Entities_With_IEnumerable()
{
using (DataFilter.Disable<ISoftDelete>())
{
var persons = await PersonRepository.GetListAsync();
await PersonRepository.HardDeleteAsync(persons);
var personCount = await PersonRepository.GetCountAsync();
personCount.ShouldBe(0);
}
}
[Fact]
public async Task Should_HardDelete_Soft_Deleted_Entities()
{

@ -6,7 +6,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Quartz.Serialization.Json" Version="3.2.3" />
<PackageReference Include="Quartz.Serialization.Json" Version="3.3.3" />
</ItemGroup>
<ItemGroup>

@ -21,7 +21,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.9.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.11.0" />
<PackageReference Include="NSubstitute" Version="4.2.2" />
<PackageReference Include="Shouldly" Version="4.0.3" />
<PackageReference Include="xunit" Version="2.4.1" />

@ -10,7 +10,7 @@
<ItemGroup>
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="$(MicrosoftPackageVersion)" />
<PackageReference Include="Serilog.AspNetCore" Version="4.1.0" />
<PackageReference Include="Serilog.Sinks.File" Version="4.1.0" />
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
</ItemGroup>
<ItemGroup>

@ -18,7 +18,7 @@
<ItemGroup>
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="$(MicrosoftPackageVersion)" />
<PackageReference Include="Serilog.AspNetCore" Version="4.1.0" />
<PackageReference Include="Serilog.Sinks.Async" Version="1.4.0" />
<PackageReference Include="Serilog.Sinks.Async" Version="1.5.0" />
</ItemGroup>
<ItemGroup>

@ -22,9 +22,9 @@
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Hosting" Version="$(MicrosoftPackageVersion)" />
<PackageReference Include="Serilog.Extensions.Logging" Version="3.0.1" />
<PackageReference Include="Serilog.Sinks.Async" Version="1.4.0" />
<PackageReference Include="Serilog.Sinks.Console" Version="3.1.1" />
<PackageReference Include="Serilog.Sinks.File" Version="4.1.0" />
<PackageReference Include="Serilog.Sinks.Async" Version="1.5.0" />
<PackageReference Include="Serilog.Sinks.Console" Version="4.0.0" />
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="$(MicrosoftPackageVersion)" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="$(MicrosoftPackageVersion)" />
</ItemGroup>

@ -20,7 +20,7 @@
<ProjectReference Include="..\..\..\..\framework\src\Volo.Abp.AspNetCore.Mvc.UI.Bundling\Volo.Abp.AspNetCore.Mvc.UI.Bundling.csproj" />
<ProjectReference Include="..\..\..\..\framework\src\Volo.Abp.AutoMapper\Volo.Abp.AutoMapper.csproj" />
<ProjectReference Include="..\Volo.Blogging.Admin.Application.Contracts\Volo.Blogging.Admin.Application.Contracts.csproj" />
<PackageReference Include="Markdig.Signed" Version="0.20.0" />
<PackageReference Include="Markdig.Signed" Version="0.26.0" />
</ItemGroup>
<ItemGroup>

@ -20,7 +20,7 @@
<ProjectReference Include="..\..\..\..\framework\src\Volo.Abp.AspNetCore.Mvc.UI.Bundling\Volo.Abp.AspNetCore.Mvc.UI.Bundling.csproj" />
<ProjectReference Include="..\..\..\..\framework\src\Volo.Abp.AutoMapper\Volo.Abp.AutoMapper.csproj" />
<ProjectReference Include="..\Volo.Blogging.Application.Contracts\Volo.Blogging.Application.Contracts.csproj" />
<PackageReference Include="Markdig.Signed" Version="0.20.0" />
<PackageReference Include="Markdig.Signed" Version="0.26.0" />
</ItemGroup>
<ItemGroup>

@ -9,8 +9,8 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Serilog.AspNetCore" Version="3.4.0" />
<PackageReference Include="Serilog.Sinks.File" Version="4.1.0" />
<PackageReference Include="Serilog.AspNetCore" Version="4.1.0" />
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
</ItemGroup>
<ItemGroup>

@ -8,10 +8,10 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Serilog.AspNetCore" Version="3.4.0" />
<PackageReference Include="Serilog.Sinks.File" Version="4.1.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="5.6.3" />
<PackageReference Include="IdentityModel" Version="4.3.1" />
<PackageReference Include="Serilog.AspNetCore" Version="4.1.0" />
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.2.1" />
<PackageReference Include="IdentityModel" Version="5.1.0" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="$(MicrosoftPackageVersion)" />
<PackageReference Include="Microsoft.AspNetCore.DataProtection.StackExchangeRedis" Version="$(MicrosoftPackageVersion)" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="$(MicrosoftPackageVersion)" />

@ -8,9 +8,9 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Serilog.AspNetCore" Version="3.4.0" />
<PackageReference Include="Serilog.Sinks.File" Version="4.1.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="5.6.3" />
<PackageReference Include="Serilog.AspNetCore" Version="4.1.0" />
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.2.1" />
<PackageReference Include="Microsoft.AspNetCore.DataProtection.StackExchangeRedis" Version="$(MicrosoftPackageVersion)" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="$(MicrosoftPackageVersion)" />
<ProjectReference Include="..\..\..\..\framework\src\Volo.Abp.AspNetCore.Authentication.JwtBearer\Volo.Abp.AspNetCore.Authentication.JwtBearer.csproj" />

@ -8,9 +8,9 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Serilog.AspNetCore" Version="3.4.0" />
<PackageReference Include="Serilog.Sinks.File" Version="4.1.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="5.6.3" />
<PackageReference Include="Serilog.AspNetCore" Version="4.1.0" />
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.2.1" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.OpenIdConnect" Version="$(MicrosoftPackageVersion)" />
<PackageReference Include="Microsoft.AspNetCore.DataProtection.StackExchangeRedis" Version="$(MicrosoftPackageVersion)" />
<ProjectReference Include="..\..\..\..\framework\src\Volo.Abp.AspNetCore.Serilog\Volo.Abp.AspNetCore.Serilog.csproj" />

@ -8,8 +8,8 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Serilog.AspNetCore" Version="3.4.0" />
<PackageReference Include="Serilog.Sinks.File" Version="4.1.0" />
<PackageReference Include="Serilog.AspNetCore" Version="4.1.0" />
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="$(MicrosoftPackageVersion)" />
<ProjectReference Include="..\..\..\..\framework\src\Volo.Abp.Autofac\Volo.Abp.Autofac.csproj" />
<ProjectReference Include="..\..\..\..\modules\basic-theme\src\Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic\Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.csproj" />

@ -16,7 +16,7 @@
<ProjectReference Include="..\Volo.CmsKit.Common.Web\Volo.CmsKit.Common.Web.csproj" />
<ProjectReference Include="..\Volo.CmsKit.Public.Application.Contracts\Volo.CmsKit.Public.Application.Contracts.csproj" />
<PackageReference Include="Microsoft.Extensions.FileProviders.Embedded" Version="$(MicrosoftPackageVersion)" />
<PackageReference Include="Markdig.Signed" Version="0.24.0" />
<PackageReference Include="Markdig.Signed" Version="0.26.0" />
</ItemGroup>
<ItemGroup>

@ -17,9 +17,9 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Serilog.AspNetCore" Version="3.4.0" />
<PackageReference Include="Serilog.Sinks.File" Version="4.1.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="5.6.3" />
<PackageReference Include="Serilog.AspNetCore" Version="4.1.0" />
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.2.1" />
</ItemGroup>
<ItemGroup>

@ -11,7 +11,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="NuGet.Versioning" Version="5.6.0" />
<PackageReference Include="NuGet.Versioning" Version="5.11.0" />
</ItemGroup>
<ItemGroup>

@ -18,8 +18,8 @@
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Http" Version="$(MicrosoftPackageVersion)" />
<PackageReference Include="Octokit" Version="0.48.0" />
<PackageReference Include="NEST" Version="7.7.1" />
<PackageReference Include="Octokit" Version="0.50.0" />
<PackageReference Include="NEST" Version="7.14.1" />
<PackageReference Include="Microsoft.Extensions.FileProviders.Embedded" Version="$(MicrosoftPackageVersion)" />
</ItemGroup>

@ -21,8 +21,8 @@
<ProjectReference Include="..\..\..\..\framework\src\Volo.Abp.AspNetCore.Mvc.UI.Packages\Volo.Abp.AspNetCore.Mvc.UI.Packages.csproj" />
<ProjectReference Include="..\..\..\..\framework\src\Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared\Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.csproj" />
<ProjectReference Include="..\Volo.Docs.Application.Contracts\Volo.Docs.Application.Contracts.csproj" />
<PackageReference Include="Markdig.Signed" Version="0.20.0" />
<PackageReference Include="Scriban" Version="3.0.5" />
<PackageReference Include="Markdig.Signed" Version="0.26.0" />
<PackageReference Include="Scriban" Version="4.0.1" />
<PackageReference Include="Microsoft.Extensions.FileProviders.Embedded" Version="$(MicrosoftPackageVersion)" />
</ItemGroup>

@ -25,7 +25,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="IdentityServer4" Version="4.1.1" />
<PackageReference Include="IdentityServer4" Version="4.1.2" />
<PackageReference Include="IdentityServer4.AspNetIdentity" Version="4.1.1" />
</ItemGroup>

@ -36,11 +36,10 @@ namespace Volo.Abp.IdentityServer.ApiResources
}
public ApiResource(Guid id, [NotNull] string name, string displayName = null, string description = null)
: base(id)
{
Check.NotNull(name, nameof(name));
Id = id;
Name = name;
DisplayName = displayName;
@ -124,7 +123,15 @@ namespace Volo.Abp.IdentityServer.ApiResources
public virtual void AddProperty([NotNull] string key, string value)
{
Properties.Add(new ApiResourceProperty(Id, key, value));
var property = FindProperty(key);
if (property == null)
{
Properties.Add(new ApiResourceProperty(Id, key, value));
}
else
{
property.Value = value;
}
}
public virtual void RemoveAllProperties()

@ -40,11 +40,11 @@ namespace Volo.Abp.IdentityServer.ApiScopes
bool required = false,
bool emphasize = false,
bool showInDiscoveryDocument = true,
bool enabled = true)
bool enabled = true
) : base(id)
{
Check.NotNull(name, nameof(name));
Id = id;
Name = name;
DisplayName = displayName ?? name;
Description = description;
@ -79,7 +79,15 @@ namespace Volo.Abp.IdentityServer.ApiScopes
public virtual void AddProperty([NotNull] string key, string value)
{
Properties.Add(new ApiScopeProperty(Id, key, value));
var property = FindProperty(key);
if (property == null)
{
Properties.Add(new ApiScopeProperty(Id, key, value));
}
else
{
property.Value = value;
}
}
public virtual void RemoveAllProperties()

@ -266,7 +266,15 @@ namespace Volo.Abp.IdentityServer.Clients
public virtual void AddProperty([NotNull] string key, [NotNull] string value)
{
Properties.Add(new ClientProperty(Id, key,value));
var property = FindProperty(key);
if (property == null)
{
Properties.Add(new ClientProperty(Id, key, value));
}
else
{
property.Value = value;
}
}
public virtual void RemoveAllProperties()
@ -274,17 +282,17 @@ namespace Volo.Abp.IdentityServer.Clients
Properties.Clear();
}
public virtual void RemoveProperty(string key, string value)
public virtual void RemoveProperty(string key)
{
Properties.RemoveAll(c => c.Value == value && c.Key == key);
Properties.RemoveAll(c => c.Key == key);
}
public virtual ClientProperty FindProperty(string key, string value)
public virtual ClientProperty FindProperty(string key)
{
return Properties.FirstOrDefault(c => c.Key == key && c.Value == value);
return Properties.FirstOrDefault(c => c.Key == key);
}
public virtual void AddClaim([NotNull] string value, string type)
public virtual void AddClaim([NotNull] string type, [NotNull] string value)
{
Claims.Add(new ClientClaim(Id, type, value));
}
@ -294,12 +302,22 @@ namespace Volo.Abp.IdentityServer.Clients
Claims.Clear();
}
public virtual void RemoveClaim(string value, string type)
public virtual void RemoveClaim(string type)
{
Claims.RemoveAll(c => c.Value == value && c.Type == type);
Claims.RemoveAll(c => c.Type == type);
}
public virtual ClientClaim FindClaim(string value, string type)
public virtual void RemoveClaim(string type, string value)
{
Claims.RemoveAll(c => c.Type == type && c.Value == value);
}
public virtual List<ClientClaim> FindClaims(string type)
{
return Claims.Where(c => c.Type == type).ToList();
}
public virtual ClientClaim FindClaim(string type, string value)
{
return Claims.FirstOrDefault(c => c.Type == type && c.Value == value);
}

@ -1,4 +1,4 @@
using System;
using System;
using JetBrains.Annotations;
using Volo.Abp.Domain.Entities;
@ -17,11 +17,6 @@ namespace Volo.Abp.IdentityServer.Clients
}
public virtual bool Equals(Guid clientId, string value, string type)
{
return ClientId == clientId && Type == type && Value == value;
}
protected internal ClientClaim(Guid clientId, [NotNull] string type, string value)
{
Check.NotNull(type, nameof(type));
@ -31,9 +26,14 @@ namespace Volo.Abp.IdentityServer.Clients
Value = value;
}
public virtual bool Equals(Guid clientId, string type, string value)
{
return ClientId == clientId && Type == type && Value == value;
}
public override object[] GetKeys()
{
return new object[] { ClientId, Type, Value };
}
}
}
}

@ -1,4 +1,4 @@
using System;
using System;
using System.Threading.Tasks;
using IdentityModel;
using IdentityServer4.Models;
@ -38,7 +38,7 @@ namespace Volo.Abp.IdentityServer.Devices
DeviceCode = deviceCode,
UserCode = userCode,
ClientId = data.ClientId,
SubjectId = data.Subject?.FindFirst(JwtClaimTypes.Subject).Value,
SubjectId = data.Subject?.FindFirst(JwtClaimTypes.Subject)?.Value,
CreationTime = data.CreationTime,
Expiration = data.CreationTime.AddSeconds(data.Lifetime),
Data = Serialize(data)
@ -93,7 +93,7 @@ namespace Volo.Abp.IdentityServer.Devices
throw new InvalidOperationException($"Could not update device code by the given userCode: {userCode}");
}
deviceCodes.SubjectId = data.Subject?.FindFirst(JwtClaimTypes.Subject).Value;
deviceCodes.SubjectId = data.Subject?.FindFirst(JwtClaimTypes.Subject)?.Value;
deviceCodes.Data = Serialize(data);
await DeviceFlowCodesRepository

@ -27,12 +27,11 @@ namespace Volo.Abp.IdentityServer.Grants
protected PersistedGrant()
{
}
public PersistedGrant(Guid id)
: base(id)
{
Id = id;
}
}
}

@ -39,11 +39,11 @@ namespace Volo.Abp.IdentityServer.IdentityResources
bool enabled = true,
bool required = false,
bool emphasize = false,
bool showInDiscoveryDocument = true)
bool showInDiscoveryDocument = true
) : base(id)
{
Check.NotNull(name, nameof(name));
Id = id;
Name = name;
DisplayName = displayName;
Description = description;
@ -57,8 +57,8 @@ namespace Volo.Abp.IdentityServer.IdentityResources
}
public IdentityResource(Guid id, IdentityServer4.Models.IdentityResource resource)
: base(id)
{
Id = id;
Name = resource.Name;
DisplayName = resource.DisplayName;
Description = resource.Description;
@ -92,7 +92,15 @@ namespace Volo.Abp.IdentityServer.IdentityResources
public virtual void AddProperty([NotNull] string key, string value)
{
Properties.Add(new IdentityResourceProperty(Id, key, value));
var property = FindProperty(key);
if (property == null)
{
Properties.Add(new IdentityResourceProperty(Id, key, value));
}
else
{
property.Value = value;
}
}
public virtual void RemoveAllProperties()

@ -20,23 +20,20 @@ namespace Volo.Abp.IdentityServer.ApiResources
public async Task<ApiResource> FindByNameAsync(string apiResourceName, bool includeDetails = true, CancellationToken cancellationToken = default)
{
var query = from apiResource in (await GetDbSetAsync()).IncludeDetails(includeDetails)
where apiResource.Name == apiResourceName
orderby apiResource.Id
select apiResource;
return await query.FirstOrDefaultAsync(GetCancellationToken(cancellationToken));
return await (await GetDbSetAsync())
.IncludeDetails(includeDetails)
.OrderBy(apiResource => apiResource.Id)
.FirstOrDefaultAsync(apiResource => apiResource.Name == apiResourceName, GetCancellationToken(cancellationToken));
}
public async Task<List<ApiResource>> FindByNameAsync(string[] apiResourceNames, bool includeDetails = true,
CancellationToken cancellationToken = default)
{
var query = from apiResource in (await GetDbSetAsync()).IncludeDetails(includeDetails)
where apiResourceNames.Contains(apiResource.Name)
orderby apiResource.Name
select apiResource;
return await query.ToListAsync(GetCancellationToken(cancellationToken));
return await (await GetDbSetAsync())
.IncludeDetails(includeDetails)
.Where(apiResource => apiResourceNames.Contains(apiResource.Name))
.OrderBy(apiResource => apiResource.Name)
.ToListAsync(GetCancellationToken(cancellationToken));
}
public virtual async Task<List<ApiResource>> GetListByScopesAsync(
@ -44,11 +41,10 @@ namespace Volo.Abp.IdentityServer.ApiResources
bool includeDetails = false,
CancellationToken cancellationToken = default)
{
var query = from api in (await GetDbSetAsync()).IncludeDetails(includeDetails)
where api.Scopes.Any(x => scopeNames.Contains(x.Scope))
select api;
return await query.ToListAsync(GetCancellationToken(cancellationToken));
return await (await GetDbSetAsync())
.IncludeDetails(includeDetails)
.Where(api => api.Scopes.Any(x => scopeNames.Contains(x.Scope)))
.ToListAsync(GetCancellationToken(cancellationToken));
}
public virtual async Task<List<ApiResource>> GetListAsync(

@ -21,6 +21,7 @@ namespace Volo.Abp.IdentityServer.ApiScopes
public async Task<ApiScope> FindByNameAsync(string scopeName, bool includeDetails = true, CancellationToken cancellationToken = default)
{
return await (await GetDbSetAsync())
.IncludeDetails(includeDetails)
.OrderBy(x=>x.Id)
.FirstOrDefaultAsync(x => x.Name == scopeName, GetCancellationToken(cancellationToken));
}
@ -28,12 +29,11 @@ namespace Volo.Abp.IdentityServer.ApiScopes
public async Task<List<ApiScope>> GetListByNameAsync(string[] scopeNames, bool includeDetails = false,
CancellationToken cancellationToken = default)
{
var query = from scope in (await GetDbSetAsync()).IncludeDetails(includeDetails)
where scopeNames.Contains(scope.Name)
orderby scope.Id
select scope;
return await query.ToListAsync(GetCancellationToken(cancellationToken));
return await (await GetDbSetAsync())
.IncludeDetails(includeDetails)
.Where(scope => scopeNames.Contains(scope.Name))
.OrderBy(scope => scope.Id)
.ToListAsync(GetCancellationToken(cancellationToken));
}
public async Task<List<ApiScope>> GetListAsync(string sorting, int skipCount, int maxResultCount, string filter = null, bool includeDetails = false, CancellationToken cancellationToken = default)

@ -58,7 +58,7 @@ namespace Volo.Abp.IdentityServer.Clients
public virtual async Task<bool> CheckClientIdExistAsync(string clientId, Guid? expectedId = null, CancellationToken cancellationToken = default)
{
return await (await GetDbSetAsync()).AnyAsync(c => c.Id != expectedId && c.ClientId == clientId, cancellationToken: cancellationToken);
return await (await GetDbSetAsync()).AnyAsync(c => c.Id != expectedId && c.ClientId == clientId, GetCancellationToken(cancellationToken));
}
public async override Task DeleteAsync(Guid id, bool autoSave = false, CancellationToken cancellationToken = default)

@ -24,9 +24,8 @@ namespace Volo.Abp.IdentityServer.Devices
CancellationToken cancellationToken = default)
{
return await (await GetDbSetAsync())
.Where(d => d.UserCode == userCode)
.OrderBy(d => d.Id)
.FirstOrDefaultAsync(GetCancellationToken(cancellationToken));
.FirstOrDefaultAsync(d => d.UserCode == userCode, GetCancellationToken(cancellationToken));
}
public virtual async Task<DeviceFlowCodes> FindByDeviceCodeAsync(
@ -34,9 +33,8 @@ namespace Volo.Abp.IdentityServer.Devices
CancellationToken cancellationToken = default)
{
return await (await GetDbSetAsync())
.Where(d => d.DeviceCode == deviceCode)
.OrderBy(d => d.Id)
.FirstOrDefaultAsync(GetCancellationToken(cancellationToken));
.FirstOrDefaultAsync(d => d.DeviceCode == deviceCode, GetCancellationToken(cancellationToken));
}
public virtual async Task<List<DeviceFlowCodes>> GetListByExpirationAsync(DateTime maxExpirationDate, int maxResultCount,

@ -30,9 +30,8 @@ namespace Volo.Abp.IdentityServer.Grants
CancellationToken cancellationToken = default)
{
return await (await GetDbSetAsync())
.Where(x => x.Key == key)
.OrderBy(x => x.Id)
.FirstOrDefaultAsync(GetCancellationToken(cancellationToken));
.FirstOrDefaultAsync(x => x.Key == key, GetCancellationToken(cancellationToken));
}
public virtual async Task<List<PersistedGrant>> GetListBySubjectIdAsync(

@ -24,11 +24,10 @@ namespace Volo.Abp.IdentityServer.IdentityResources
bool includeDetails = false,
CancellationToken cancellationToken = default)
{
var query = from identityResource in (await GetDbSetAsync()).IncludeDetails(includeDetails)
where scopeNames.Contains(identityResource.Name)
select identityResource;
return await query.ToListAsync(GetCancellationToken(cancellationToken));
return await (await GetDbSetAsync())
.IncludeDetails(includeDetails)
.Where(identityResource => scopeNames.Contains(identityResource.Name))
.ToListAsync(GetCancellationToken(cancellationToken));
}
[Obsolete("Use WithDetailsAsync method.")]
@ -72,14 +71,13 @@ namespace Volo.Abp.IdentityServer.IdentityResources
{
return await (await GetDbSetAsync())
.IncludeDetails(includeDetails)
.Where(x => x.Name == name)
.OrderBy(x => x.Id)
.FirstOrDefaultAsync(GetCancellationToken(cancellationToken));
.FirstOrDefaultAsync(x => x.Name == name, GetCancellationToken(cancellationToken));
}
public virtual async Task<bool> CheckNameExistAsync(string name, Guid? expectedId = null, CancellationToken cancellationToken = default)
{
return await (await GetDbSetAsync()).AnyAsync(ir => ir.Id != expectedId && ir.Name == name, cancellationToken: cancellationToken);
return await (await GetDbSetAsync()).AnyAsync(ir => ir.Id != expectedId && ir.Name == name, GetCancellationToken(cancellationToken));
}
}
}

@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
@ -21,9 +21,8 @@ namespace Volo.Abp.IdentityServer.MongoDB
public async Task<ApiResource> FindByNameAsync(string apiResourceName, bool includeDetails = true, CancellationToken cancellationToken = default)
{
return await (await GetMongoQueryableAsync(cancellationToken))
.Where(ar => ar.Name == apiResourceName)
.OrderBy(ar => ar.Id)
.FirstOrDefaultAsync(GetCancellationToken(cancellationToken));
.FirstOrDefaultAsync(ar => ar.Name == apiResourceName, GetCancellationToken(cancellationToken));
}
public async Task<List<ApiResource>> FindByNameAsync(string[] apiResourceNames, bool includeDetails = true,

@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
@ -23,20 +23,17 @@ namespace Volo.Abp.IdentityServer.MongoDB
public async Task<ApiScope> FindByNameAsync(string scopeName, bool includeDetails = true, CancellationToken cancellationToken = default)
{
return await (await GetMongoQueryableAsync(cancellationToken))
.Where(x => x.Name == scopeName)
.OrderBy(x => x.Id)
.FirstOrDefaultAsync(GetCancellationToken(cancellationToken));
.FirstOrDefaultAsync(x => x.Name == scopeName, GetCancellationToken(cancellationToken));
}
public async Task<List<ApiScope>> GetListByNameAsync(string[] scopeNames, bool includeDetails = false,
CancellationToken cancellationToken = default)
{
var query = from scope in (await GetMongoQueryableAsync(cancellationToken))
where scopeNames.Contains(scope.Name)
orderby scope.Id
select scope;
return await query.ToListAsync(GetCancellationToken(cancellationToken));
return await (await GetMongoQueryableAsync(cancellationToken))
.Where(scope => scopeNames.Contains(scope.Name))
.OrderBy(scope => scope.Id)
.ToListAsync(GetCancellationToken(cancellationToken));
}
public async Task<List<ApiScope>> GetListAsync(string sorting, int skipCount, int maxResultCount, string filter = null, bool includeDetails = false,

@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
@ -27,9 +27,8 @@ namespace Volo.Abp.IdentityServer.MongoDB
CancellationToken cancellationToken = default)
{
return await (await GetMongoQueryableAsync(cancellationToken))
.Where(x => x.ClientId == clientId)
.OrderBy(x => x.Id)
.FirstOrDefaultAsync(GetCancellationToken(cancellationToken));
.FirstOrDefaultAsync(x => x.ClientId == clientId, GetCancellationToken(cancellationToken));
}
public virtual async Task<List<Client>> GetListAsync(
@ -69,7 +68,7 @@ namespace Volo.Abp.IdentityServer.MongoDB
public virtual async Task<bool> CheckClientIdExistAsync(string clientId, Guid? expectedId = null, CancellationToken cancellationToken = default)
{
return await (await GetMongoQueryableAsync(cancellationToken))
.AnyAsync(c => c.Id != expectedId && c.ClientId == clientId, cancellationToken: cancellationToken);
.AnyAsync(c => c.Id != expectedId && c.ClientId == clientId, GetCancellationToken(cancellationToken));
}
}
}

@ -62,7 +62,7 @@ namespace Volo.Abp.IdentityServer.MongoDB
public virtual async Task<bool> CheckNameExistAsync(string name, Guid? expectedId = null, CancellationToken cancellationToken = default)
{
return await (await GetMongoQueryableAsync(cancellationToken))
.AnyAsync(ir => ir.Id != expectedId && ir.Name == name, cancellationToken: cancellationToken);
.AnyAsync(ir => ir.Id != expectedId && ir.Name == name, GetCancellationToken(cancellationToken));
}
}
}

@ -1,4 +1,4 @@
using System;
using System;
using System.Threading.Tasks;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Guids;
@ -149,7 +149,7 @@ namespace Volo.Abp.IdentityServer
client.AddCorsOrigin("https://client1-origin.com");
client.AddCorsOrigin("https://{0}.abp.io");
client.AddClaim(nameof(ClientClaim.Value), nameof(ClientClaim.Type));
client.AddClaim(nameof(ClientClaim.Type), nameof(ClientClaim.Value));
client.AddGrantType(nameof(ClientGrantType.GrantType));
client.AddIdentityProviderRestriction(nameof(ClientIdPRestriction.Provider));
client.AddPostLogoutRedirectUri(nameof(ClientPostLogoutRedirectUri.PostLogoutRedirectUri));

@ -9,9 +9,9 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Serilog.Extensions.Hosting" Version="3.1.0" />
<PackageReference Include="Serilog.Sinks.File" Version="4.1.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="5.6.3" />
<PackageReference Include="Serilog.Extensions.Hosting" Version="4.1.2" />
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.2.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="$(MicrosoftPackageVersion)" />
</ItemGroup>

@ -6,9 +6,9 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Serilog.AspNetCore" Version="3.4.0" />
<PackageReference Include="Serilog.AspNetCore" Version="4.1.0" />
<PackageReference Include="Serilog.Extensions.Logging" Version="3.0.1" />
<PackageReference Include="Serilog.Sinks.File" Version="4.1.0" />
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
</ItemGroup>
<ItemGroup>

@ -94,8 +94,8 @@ $projects = (
"framework/src/Volo.Abp.Emailing",
"framework/src/Volo.Abp.EntityFrameworkCore",
"framework/src/Volo.Abp.EntityFrameworkCore.MySQL",
"framework/src/Volo.Abp.EntityFrameworkCore.Oracle",
"framework/src/Volo.Abp.EntityFrameworkCore.Oracle.Devart",
# "framework/src/Volo.Abp.EntityFrameworkCore.Oracle",
# "framework/src/Volo.Abp.EntityFrameworkCore.Oracle.Devart",
"framework/src/Volo.Abp.EntityFrameworkCore.PostgreSql",
"framework/src/Volo.Abp.EntityFrameworkCore.Sqlite",
"framework/src/Volo.Abp.EntityFrameworkCore.SqlServer",
@ -112,6 +112,7 @@ $projects = (
"framework/src/Volo.Abp.HangFire",
"framework/src/Volo.Abp.Http.Abstractions",
"framework/src/Volo.Abp.Http.Client",
"framework/src/Volo.Abp.Http.Client.Web",
"framework/src/Volo.Abp.Http.Client.IdentityModel",
"framework/src/Volo.Abp.Http.Client.IdentityModel.Web",
"framework/src/Volo.Abp.Http.Client.IdentityModel.WebAssembly",

@ -16,7 +16,7 @@
<PackageReference Include="Blazorise.Bootstrap" Version="0.9.4.1" />
<PackageReference Include="Blazorise.Icons.FontAwesome" Version="0.9.4.1" />
<PackageReference Include="Serilog.AspNetCore" Version="4.1.0" />
<PackageReference Include="Serilog.Sinks.Async" Version="1.4.0" />
<PackageReference Include="Serilog.Sinks.Async" Version="1.5.0" />
<PackageReference Include="Microsoft.AspNetCore.DataProtection.StackExchangeRedis" Version="6.0.0-rc.*" />
</ItemGroup>

@ -16,7 +16,7 @@
<PackageReference Include="Blazorise.Bootstrap" Version="0.9.4.1" />
<PackageReference Include="Blazorise.Icons.FontAwesome" Version="0.9.4.1" />
<PackageReference Include="Serilog.AspNetCore" Version="4.1.0" />
<PackageReference Include="Serilog.Sinks.Async" Version="1.4.0" />
<PackageReference Include="Serilog.Sinks.Async" Version="1.5.0" />
</ItemGroup>
<ItemGroup>

@ -18,9 +18,9 @@
<ItemGroup>
<PackageReference Include="Serilog.Extensions.Logging" Version="3.0.1" />
<PackageReference Include="Serilog.Sinks.Async" Version="1.4.0" />
<PackageReference Include="Serilog.Sinks.File" Version="4.1.0" />
<PackageReference Include="Serilog.Sinks.Console" Version="3.1.1" />
<PackageReference Include="Serilog.Sinks.Async" Version="1.5.0" />
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
<PackageReference Include="Serilog.Sinks.Console" Version="4.0.0" />
</ItemGroup>
<ItemGroup>

@ -11,7 +11,7 @@
<ItemGroup>
<PackageReference Include="Serilog.AspNetCore" Version="4.1.0" />
<PackageReference Include="Serilog.Sinks.Async" Version="1.4.0" />
<PackageReference Include="Serilog.Sinks.Async" Version="1.5.0" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="6.0.0-rc.*" />
<PackageReference Include="Microsoft.AspNetCore.DataProtection.StackExchangeRedis" Version="6.0.0-rc.*" />
<ProjectReference Include="..\..\..\..\..\framework\src\Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy\Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy.csproj" />

@ -11,7 +11,7 @@
<ItemGroup>
<PackageReference Include="Serilog.AspNetCore" Version="4.1.0" />
<PackageReference Include="Serilog.Sinks.Async" Version="1.4.0" />
<PackageReference Include="Serilog.Sinks.Async" Version="1.5.0" />
<ProjectReference Include="..\..\..\..\..\framework\src\Volo.Abp.AspNetCore.MultiTenancy\Volo.Abp.AspNetCore.MultiTenancy.csproj" />
<ProjectReference Include="..\..\..\..\..\framework\src\Volo.Abp.Autofac\Volo.Abp.Autofac.csproj" />
<ProjectReference Include="..\..\..\..\..\modules\basic-theme\src\Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic\Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.csproj" />

@ -32,7 +32,7 @@
<ItemGroup>
<PackageReference Include="Serilog.AspNetCore" Version="4.1.0" />
<PackageReference Include="Serilog.Sinks.Async" Version="1.4.0" />
<PackageReference Include="Serilog.Sinks.Async" Version="1.5.0" />
<PackageReference Include="Microsoft.AspNetCore.DataProtection.StackExchangeRedis" Version="6.0.0-rc.*" />
</ItemGroup>

@ -16,7 +16,7 @@
<ItemGroup>
<PackageReference Include="Serilog.AspNetCore" Version="4.1.0" />
<PackageReference Include="Serilog.Sinks.Async" Version="1.4.0" />
<PackageReference Include="Serilog.Sinks.Async" Version="1.5.0" />
<PackageReference Include="Microsoft.AspNetCore.DataProtection.StackExchangeRedis" Version="6.0.0-rc.*" />
</ItemGroup>
@ -29,6 +29,7 @@
<ProjectReference Include="..\..\..\..\..\framework\src\Volo.Abp.AspNetCore.Serilog\Volo.Abp.AspNetCore.Serilog.csproj" />
<ProjectReference Include="..\..\..\..\..\framework\src\Volo.Abp.Http.Client.IdentityModel.Web\Volo.Abp.Http.Client.IdentityModel.Web.csproj" />
<ProjectReference Include="..\..\..\..\..\framework\src\Volo.Abp.Swashbuckle\Volo.Abp.Swashbuckle.csproj" />
<ProjectReference Include="..\..\..\..\..\framework\src\Volo.Abp.Http.Client.Web\Volo.Abp.Http.Client.Web.csproj" />
<ProjectReference Include="..\..\..\..\..\modules\identity\src\Volo.Abp.Identity.Web\Volo.Abp.Identity.Web.csproj" />
<ProjectReference Include="..\..\..\..\..\modules\tenant-management\src\Volo.Abp.TenantManagement.Web\Volo.Abp.TenantManagement.Web.csproj" />
<ProjectReference Include="..\..\..\..\..\modules\setting-management\src\Volo.Abp.SettingManagement.Web\Volo.Abp.SettingManagement.Web.csproj" />

@ -29,6 +29,7 @@ using Volo.Abp.AutoMapper;
using Volo.Abp.Caching;
using Volo.Abp.Caching.StackExchangeRedis;
using Volo.Abp.Http.Client.IdentityModel.Web;
using Volo.Abp.Http.Client.Web;
using Volo.Abp.Identity.Web;
using Volo.Abp.Modularity;
using Volo.Abp.MultiTenancy;
@ -51,6 +52,7 @@ namespace MyCompanyName.MyProjectName.Web
typeof(AbpAutofacModule),
typeof(AbpCachingStackExchangeRedisModule),
typeof(AbpSettingManagementWebModule),
typeof(AbpHttpClientWebModule),
typeof(AbpHttpClientIdentityModelWebModule),
typeof(AbpIdentityWebModule),
typeof(AbpTenantManagementWebModule),

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save