Merge branch 'dev' into studio-dev

pull/10363/head
Yunus Emre Kalkan 4 years ago
commit 429092c80c

@ -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>();

@ -19,6 +19,14 @@ namespace Volo.Abp.Cli.ProjectBuilding.Building.Steps
context.BuildArgs.SolutionName.ProjectName
).Run();
new SolutionRenamer(
context.Files,
"myCompanyName.myProjectName",
"MicroserviceName",
context.BuildArgs.SolutionName.CompanyName,
context.BuildArgs.SolutionName.ProjectName
).Run();
new SolutionRenamer(
context.Files,
null,

@ -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(','))

@ -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
{

@ -38,19 +38,24 @@ namespace Volo.Abp.Http.Client.ClientProxying
protected ClientProxyRequestPayloadBuilder ClientProxyRequestPayloadBuilder => LazyServiceProvider.LazyGetRequiredService<ClientProxyRequestPayloadBuilder>();
protected ClientProxyUrlBuilder ClientProxyUrlBuilder => LazyServiceProvider.LazyGetRequiredService<ClientProxyUrlBuilder>();
protected virtual async Task RequestAsync(string methodName, params object[] arguments)
protected virtual async Task RequestAsync(string methodName, ClientProxyRequestTypeValue arguments = null)
{
await RequestAsync(BuildHttpProxyClientProxyContext(methodName, arguments));
}
protected virtual async Task<T> RequestAsync<T>(string methodName, params object[] arguments)
protected virtual async Task<T> RequestAsync<T>(string methodName, ClientProxyRequestTypeValue arguments = null)
{
return await RequestAsync<T>(BuildHttpProxyClientProxyContext(methodName, arguments));
}
protected virtual ClientProxyRequestContext BuildHttpProxyClientProxyContext(string methodName, params object[] arguments)
protected virtual ClientProxyRequestContext BuildHttpProxyClientProxyContext(string methodName, ClientProxyRequestTypeValue arguments = null)
{
var methodUniqueName = $"{typeof(TService).FullName}.{methodName}.{string.Join("-", arguments.Select(x => x.GetType().FullName))}";
if (arguments == null)
{
arguments = new ClientProxyRequestTypeValue();
}
var methodUniqueName = $"{typeof(TService).FullName}.{methodName}.{string.Join("-", arguments.Values.Select(x => x.Key.FullName))}";
var action = ClientProxyApiDescriptionFinder.FindAction(methodUniqueName);
if (action == null)
{
@ -60,7 +65,7 @@ namespace Volo.Abp.Http.Client.ClientProxying
action,
action.Parameters
.GroupBy(x => x.NameOnMethod)
.Select((x, i) => new KeyValuePair<string, object>(x.Key, arguments[i]))
.Select((x, i) => new KeyValuePair<string, object>(x.Key, arguments.Values[i].Value))
.ToDictionary(x => x.Key, x => x.Value),
typeof(TService));
}

@ -0,0 +1,31 @@
using System;
using System.Collections;
using System.Collections.Generic;
namespace Volo.Abp.Http.Client.ClientProxying
{
public class ClientProxyRequestTypeValue : IEnumerable<KeyValuePair<Type, object>>
{
public List<KeyValuePair<Type, object>> Values { get; private set; }
public ClientProxyRequestTypeValue()
{
Values = new List<KeyValuePair<Type, object>>();
}
public void Add(Type type, object value)
{
Values.Add(new KeyValuePair<Type, object>(type, value));
}
public IEnumerator<KeyValuePair<Type, object>> GetEnumerator()
{
return Values.GetEnumerator();
}
IEnumerator IEnumerable.GetEnumerator()
{
return GetEnumerator();
}
}
}

@ -217,7 +217,7 @@ namespace Volo.Abp.Swashbuckle.Conventions
var key =
$"{appServiceType.FullName}." +
$"{action.ActionMethod.Name}." +
$"{string.Join("-", action.Parameters.Select(x => x.ParameterType.FullName))}";
$"{string.Join("-", action.Parameters.Select(x => TypeHelper.GetFullNameHandlingNullableAndGenerics(x.ParameterType)))}";
var actionApiDescriptionModel = ClientProxyApiDescriptionFinder.FindAction(key);
if (actionApiDescriptionModel == null)

@ -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()
{

@ -18,17 +18,26 @@ namespace Volo.Abp.Account.ClientProxies
{
public virtual async Task<IdentityUserDto> RegisterAsync(RegisterDto input)
{
return await RequestAsync<IdentityUserDto>(nameof(RegisterAsync), input);
return await RequestAsync<IdentityUserDto>(nameof(RegisterAsync), new ClientProxyRequestTypeValue
{
{ typeof(RegisterDto), input }
});
}
public virtual async Task SendPasswordResetCodeAsync(SendPasswordResetCodeDto input)
{
await RequestAsync(nameof(SendPasswordResetCodeAsync), input);
await RequestAsync(nameof(SendPasswordResetCodeAsync), new ClientProxyRequestTypeValue
{
{ typeof(SendPasswordResetCodeDto), input }
});
}
public virtual async Task ResetPasswordAsync(ResetPasswordDto input)
{
await RequestAsync(nameof(ResetPasswordAsync), input);
await RequestAsync(nameof(ResetPasswordAsync), new ClientProxyRequestTypeValue
{
{ typeof(ResetPasswordDto), input }
});
}
}
}

@ -23,27 +23,43 @@ namespace Volo.Blogging.Admin.ClientProxies
public virtual async Task<BlogDto> GetAsync(Guid id)
{
return await RequestAsync<BlogDto>(nameof(GetAsync), id);
return await RequestAsync<BlogDto>(nameof(GetAsync), new ClientProxyRequestTypeValue
{
{ typeof(Guid), id }
});
}
public virtual async Task<BlogDto> CreateAsync(CreateBlogDto input)
{
return await RequestAsync<BlogDto>(nameof(CreateAsync), input);
return await RequestAsync<BlogDto>(nameof(CreateAsync), new ClientProxyRequestTypeValue
{
{ typeof(CreateBlogDto), input }
});
}
public virtual async Task<BlogDto> UpdateAsync(Guid id, UpdateBlogDto input)
{
return await RequestAsync<BlogDto>(nameof(UpdateAsync), id, input);
return await RequestAsync<BlogDto>(nameof(UpdateAsync), new ClientProxyRequestTypeValue
{
{ typeof(Guid), id },
{ typeof(UpdateBlogDto), input }
});
}
public virtual async Task DeleteAsync(Guid id)
{
await RequestAsync(nameof(DeleteAsync), id);
await RequestAsync(nameof(DeleteAsync), new ClientProxyRequestTypeValue
{
{ typeof(Guid), id }
});
}
public virtual async Task ClearCacheAsync(Guid id)
{
await RequestAsync(nameof(ClearCacheAsync), id);
await RequestAsync(nameof(ClearCacheAsync), new ClientProxyRequestTypeValue
{
{ typeof(Guid), id }
});
}
}
}

@ -17,12 +17,18 @@ namespace Volo.Blogging.ClientProxies
{
public virtual async Task<RawFileDto> GetAsync(string name)
{
return await RequestAsync<RawFileDto>(nameof(GetAsync), name);
return await RequestAsync<RawFileDto>(nameof(GetAsync), new ClientProxyRequestTypeValue
{
{ typeof(string), name }
});
}
public virtual async Task<FileUploadOutputDto> CreateAsync(FileUploadInputDto input)
{
return await RequestAsync<FileUploadOutputDto>(nameof(CreateAsync), input);
return await RequestAsync<FileUploadOutputDto>(nameof(CreateAsync), new ClientProxyRequestTypeValue
{
{ typeof(FileUploadInputDto), input }
});
}
}
}

@ -23,12 +23,18 @@ namespace Volo.Blogging.ClientProxies
public virtual async Task<BlogDto> GetByShortNameAsync(string shortName)
{
return await RequestAsync<BlogDto>(nameof(GetByShortNameAsync), shortName);
return await RequestAsync<BlogDto>(nameof(GetByShortNameAsync), new ClientProxyRequestTypeValue
{
{ typeof(string), shortName }
});
}
public virtual async Task<BlogDto> GetAsync(Guid id)
{
return await RequestAsync<BlogDto>(nameof(GetAsync), id);
return await RequestAsync<BlogDto>(nameof(GetAsync), new ClientProxyRequestTypeValue
{
{ typeof(Guid), id }
});
}
}
}

@ -19,22 +19,35 @@ namespace Volo.Blogging.ClientProxies
{
public virtual async Task<List<CommentWithRepliesDto>> GetHierarchicalListOfPostAsync(Guid postId)
{
return await RequestAsync<List<CommentWithRepliesDto>>(nameof(GetHierarchicalListOfPostAsync), postId);
return await RequestAsync<List<CommentWithRepliesDto>>(nameof(GetHierarchicalListOfPostAsync), new ClientProxyRequestTypeValue
{
{ typeof(Guid), postId }
});
}
public virtual async Task<CommentWithDetailsDto> CreateAsync(CreateCommentDto input)
{
return await RequestAsync<CommentWithDetailsDto>(nameof(CreateAsync), input);
return await RequestAsync<CommentWithDetailsDto>(nameof(CreateAsync), new ClientProxyRequestTypeValue
{
{ typeof(CreateCommentDto), input }
});
}
public virtual async Task<CommentWithDetailsDto> UpdateAsync(Guid id, UpdateCommentDto input)
{
return await RequestAsync<CommentWithDetailsDto>(nameof(UpdateAsync), id, input);
return await RequestAsync<CommentWithDetailsDto>(nameof(UpdateAsync), new ClientProxyRequestTypeValue
{
{ typeof(Guid), id },
{ typeof(UpdateCommentDto), input }
});
}
public virtual async Task DeleteAsync(Guid id)
{
await RequestAsync(nameof(DeleteAsync), id);
await RequestAsync(nameof(DeleteAsync), new ClientProxyRequestTypeValue
{
{ typeof(Guid), id }
});
}
}
}

@ -17,37 +17,60 @@ namespace Volo.Blogging.ClientProxies
{
public virtual async Task<ListResultDto<PostWithDetailsDto>> GetListByBlogIdAndTagNameAsync(Guid blogId, string tagName)
{
return await RequestAsync<ListResultDto<PostWithDetailsDto>>(nameof(GetListByBlogIdAndTagNameAsync), blogId, tagName);
return await RequestAsync<ListResultDto<PostWithDetailsDto>>(nameof(GetListByBlogIdAndTagNameAsync), new ClientProxyRequestTypeValue
{
{ typeof(Guid), blogId },
{ typeof(string), tagName }
});
}
public virtual async Task<ListResultDto<PostWithDetailsDto>> GetTimeOrderedListAsync(Guid blogId)
{
return await RequestAsync<ListResultDto<PostWithDetailsDto>>(nameof(GetTimeOrderedListAsync), blogId);
return await RequestAsync<ListResultDto<PostWithDetailsDto>>(nameof(GetTimeOrderedListAsync), new ClientProxyRequestTypeValue
{
{ typeof(Guid), blogId }
});
}
public virtual async Task<PostWithDetailsDto> GetForReadingAsync(GetPostInput input)
{
return await RequestAsync<PostWithDetailsDto>(nameof(GetForReadingAsync), input);
return await RequestAsync<PostWithDetailsDto>(nameof(GetForReadingAsync), new ClientProxyRequestTypeValue
{
{ typeof(GetPostInput), input }
});
}
public virtual async Task<PostWithDetailsDto> GetAsync(Guid id)
{
return await RequestAsync<PostWithDetailsDto>(nameof(GetAsync), id);
return await RequestAsync<PostWithDetailsDto>(nameof(GetAsync), new ClientProxyRequestTypeValue
{
{ typeof(Guid), id }
});
}
public virtual async Task<PostWithDetailsDto> CreateAsync(CreatePostDto input)
{
return await RequestAsync<PostWithDetailsDto>(nameof(CreateAsync), input);
return await RequestAsync<PostWithDetailsDto>(nameof(CreateAsync), new ClientProxyRequestTypeValue
{
{ typeof(CreatePostDto), input }
});
}
public virtual async Task<PostWithDetailsDto> UpdateAsync(Guid id, UpdatePostDto input)
{
return await RequestAsync<PostWithDetailsDto>(nameof(UpdateAsync), id, input);
return await RequestAsync<PostWithDetailsDto>(nameof(UpdateAsync), new ClientProxyRequestTypeValue
{
{ typeof(Guid), id },
{ typeof(UpdatePostDto), input }
});
}
public virtual async Task DeleteAsync(Guid id)
{
await RequestAsync(nameof(DeleteAsync), id);
await RequestAsync(nameof(DeleteAsync), new ClientProxyRequestTypeValue
{
{ typeof(Guid), id }
});
}
}
}

@ -19,7 +19,11 @@ namespace Volo.Blogging.ClientProxies
{
public virtual async Task<List<TagDto>> GetPopularTagsAsync(Guid blogId, GetPopularTagsInput input)
{
return await RequestAsync<List<TagDto>>(nameof(GetPopularTagsAsync), blogId, input);
return await RequestAsync<List<TagDto>>(nameof(GetPopularTagsAsync), new ClientProxyRequestTypeValue
{
{ typeof(Guid), blogId },
{ typeof(GetPopularTagsInput), input }
});
}
}
}

@ -64,6 +64,11 @@ namespace Volo.CmsKit.Admin.Menus
CurrentTenant.Id
);
if (input.PageId.HasValue)
{
MenuManager.SetPageUrl(menuItem, await PageRepository.GetAsync(input.PageId.Value));
}
await MenuItemRepository.InsertAsync(menuItem);
return ObjectMapper.Map<MenuItem, MenuItemDto>(menuItem);

@ -17,27 +17,43 @@ namespace Volo.CmsKit.Admin.Blogs.ClientProxies
{
public virtual async Task<BlogDto> GetAsync(Guid id)
{
return await RequestAsync<BlogDto>(nameof(GetAsync), id);
return await RequestAsync<BlogDto>(nameof(GetAsync), new ClientProxyRequestTypeValue
{
{ typeof(Guid), id }
});
}
public virtual async Task<PagedResultDto<BlogDto>> GetListAsync(BlogGetListInput input)
{
return await RequestAsync<PagedResultDto<BlogDto>>(nameof(GetListAsync), input);
return await RequestAsync<PagedResultDto<BlogDto>>(nameof(GetListAsync), new ClientProxyRequestTypeValue
{
{ typeof(BlogGetListInput), input }
});
}
public virtual async Task<BlogDto> CreateAsync(CreateBlogDto input)
{
return await RequestAsync<BlogDto>(nameof(CreateAsync), input);
return await RequestAsync<BlogDto>(nameof(CreateAsync), new ClientProxyRequestTypeValue
{
{ typeof(CreateBlogDto), input }
});
}
public virtual async Task<BlogDto> UpdateAsync(Guid id, UpdateBlogDto input)
{
return await RequestAsync<BlogDto>(nameof(UpdateAsync), id, input);
return await RequestAsync<BlogDto>(nameof(UpdateAsync), new ClientProxyRequestTypeValue
{
{ typeof(Guid), id },
{ typeof(UpdateBlogDto), input }
});
}
public virtual async Task DeleteAsync(Guid id)
{
await RequestAsync(nameof(DeleteAsync), id);
await RequestAsync(nameof(DeleteAsync), new ClientProxyRequestTypeValue
{
{ typeof(Guid), id }
});
}
}
}

@ -19,12 +19,19 @@ namespace Volo.CmsKit.Admin.Blogs.ClientProxies
{
public virtual async Task<List<BlogFeatureDto>> GetListAsync(Guid blogId)
{
return await RequestAsync<List<BlogFeatureDto>>(nameof(GetListAsync), blogId);
return await RequestAsync<List<BlogFeatureDto>>(nameof(GetListAsync), new ClientProxyRequestTypeValue
{
{ typeof(Guid), blogId }
});
}
public virtual async Task SetAsync(Guid blogId, BlogFeatureInputDto dto)
{
await RequestAsync(nameof(SetAsync), blogId, dto);
await RequestAsync(nameof(SetAsync), new ClientProxyRequestTypeValue
{
{ typeof(Guid), blogId },
{ typeof(BlogFeatureInputDto), dto }
});
}
}
}

@ -17,27 +17,43 @@ namespace Volo.CmsKit.Admin.Blogs.ClientProxies
{
public virtual async Task<BlogPostDto> CreateAsync(CreateBlogPostDto input)
{
return await RequestAsync<BlogPostDto>(nameof(CreateAsync), input);
return await RequestAsync<BlogPostDto>(nameof(CreateAsync), new ClientProxyRequestTypeValue
{
{ typeof(CreateBlogPostDto), input }
});
}
public virtual async Task DeleteAsync(Guid id)
{
await RequestAsync(nameof(DeleteAsync), id);
await RequestAsync(nameof(DeleteAsync), new ClientProxyRequestTypeValue
{
{ typeof(Guid), id }
});
}
public virtual async Task<BlogPostDto> GetAsync(Guid id)
{
return await RequestAsync<BlogPostDto>(nameof(GetAsync), id);
return await RequestAsync<BlogPostDto>(nameof(GetAsync), new ClientProxyRequestTypeValue
{
{ typeof(Guid), id }
});
}
public virtual async Task<PagedResultDto<BlogPostListDto>> GetListAsync(BlogPostGetListInput input)
{
return await RequestAsync<PagedResultDto<BlogPostListDto>>(nameof(GetListAsync), input);
return await RequestAsync<PagedResultDto<BlogPostListDto>>(nameof(GetListAsync), new ClientProxyRequestTypeValue
{
{ typeof(BlogPostGetListInput), input }
});
}
public virtual async Task<BlogPostDto> UpdateAsync(Guid id, UpdateBlogPostDto input)
{
return await RequestAsync<BlogPostDto>(nameof(UpdateAsync), id, input);
return await RequestAsync<BlogPostDto>(nameof(UpdateAsync), new ClientProxyRequestTypeValue
{
{ typeof(Guid), id },
{ typeof(UpdateBlogPostDto), input }
});
}
}
}

@ -17,17 +17,26 @@ namespace Volo.CmsKit.Admin.Comments.ClientProxies
{
public virtual async Task<PagedResultDto<CommentWithAuthorDto>> GetListAsync(CommentGetListInput input)
{
return await RequestAsync<PagedResultDto<CommentWithAuthorDto>>(nameof(GetListAsync), input);
return await RequestAsync<PagedResultDto<CommentWithAuthorDto>>(nameof(GetListAsync), new ClientProxyRequestTypeValue
{
{ typeof(CommentGetListInput), input }
});
}
public virtual async Task<CommentWithAuthorDto> GetAsync(Guid id)
{
return await RequestAsync<CommentWithAuthorDto>(nameof(GetAsync), id);
return await RequestAsync<CommentWithAuthorDto>(nameof(GetAsync), new ClientProxyRequestTypeValue
{
{ typeof(Guid), id }
});
}
public virtual async Task DeleteAsync(Guid id)
{
await RequestAsync(nameof(DeleteAsync), id);
await RequestAsync(nameof(DeleteAsync), new ClientProxyRequestTypeValue
{
{ typeof(Guid), id }
});
}
}
}

@ -17,17 +17,26 @@ namespace Volo.CmsKit.Admin.Tags.ClientProxies
{
public virtual async Task AddTagToEntityAsync(EntityTagCreateDto input)
{
await RequestAsync(nameof(AddTagToEntityAsync), input);
await RequestAsync(nameof(AddTagToEntityAsync), new ClientProxyRequestTypeValue
{
{ typeof(EntityTagCreateDto), input }
});
}
public virtual async Task RemoveTagFromEntityAsync(EntityTagRemoveDto input)
{
await RequestAsync(nameof(RemoveTagFromEntityAsync), input);
await RequestAsync(nameof(RemoveTagFromEntityAsync), new ClientProxyRequestTypeValue
{
{ typeof(EntityTagRemoveDto), input }
});
}
public virtual async Task SetEntityTagsAsync(EntityTagSetDto input)
{
await RequestAsync(nameof(SetEntityTagsAsync), input);
await RequestAsync(nameof(SetEntityTagsAsync), new ClientProxyRequestTypeValue
{
{ typeof(EntityTagSetDto), input }
});
}
}
}

@ -17,12 +17,19 @@ namespace Volo.CmsKit.Admin.MediaDescriptors.ClientProxies
{
public virtual async Task<MediaDescriptorDto> CreateAsync(string entityType, CreateMediaInputWithStream inputStream)
{
return await RequestAsync<MediaDescriptorDto>(nameof(CreateAsync), entityType, inputStream);
return await RequestAsync<MediaDescriptorDto>(nameof(CreateAsync), new ClientProxyRequestTypeValue
{
{ typeof(string), entityType },
{ typeof(CreateMediaInputWithStream), inputStream }
});
}
public virtual async Task DeleteAsync(Guid id)
{
await RequestAsync(nameof(DeleteAsync), id);
await RequestAsync(nameof(DeleteAsync), new ClientProxyRequestTypeValue
{
{ typeof(Guid), id }
});
}
}
}

@ -23,32 +23,52 @@ namespace Volo.CmsKit.Admin.Menus.ClientProxies
public virtual async Task<MenuItemDto> GetAsync(Guid id)
{
return await RequestAsync<MenuItemDto>(nameof(GetAsync), id);
return await RequestAsync<MenuItemDto>(nameof(GetAsync), new ClientProxyRequestTypeValue
{
{ typeof(Guid), id }
});
}
public virtual async Task<MenuItemDto> CreateAsync(MenuItemCreateInput input)
{
return await RequestAsync<MenuItemDto>(nameof(CreateAsync), input);
return await RequestAsync<MenuItemDto>(nameof(CreateAsync), new ClientProxyRequestTypeValue
{
{ typeof(MenuItemCreateInput), input }
});
}
public virtual async Task<MenuItemDto> UpdateAsync(Guid id, MenuItemUpdateInput input)
{
return await RequestAsync<MenuItemDto>(nameof(UpdateAsync), id, input);
return await RequestAsync<MenuItemDto>(nameof(UpdateAsync), new ClientProxyRequestTypeValue
{
{ typeof(Guid), id },
{ typeof(MenuItemUpdateInput), input }
});
}
public virtual async Task DeleteAsync(Guid id)
{
await RequestAsync(nameof(DeleteAsync), id);
await RequestAsync(nameof(DeleteAsync), new ClientProxyRequestTypeValue
{
{ typeof(Guid), id }
});
}
public virtual async Task MoveMenuItemAsync(Guid id, MenuItemMoveInput input)
{
await RequestAsync(nameof(MoveMenuItemAsync), id, input);
await RequestAsync(nameof(MoveMenuItemAsync), new ClientProxyRequestTypeValue
{
{ typeof(Guid), id },
{ typeof(MenuItemMoveInput), input }
});
}
public virtual async Task<PagedResultDto<PageLookupDto>> GetPageLookupAsync(PageLookupInputDto input)
{
return await RequestAsync<PagedResultDto<PageLookupDto>>(nameof(GetPageLookupAsync), input);
return await RequestAsync<PagedResultDto<PageLookupDto>>(nameof(GetPageLookupAsync), new ClientProxyRequestTypeValue
{
{ typeof(PageLookupInputDto), input }
});
}
}
}

@ -17,27 +17,43 @@ namespace Volo.CmsKit.Admin.Pages.ClientProxies
{
public virtual async Task<PageDto> GetAsync(Guid id)
{
return await RequestAsync<PageDto>(nameof(GetAsync), id);
return await RequestAsync<PageDto>(nameof(GetAsync), new ClientProxyRequestTypeValue
{
{ typeof(Guid), id }
});
}
public virtual async Task<PagedResultDto<PageDto>> GetListAsync(GetPagesInputDto input)
{
return await RequestAsync<PagedResultDto<PageDto>>(nameof(GetListAsync), input);
return await RequestAsync<PagedResultDto<PageDto>>(nameof(GetListAsync), new ClientProxyRequestTypeValue
{
{ typeof(GetPagesInputDto), input }
});
}
public virtual async Task<PageDto> CreateAsync(CreatePageInputDto input)
{
return await RequestAsync<PageDto>(nameof(CreateAsync), input);
return await RequestAsync<PageDto>(nameof(CreateAsync), new ClientProxyRequestTypeValue
{
{ typeof(CreatePageInputDto), input }
});
}
public virtual async Task<PageDto> UpdateAsync(Guid id, UpdatePageInputDto input)
{
return await RequestAsync<PageDto>(nameof(UpdateAsync), id, input);
return await RequestAsync<PageDto>(nameof(UpdateAsync), new ClientProxyRequestTypeValue
{
{ typeof(Guid), id },
{ typeof(UpdatePageInputDto), input }
});
}
public virtual async Task DeleteAsync(Guid id)
{
await RequestAsync(nameof(DeleteAsync), id);
await RequestAsync(nameof(DeleteAsync), new ClientProxyRequestTypeValue
{
{ typeof(Guid), id }
});
}
}
}

@ -19,27 +19,43 @@ namespace Volo.CmsKit.Admin.Tags.ClientProxies
{
public virtual async Task<TagDto> CreateAsync(TagCreateDto input)
{
return await RequestAsync<TagDto>(nameof(CreateAsync), input);
return await RequestAsync<TagDto>(nameof(CreateAsync), new ClientProxyRequestTypeValue
{
{ typeof(TagCreateDto), input }
});
}
public virtual async Task DeleteAsync(Guid id)
{
await RequestAsync(nameof(DeleteAsync), id);
await RequestAsync(nameof(DeleteAsync), new ClientProxyRequestTypeValue
{
{ typeof(Guid), id }
});
}
public virtual async Task<TagDto> GetAsync(Guid id)
{
return await RequestAsync<TagDto>(nameof(GetAsync), id);
return await RequestAsync<TagDto>(nameof(GetAsync), new ClientProxyRequestTypeValue
{
{ typeof(Guid), id }
});
}
public virtual async Task<PagedResultDto<TagDto>> GetListAsync(TagGetListInput input)
{
return await RequestAsync<PagedResultDto<TagDto>>(nameof(GetListAsync), input);
return await RequestAsync<PagedResultDto<TagDto>>(nameof(GetListAsync), new ClientProxyRequestTypeValue
{
{ typeof(TagGetListInput), input }
});
}
public virtual async Task<TagDto> UpdateAsync(Guid id, TagUpdateDto input)
{
return await RequestAsync<TagDto>(nameof(UpdateAsync), id, input);
return await RequestAsync<TagDto>(nameof(UpdateAsync), new ClientProxyRequestTypeValue
{
{ typeof(Guid), id },
{ typeof(TagUpdateDto), input }
});
}
public virtual async Task<List<TagDefinitionDto>> GetTagDefinitionsAsync()

@ -17,7 +17,11 @@ namespace Volo.CmsKit.Blogs.ClientProxies
{
public virtual async Task<BlogFeatureDto> GetOrDefaultAsync(Guid blogId, string featureName)
{
return await RequestAsync<BlogFeatureDto>(nameof(GetOrDefaultAsync), blogId, featureName);
return await RequestAsync<BlogFeatureDto>(nameof(GetOrDefaultAsync), new ClientProxyRequestTypeValue
{
{ typeof(Guid), blogId },
{ typeof(string), featureName }
});
}
}
}

@ -18,7 +18,10 @@ namespace Volo.CmsKit.MediaDescriptors.ClientProxies
{
public virtual async Task<RemoteStreamContent> DownloadAsync(Guid id)
{
return await RequestAsync<RemoteStreamContent>(nameof(DownloadAsync), id);
return await RequestAsync<RemoteStreamContent>(nameof(DownloadAsync), new ClientProxyRequestTypeValue
{
{ typeof(Guid), id }
});
}
}
}

@ -17,12 +17,20 @@ namespace Volo.CmsKit.Public.Blogs.ClientProxies
{
public virtual async Task<BlogPostPublicDto> GetAsync(string blogSlug, string blogPostSlug)
{
return await RequestAsync<BlogPostPublicDto>(nameof(GetAsync), blogSlug, blogPostSlug);
return await RequestAsync<BlogPostPublicDto>(nameof(GetAsync), new ClientProxyRequestTypeValue
{
{ typeof(string), blogSlug },
{ typeof(string), blogPostSlug }
});
}
public virtual async Task<PagedResultDto<BlogPostPublicDto>> GetListAsync(string blogSlug, PagedAndSortedResultRequestDto input)
{
return await RequestAsync<PagedResultDto<BlogPostPublicDto>>(nameof(GetListAsync), blogSlug, input);
return await RequestAsync<PagedResultDto<BlogPostPublicDto>>(nameof(GetListAsync), new ClientProxyRequestTypeValue
{
{ typeof(string), blogSlug },
{ typeof(PagedAndSortedResultRequestDto), input }
});
}
}
}

@ -17,22 +17,38 @@ namespace Volo.CmsKit.Public.Comments.ClientProxies
{
public virtual async Task<ListResultDto<CommentWithDetailsDto>> GetListAsync(string entityType, string entityId)
{
return await RequestAsync<ListResultDto<CommentWithDetailsDto>>(nameof(GetListAsync), entityType, entityId);
return await RequestAsync<ListResultDto<CommentWithDetailsDto>>(nameof(GetListAsync), new ClientProxyRequestTypeValue
{
{ typeof(string), entityType },
{ typeof(string), entityId }
});
}
public virtual async Task<CommentDto> CreateAsync(string entityType, string entityId, CreateCommentInput input)
{
return await RequestAsync<CommentDto>(nameof(CreateAsync), entityType, entityId, input);
return await RequestAsync<CommentDto>(nameof(CreateAsync), new ClientProxyRequestTypeValue
{
{ typeof(string), entityType },
{ typeof(string), entityId },
{ typeof(CreateCommentInput), input }
});
}
public virtual async Task<CommentDto> UpdateAsync(Guid id, UpdateCommentInput input)
{
return await RequestAsync<CommentDto>(nameof(UpdateAsync), id, input);
return await RequestAsync<CommentDto>(nameof(UpdateAsync), new ClientProxyRequestTypeValue
{
{ typeof(Guid), id },
{ typeof(UpdateCommentInput), input }
});
}
public virtual async Task DeleteAsync(Guid id)
{
await RequestAsync(nameof(DeleteAsync), id);
await RequestAsync(nameof(DeleteAsync), new ClientProxyRequestTypeValue
{
{ typeof(Guid), id }
});
}
}
}

@ -17,7 +17,10 @@ namespace Volo.CmsKit.Public.Pages.ClientProxies
{
public virtual async Task<PageDto> FindBySlugAsync(string slug)
{
return await RequestAsync<PageDto>(nameof(FindBySlugAsync), slug);
return await RequestAsync<PageDto>(nameof(FindBySlugAsync), new ClientProxyRequestTypeValue
{
{ typeof(string), slug }
});
}
}
}

@ -18,17 +18,30 @@ namespace Volo.CmsKit.Public.Ratings.ClientProxies
{
public virtual async Task<RatingDto> CreateAsync(string entityType, string entityId, CreateUpdateRatingInput input)
{
return await RequestAsync<RatingDto>(nameof(CreateAsync), entityType, entityId, input);
return await RequestAsync<RatingDto>(nameof(CreateAsync), new ClientProxyRequestTypeValue
{
{ typeof(string), entityType },
{ typeof(string), entityId },
{ typeof(CreateUpdateRatingInput), input }
});
}
public virtual async Task DeleteAsync(string entityType, string entityId)
{
await RequestAsync(nameof(DeleteAsync), entityType, entityId);
await RequestAsync(nameof(DeleteAsync), new ClientProxyRequestTypeValue
{
{ typeof(string), entityType },
{ typeof(string), entityId }
});
}
public virtual async Task<List<RatingWithStarCountDto>> GetGroupedStarCountsAsync(string entityType, string entityId)
{
return await RequestAsync<List<RatingWithStarCountDto>>(nameof(GetGroupedStarCountsAsync), entityType, entityId);
return await RequestAsync<List<RatingWithStarCountDto>>(nameof(GetGroupedStarCountsAsync), new ClientProxyRequestTypeValue
{
{ typeof(string), entityType },
{ typeof(string), entityId }
});
}
}
}

@ -17,17 +17,31 @@ namespace Volo.CmsKit.Public.Reactions.ClientProxies
{
public virtual async Task<ListResultDto<ReactionWithSelectionDto>> GetForSelectionAsync(string entityType, string entityId)
{
return await RequestAsync<ListResultDto<ReactionWithSelectionDto>>(nameof(GetForSelectionAsync), entityType, entityId);
return await RequestAsync<ListResultDto<ReactionWithSelectionDto>>(nameof(GetForSelectionAsync), new ClientProxyRequestTypeValue
{
{ typeof(string), entityType },
{ typeof(string), entityId }
});
}
public virtual async Task CreateAsync(string entityType, string entityId, string reaction)
{
await RequestAsync(nameof(CreateAsync), entityType, entityId, reaction);
await RequestAsync(nameof(CreateAsync), new ClientProxyRequestTypeValue
{
{ typeof(string), entityType },
{ typeof(string), entityId },
{ typeof(string), reaction }
});
}
public virtual async Task DeleteAsync(string entityType, string entityId, string reaction)
{
await RequestAsync(nameof(DeleteAsync), entityType, entityId, reaction);
await RequestAsync(nameof(DeleteAsync), new ClientProxyRequestTypeValue
{
{ typeof(string), entityType },
{ typeof(string), entityId },
{ typeof(string), reaction }
});
}
}
}

@ -18,7 +18,11 @@ namespace Volo.CmsKit.Public.Tags.ClientProxies
{
public virtual async Task<List<TagDto>> GetAllRelatedTagsAsync(string entityType, string entityId)
{
return await RequestAsync<List<TagDto>>(nameof(GetAllRelatedTagsAsync), entityType, entityId);
return await RequestAsync<List<TagDto>>(nameof(GetAllRelatedTagsAsync), new ClientProxyRequestTypeValue
{
{ typeof(string), entityType },
{ typeof(string), entityId }
});
}
}
}

@ -17,32 +17,50 @@ namespace Volo.Docs.Admin.ClientProxies
{
public virtual async Task ClearCacheAsync(ClearCacheInput input)
{
await RequestAsync(nameof(ClearCacheAsync), input);
await RequestAsync(nameof(ClearCacheAsync), new ClientProxyRequestTypeValue
{
{ typeof(ClearCacheInput), input }
});
}
public virtual async Task PullAllAsync(PullAllDocumentInput input)
{
await RequestAsync(nameof(PullAllAsync), input);
await RequestAsync(nameof(PullAllAsync), new ClientProxyRequestTypeValue
{
{ typeof(PullAllDocumentInput), input }
});
}
public virtual async Task PullAsync(PullDocumentInput input)
{
await RequestAsync(nameof(PullAsync), input);
await RequestAsync(nameof(PullAsync), new ClientProxyRequestTypeValue
{
{ typeof(PullDocumentInput), input }
});
}
public virtual async Task<PagedResultDto<DocumentDto>> GetAllAsync(GetAllInput input)
{
return await RequestAsync<PagedResultDto<DocumentDto>>(nameof(GetAllAsync), input);
return await RequestAsync<PagedResultDto<DocumentDto>>(nameof(GetAllAsync), new ClientProxyRequestTypeValue
{
{ typeof(GetAllInput), input }
});
}
public virtual async Task RemoveFromCacheAsync(Guid documentId)
{
await RequestAsync(nameof(RemoveFromCacheAsync), documentId);
await RequestAsync(nameof(RemoveFromCacheAsync), new ClientProxyRequestTypeValue
{
{ typeof(Guid), documentId }
});
}
public virtual async Task ReindexAsync(Guid documentId)
{
await RequestAsync(nameof(ReindexAsync), documentId);
await RequestAsync(nameof(ReindexAsync), new ClientProxyRequestTypeValue
{
{ typeof(Guid), documentId }
});
}
}
}

@ -17,27 +17,43 @@ namespace Volo.Docs.Admin.ClientProxies
{
public virtual async Task<PagedResultDto<ProjectDto>> GetListAsync(PagedAndSortedResultRequestDto input)
{
return await RequestAsync<PagedResultDto<ProjectDto>>(nameof(GetListAsync), input);
return await RequestAsync<PagedResultDto<ProjectDto>>(nameof(GetListAsync), new ClientProxyRequestTypeValue
{
{ typeof(PagedAndSortedResultRequestDto), input }
});
}
public virtual async Task<ProjectDto> GetAsync(Guid id)
{
return await RequestAsync<ProjectDto>(nameof(GetAsync), id);
return await RequestAsync<ProjectDto>(nameof(GetAsync), new ClientProxyRequestTypeValue
{
{ typeof(Guid), id }
});
}
public virtual async Task<ProjectDto> CreateAsync(CreateProjectDto input)
{
return await RequestAsync<ProjectDto>(nameof(CreateAsync), input);
return await RequestAsync<ProjectDto>(nameof(CreateAsync), new ClientProxyRequestTypeValue
{
{ typeof(CreateProjectDto), input }
});
}
public virtual async Task<ProjectDto> UpdateAsync(Guid id, UpdateProjectDto input)
{
return await RequestAsync<ProjectDto>(nameof(UpdateAsync), id, input);
return await RequestAsync<ProjectDto>(nameof(UpdateAsync), new ClientProxyRequestTypeValue
{
{ typeof(Guid), id },
{ typeof(UpdateProjectDto), input }
});
}
public virtual async Task DeleteAsync(Guid id)
{
await RequestAsync(nameof(DeleteAsync), id);
await RequestAsync(nameof(DeleteAsync), new ClientProxyRequestTypeValue
{
{ typeof(Guid), id }
});
}
public virtual async Task ReindexAllAsync()
@ -47,7 +63,10 @@ namespace Volo.Docs.Admin.ClientProxies
public virtual async Task ReindexAsync(ReindexInput input)
{
await RequestAsync(nameof(ReindexAsync), input);
await RequestAsync(nameof(ReindexAsync), new ClientProxyRequestTypeValue
{
{ typeof(ReindexInput), input }
});
}
}
}

@ -18,27 +18,42 @@ namespace Volo.Docs.Documents.ClientProxies
{
public virtual async Task<DocumentWithDetailsDto> GetAsync(GetDocumentInput input)
{
return await RequestAsync<DocumentWithDetailsDto>(nameof(GetAsync), input);
return await RequestAsync<DocumentWithDetailsDto>(nameof(GetAsync), new ClientProxyRequestTypeValue
{
{ typeof(GetDocumentInput), input }
});
}
public virtual async Task<DocumentWithDetailsDto> GetDefaultAsync(GetDefaultDocumentInput input)
{
return await RequestAsync<DocumentWithDetailsDto>(nameof(GetDefaultAsync), input);
return await RequestAsync<DocumentWithDetailsDto>(nameof(GetDefaultAsync), new ClientProxyRequestTypeValue
{
{ typeof(GetDefaultDocumentInput), input }
});
}
public virtual async Task<NavigationNode> GetNavigationAsync(GetNavigationDocumentInput input)
{
return await RequestAsync<NavigationNode>(nameof(GetNavigationAsync), input);
return await RequestAsync<NavigationNode>(nameof(GetNavigationAsync), new ClientProxyRequestTypeValue
{
{ typeof(GetNavigationDocumentInput), input }
});
}
public virtual async Task<DocumentResourceDto> GetResourceAsync(GetDocumentResourceInput input)
{
return await RequestAsync<DocumentResourceDto>(nameof(GetResourceAsync), input);
return await RequestAsync<DocumentResourceDto>(nameof(GetResourceAsync), new ClientProxyRequestTypeValue
{
{ typeof(GetDocumentResourceInput), input }
});
}
public virtual async Task<List<DocumentSearchOutput>> SearchAsync(DocumentSearchInput input)
{
return await RequestAsync<List<DocumentSearchOutput>>(nameof(SearchAsync), input);
return await RequestAsync<List<DocumentSearchOutput>>(nameof(SearchAsync), new ClientProxyRequestTypeValue
{
{ typeof(DocumentSearchInput), input }
});
}
public virtual async Task<bool> FullSearchEnabledAsync()
@ -48,12 +63,18 @@ namespace Volo.Docs.Documents.ClientProxies
public virtual async Task<List<String>> GetUrlsAsync(string prefix)
{
return await RequestAsync<List<String>>(nameof(GetUrlsAsync), prefix);
return await RequestAsync<List<String>>(nameof(GetUrlsAsync), new ClientProxyRequestTypeValue
{
{ typeof(string), prefix }
});
}
public virtual async Task<DocumentParametersDto> GetParametersAsync(GetParametersDocumentInput input)
{
return await RequestAsync<DocumentParametersDto>(nameof(GetParametersAsync), input);
return await RequestAsync<DocumentParametersDto>(nameof(GetParametersAsync), new ClientProxyRequestTypeValue
{
{ typeof(GetParametersDocumentInput), input }
});
}
}
}

@ -23,22 +23,36 @@ namespace Volo.Docs.Projects.ClientProxies
public virtual async Task<ProjectDto> GetAsync(string shortName)
{
return await RequestAsync<ProjectDto>(nameof(GetAsync), shortName);
return await RequestAsync<ProjectDto>(nameof(GetAsync), new ClientProxyRequestTypeValue
{
{ typeof(string), shortName }
});
}
public virtual async Task<string> GetDefaultLanguageCodeAsync(string shortName, string version)
{
return await RequestAsync<string>(nameof(GetDefaultLanguageCodeAsync), shortName, version);
return await RequestAsync<string>(nameof(GetDefaultLanguageCodeAsync), new ClientProxyRequestTypeValue
{
{ typeof(string), shortName },
{ typeof(string), version }
});
}
public virtual async Task<ListResultDto<VersionInfoDto>> GetVersionsAsync(string shortName)
{
return await RequestAsync<ListResultDto<VersionInfoDto>>(nameof(GetVersionsAsync), shortName);
return await RequestAsync<ListResultDto<VersionInfoDto>>(nameof(GetVersionsAsync), new ClientProxyRequestTypeValue
{
{ typeof(string), shortName }
});
}
public virtual async Task<LanguageConfig> GetLanguageListAsync(string shortName, string version)
{
return await RequestAsync<LanguageConfig>(nameof(GetLanguageListAsync), shortName, version);
return await RequestAsync<LanguageConfig>(nameof(GetLanguageListAsync), new ClientProxyRequestTypeValue
{
{ typeof(string), shortName },
{ typeof(string), version }
});
}
}
}

@ -17,12 +17,21 @@ namespace Volo.Abp.FeatureManagement.ClientProxies
{
public virtual async Task<GetFeatureListResultDto> GetAsync(string providerName, string providerKey)
{
return await RequestAsync<GetFeatureListResultDto>(nameof(GetAsync), providerName, providerKey);
return await RequestAsync<GetFeatureListResultDto>(nameof(GetAsync), new ClientProxyRequestTypeValue
{
{ typeof(string), providerName },
{ typeof(string), providerKey }
});
}
public virtual async Task UpdateAsync(string providerName, string providerKey, UpdateFeaturesDto input)
{
await RequestAsync(nameof(UpdateAsync), providerName, providerKey, input);
await RequestAsync(nameof(UpdateAsync), new ClientProxyRequestTypeValue
{
{ typeof(string), providerName },
{ typeof(string), providerKey },
{ typeof(UpdateFeaturesDto), input }
});
}
}
}

@ -22,27 +22,43 @@ namespace Volo.Abp.Identity.ClientProxies
public virtual async Task<PagedResultDto<IdentityRoleDto>> GetListAsync(GetIdentityRolesInput input)
{
return await RequestAsync<PagedResultDto<IdentityRoleDto>>(nameof(GetListAsync), input);
return await RequestAsync<PagedResultDto<IdentityRoleDto>>(nameof(GetListAsync), new ClientProxyRequestTypeValue
{
{ typeof(GetIdentityRolesInput), input }
});
}
public virtual async Task<IdentityRoleDto> GetAsync(Guid id)
{
return await RequestAsync<IdentityRoleDto>(nameof(GetAsync), id);
return await RequestAsync<IdentityRoleDto>(nameof(GetAsync), new ClientProxyRequestTypeValue
{
{ typeof(Guid), id }
});
}
public virtual async Task<IdentityRoleDto> CreateAsync(IdentityRoleCreateDto input)
{
return await RequestAsync<IdentityRoleDto>(nameof(CreateAsync), input);
return await RequestAsync<IdentityRoleDto>(nameof(CreateAsync), new ClientProxyRequestTypeValue
{
{ typeof(IdentityRoleCreateDto), input }
});
}
public virtual async Task<IdentityRoleDto> UpdateAsync(Guid id, IdentityRoleUpdateDto input)
{
return await RequestAsync<IdentityRoleDto>(nameof(UpdateAsync), id, input);
return await RequestAsync<IdentityRoleDto>(nameof(UpdateAsync), new ClientProxyRequestTypeValue
{
{ typeof(Guid), id },
{ typeof(IdentityRoleUpdateDto), input }
});
}
public virtual async Task DeleteAsync(Guid id)
{
await RequestAsync(nameof(DeleteAsync), id);
await RequestAsync(nameof(DeleteAsync), new ClientProxyRequestTypeValue
{
{ typeof(Guid), id }
});
}
}
}

@ -17,32 +17,51 @@ namespace Volo.Abp.Identity.ClientProxies
{
public virtual async Task<IdentityUserDto> GetAsync(Guid id)
{
return await RequestAsync<IdentityUserDto>(nameof(GetAsync), id);
return await RequestAsync<IdentityUserDto>(nameof(GetAsync), new ClientProxyRequestTypeValue
{
{ typeof(Guid), id }
});
}
public virtual async Task<PagedResultDto<IdentityUserDto>> GetListAsync(GetIdentityUsersInput input)
{
return await RequestAsync<PagedResultDto<IdentityUserDto>>(nameof(GetListAsync), input);
return await RequestAsync<PagedResultDto<IdentityUserDto>>(nameof(GetListAsync), new ClientProxyRequestTypeValue
{
{ typeof(GetIdentityUsersInput), input }
});
}
public virtual async Task<IdentityUserDto> CreateAsync(IdentityUserCreateDto input)
{
return await RequestAsync<IdentityUserDto>(nameof(CreateAsync), input);
return await RequestAsync<IdentityUserDto>(nameof(CreateAsync), new ClientProxyRequestTypeValue
{
{ typeof(IdentityUserCreateDto), input }
});
}
public virtual async Task<IdentityUserDto> UpdateAsync(Guid id, IdentityUserUpdateDto input)
{
return await RequestAsync<IdentityUserDto>(nameof(UpdateAsync), id, input);
return await RequestAsync<IdentityUserDto>(nameof(UpdateAsync), new ClientProxyRequestTypeValue
{
{ typeof(Guid), id },
{ typeof(IdentityUserUpdateDto), input }
});
}
public virtual async Task DeleteAsync(Guid id)
{
await RequestAsync(nameof(DeleteAsync), id);
await RequestAsync(nameof(DeleteAsync), new ClientProxyRequestTypeValue
{
{ typeof(Guid), id }
});
}
public virtual async Task<ListResultDto<IdentityRoleDto>> GetRolesAsync(Guid id)
{
return await RequestAsync<ListResultDto<IdentityRoleDto>>(nameof(GetRolesAsync), id);
return await RequestAsync<ListResultDto<IdentityRoleDto>>(nameof(GetRolesAsync), new ClientProxyRequestTypeValue
{
{ typeof(Guid), id }
});
}
public virtual async Task<ListResultDto<IdentityRoleDto>> GetAssignableRolesAsync()
@ -52,17 +71,27 @@ namespace Volo.Abp.Identity.ClientProxies
public virtual async Task UpdateRolesAsync(Guid id, IdentityUserUpdateRolesDto input)
{
await RequestAsync(nameof(UpdateRolesAsync), id, input);
await RequestAsync(nameof(UpdateRolesAsync), new ClientProxyRequestTypeValue
{
{ typeof(Guid), id },
{ typeof(IdentityUserUpdateRolesDto), input }
});
}
public virtual async Task<IdentityUserDto> FindByUsernameAsync(string userName)
{
return await RequestAsync<IdentityUserDto>(nameof(FindByUsernameAsync), userName);
return await RequestAsync<IdentityUserDto>(nameof(FindByUsernameAsync), new ClientProxyRequestTypeValue
{
{ typeof(string), userName }
});
}
public virtual async Task<IdentityUserDto> FindByEmailAsync(string email)
{
return await RequestAsync<IdentityUserDto>(nameof(FindByEmailAsync), email);
return await RequestAsync<IdentityUserDto>(nameof(FindByEmailAsync), new ClientProxyRequestTypeValue
{
{ typeof(string), email }
});
}
}
}

@ -18,22 +18,34 @@ namespace Volo.Abp.Identity.ClientProxies
{
public virtual async Task<UserData> FindByIdAsync(Guid id)
{
return await RequestAsync<UserData>(nameof(FindByIdAsync), id);
return await RequestAsync<UserData>(nameof(FindByIdAsync), new ClientProxyRequestTypeValue
{
{ typeof(Guid), id }
});
}
public virtual async Task<UserData> FindByUserNameAsync(string userName)
{
return await RequestAsync<UserData>(nameof(FindByUserNameAsync), userName);
return await RequestAsync<UserData>(nameof(FindByUserNameAsync), new ClientProxyRequestTypeValue
{
{ typeof(string), userName }
});
}
public virtual async Task<ListResultDto<UserData>> SearchAsync(UserLookupSearchInputDto input)
{
return await RequestAsync<ListResultDto<UserData>>(nameof(SearchAsync), input);
return await RequestAsync<ListResultDto<UserData>>(nameof(SearchAsync), new ClientProxyRequestTypeValue
{
{ typeof(UserLookupSearchInputDto), input }
});
}
public virtual async Task<long> GetCountAsync(UserLookupCountInputDto input)
{
return await RequestAsync<long>(nameof(GetCountAsync), input);
return await RequestAsync<long>(nameof(GetCountAsync), new ClientProxyRequestTypeValue
{
{ typeof(UserLookupCountInputDto), input }
});
}
}
}

@ -22,12 +22,18 @@ namespace Volo.Abp.Identity.ClientProxies
public virtual async Task<ProfileDto> UpdateAsync(UpdateProfileDto input)
{
return await RequestAsync<ProfileDto>(nameof(UpdateAsync), input);
return await RequestAsync<ProfileDto>(nameof(UpdateAsync), new ClientProxyRequestTypeValue
{
{ typeof(UpdateProfileDto), input }
});
}
public virtual async Task ChangePasswordAsync(ChangePasswordInput input)
{
await RequestAsync(nameof(ChangePasswordAsync), input);
await RequestAsync(nameof(ChangePasswordAsync), new ClientProxyRequestTypeValue
{
{ typeof(ChangePasswordInput), input }
});
}
}
}

@ -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));

@ -17,12 +17,21 @@ namespace Volo.Abp.PermissionManagement.ClientProxies
{
public virtual async Task<GetPermissionListResultDto> GetAsync(string providerName, string providerKey)
{
return await RequestAsync<GetPermissionListResultDto>(nameof(GetAsync), providerName, providerKey);
return await RequestAsync<GetPermissionListResultDto>(nameof(GetAsync), new ClientProxyRequestTypeValue
{
{ typeof(string), providerName },
{ typeof(string), providerKey }
});
}
public virtual async Task UpdateAsync(string providerName, string providerKey, UpdatePermissionsDto input)
{
await RequestAsync(nameof(UpdateAsync), providerName, providerKey, input);
await RequestAsync(nameof(UpdateAsync), new ClientProxyRequestTypeValue
{
{ typeof(string), providerName },
{ typeof(string), providerKey },
{ typeof(UpdatePermissionsDto), input }
});
}
}
}

@ -22,7 +22,10 @@ namespace Volo.Abp.SettingManagement.ClientProxies
public virtual async Task UpdateAsync(UpdateEmailSettingsDto input)
{
await RequestAsync(nameof(UpdateAsync), input);
await RequestAsync(nameof(UpdateAsync), new ClientProxyRequestTypeValue
{
{ typeof(UpdateEmailSettingsDto), input }
});
}
}
}

@ -17,42 +17,68 @@ namespace Volo.Abp.TenantManagement.ClientProxies
{
public virtual async Task<TenantDto> GetAsync(Guid id)
{
return await RequestAsync<TenantDto>(nameof(GetAsync), id);
return await RequestAsync<TenantDto>(nameof(GetAsync), new ClientProxyRequestTypeValue
{
{ typeof(Guid), id }
});
}
public virtual async Task<PagedResultDto<TenantDto>> GetListAsync(GetTenantsInput input)
{
return await RequestAsync<PagedResultDto<TenantDto>>(nameof(GetListAsync), input);
return await RequestAsync<PagedResultDto<TenantDto>>(nameof(GetListAsync), new ClientProxyRequestTypeValue
{
{ typeof(GetTenantsInput), input }
});
}
public virtual async Task<TenantDto> CreateAsync(TenantCreateDto input)
{
return await RequestAsync<TenantDto>(nameof(CreateAsync), input);
return await RequestAsync<TenantDto>(nameof(CreateAsync), new ClientProxyRequestTypeValue
{
{ typeof(TenantCreateDto), input }
});
}
public virtual async Task<TenantDto> UpdateAsync(Guid id, TenantUpdateDto input)
{
return await RequestAsync<TenantDto>(nameof(UpdateAsync), id, input);
return await RequestAsync<TenantDto>(nameof(UpdateAsync), new ClientProxyRequestTypeValue
{
{ typeof(Guid), id },
{ typeof(TenantUpdateDto), input }
});
}
public virtual async Task DeleteAsync(Guid id)
{
await RequestAsync(nameof(DeleteAsync), id);
await RequestAsync(nameof(DeleteAsync), new ClientProxyRequestTypeValue
{
{ typeof(Guid), id }
});
}
public virtual async Task<string> GetDefaultConnectionStringAsync(Guid id)
{
return await RequestAsync<string>(nameof(GetDefaultConnectionStringAsync), id);
return await RequestAsync<string>(nameof(GetDefaultConnectionStringAsync), new ClientProxyRequestTypeValue
{
{ typeof(Guid), id }
});
}
public virtual async Task UpdateDefaultConnectionStringAsync(Guid id, string defaultConnectionString)
{
await RequestAsync(nameof(UpdateDefaultConnectionStringAsync), id, defaultConnectionString);
await RequestAsync(nameof(UpdateDefaultConnectionStringAsync), new ClientProxyRequestTypeValue
{
{ typeof(Guid), id },
{ typeof(string), defaultConnectionString }
});
}
public virtual async Task DeleteDefaultConnectionStringAsync(Guid id)
{
await RequestAsync(nameof(DeleteDefaultConnectionStringAsync), id);
await RequestAsync(nameof(DeleteDefaultConnectionStringAsync), new ClientProxyRequestTypeValue
{
{ typeof(Guid), id }
});
}
}
}

@ -10,7 +10,7 @@
"error",
{
"enforceBuildableLibDependency": true,
"allow": [],
"allow": ["@abp/**/proxy"],
"depConstraints": [
{
"sourceTag": "*",
@ -20,7 +20,7 @@
}
]
}
},
},
{
"files": ["*.ts", "*.tsx"],
"extends": ["plugin:@nrwl/nx/typescript"],

@ -31,13 +31,13 @@
"appsDir": ""
},
"projects": {
"account": {
"account-core": {
"tags": [],
"implicitDependencies": ["core", "theme-shared"]
},
"account-core": {
"account": {
"tags": [],
"implicitDependencies": ["core", "theme-shared"]
"implicitDependencies": ["core", "theme-shared", "account-core", "identity"]
},
"components": {
"tags": [],

@ -0,0 +1,7 @@
{
"$schema": "../../../node_modules/ng-packagr/ng-package.schema.json",
"dest": "../../../dist/packages/account-core/proxy",
"lib": {
"entryFile": "src/public-api.ts"
}
}

@ -0,0 +1,2 @@
export * from './proxy/account';
export * from './proxy/identity';

@ -0,0 +1,37 @@
import type { RegisterDto, ResetPasswordDto, SendPasswordResetCodeDto } from './models';
import { RestService } from '@abp/ng.core';
import { Injectable } from '@angular/core';
import type { IdentityUserDto } from '../identity/models';
@Injectable({
providedIn: 'root',
})
export class AccountService {
apiName = 'AbpAccount';
register = (input: RegisterDto) =>
this.restService.request<any, IdentityUserDto>({
method: 'POST',
url: '/api/account/register',
body: input,
},
{ apiName: this.apiName });
resetPassword = (input: ResetPasswordDto) =>
this.restService.request<any, void>({
method: 'POST',
url: '/api/account/reset-password',
body: input,
},
{ apiName: this.apiName });
sendPasswordResetCode = (input: SendPasswordResetCodeDto) =>
this.restService.request<any, void>({
method: 'POST',
url: '/api/account/send-password-reset-code',
body: input,
},
{ apiName: this.apiName });
constructor(private restService: RestService) {}
}

@ -0,0 +1,35 @@
import type { AbpLoginResult, UserLoginInfo } from './models/models';
import { RestService } from '@abp/ng.core';
import { Injectable } from '@angular/core';
@Injectable({
providedIn: 'root',
})
export class AccountService {
apiName = 'AbpAccount';
checkPasswordByLogin = (login: UserLoginInfo) =>
this.restService.request<any, AbpLoginResult>({
method: 'POST',
url: '/api/account/check-password',
body: login,
},
{ apiName: this.apiName });
loginByLogin = (login: UserLoginInfo) =>
this.restService.request<any, AbpLoginResult>({
method: 'POST',
url: '/api/account/login',
body: login,
},
{ apiName: this.apiName });
logout = () =>
this.restService.request<any, void>({
method: 'GET',
url: '/api/account/logout',
},
{ apiName: this.apiName });
constructor(private restService: RestService) {}
}

@ -4,5 +4,5 @@
"lib": {
"entryFile": "src/public-api.ts"
},
"allowedNonPeerDependencies": ["@abp/ng.theme.shared"]
"allowedNonPeerDependencies": ["@abp/ng.theme.shared", "@abp/ng.identity", "@abp/ng.account.core"]
}

@ -8,6 +8,8 @@
},
"dependencies": {
"@abp/ng.theme.shared": "~4.4.2",
"@abp/ng.identity": "~4.4.2",
"@abp/ng.account.core": "~4.4.2",
"tslib": "^2.0.0"
},
"publishConfig": {

@ -1,4 +1,4 @@
import { ProfileService } from '@abp/ng.core';
import { ProfileService } from '@abp/ng.identity/proxy';
import { getPasswordValidators, ToasterService } from '@abp/ng.theme.shared';
import { Component, Injector, OnInit } from '@angular/core';
import { FormBuilder, FormControl, FormGroup, Validators } from '@angular/forms';

@ -1,7 +1,7 @@
import { AccountService } from '@abp/ng.account.core/proxy';
import { Component } from '@angular/core';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { finalize } from 'rxjs/operators';
import { AccountService } from '../../proxy/account/account.service';
@Component({
selector: 'abp-forgot-password',

@ -1,4 +1,4 @@
import { ProfileService } from '@abp/ng.core';
import { ProfileService } from '@abp/ng.identity/proxy';
import { fadeIn } from '@abp/ng.theme.shared';
import { transition, trigger, useAnimation } from '@angular/animations';
import { Component, OnInit } from '@angular/core';

@ -1,4 +1,4 @@
import { ProfileService } from '@abp/ng.core';
import { ProfileService } from '@abp/ng.identity/proxy';
import { ToasterService } from '@abp/ng.theme.shared';
import { Component, OnInit } from '@angular/core';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';

@ -1,3 +1,4 @@
import { AccountService, RegisterDto } from '@abp/ng.account.core/proxy';
import { AuthService, ConfigStateService } from '@abp/ng.core';
import { getPasswordValidators, ToasterService } from '@abp/ng.theme.shared';
import { Component, Injector, OnInit } from '@angular/core';
@ -5,9 +6,8 @@ import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { throwError } from 'rxjs';
import { catchError, finalize, switchMap } from 'rxjs/operators';
import { eAccountComponents } from '../../enums/components';
import { AccountService } from '../../proxy/account/account.service';
import { RegisterDto } from '../../proxy/account/models';
import { getRedirectUrl } from '../../utils/auth-utils';
const { maxLength, required, email } = Validators;
@Component({

@ -1,10 +1,10 @@
import { AccountService } from '@abp/ng.account.core/proxy';
import { getPasswordValidators } from '@abp/ng.theme.shared';
import { Component, Injector, OnInit } from '@angular/core';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { ActivatedRoute, Router } from '@angular/router';
import { comparePasswords, Validation } from '@ngx-validate/core';
import { finalize } from 'rxjs/operators';
import { AccountService } from '../../proxy/account/account.service';
const PASSWORD_FIELDS = ['password', 'confirmPassword'];

@ -1,43 +0,0 @@
import type { RegisterDto, ResetPasswordDto, SendPasswordResetCodeDto } from './models';
import { RestService } from '@abp/ng.core';
import { Injectable } from '@angular/core';
import type { IdentityUserDto } from '../identity/models';
@Injectable({
providedIn: 'root',
})
export class AccountService {
apiName = 'AbpAccount';
register = (input: RegisterDto) =>
this.restService.request<any, IdentityUserDto>(
{
method: 'POST',
url: '/api/account/register',
body: input,
},
{ apiName: this.apiName },
);
resetPassword = (input: ResetPasswordDto) =>
this.restService.request<any, void>(
{
method: 'POST',
url: '/api/account/reset-password',
body: input,
},
{ apiName: this.apiName },
);
sendPasswordResetCode = (input: SendPasswordResetCodeDto) =>
this.restService.request<any, void>(
{
method: 'POST',
url: '/api/account/send-password-reset-code',
body: input,
},
{ apiName: this.apiName },
);
constructor(private restService: RestService) {}
}

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

Loading…
Cancel
Save