pull/1595/head
Halil İbrahim Kalkan 6 years ago
commit 7f815461de

@ -105,6 +105,7 @@ abp add-module Volo.Blogging
* `--solution` or `-s`: Specifies the solution (.sln) file path. If not specified, CLI tries to find a .sln file in the current directory.
* `--skip-db-migrations`: For EF Core database provider, it automatically adds a new code first migration (`Add-Migration`) and updates the database (`Update-Database`) if necessary. Specify this option to skip this operation.
* `-sp` or `--startup-project`: Relative path to the project folder of the startup project. Default value is the current folder.
### update

@ -0,0 +1,12 @@
using Microsoft.AspNetCore.Cors.Infrastructure;
namespace Microsoft.AspNetCore.Cors
{
public static class AbpCorsPolicyBuilderExtensions
{
public static CorsPolicyBuilder WithAbpExposedHeaders(this CorsPolicyBuilder corsPolicyBuilder)
{
return corsPolicyBuilder.WithExposedHeaders("_AbpErrorFormat");
}
}
}

@ -32,6 +32,7 @@
<PackageReference Include="Microsoft.AspNetCore.Http" Version="2.2.2" />
<PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="2.2.0" />
<PackageReference Include="Microsoft.AspNetCore.Localization" Version="2.2.0" />
<PackageReference Include="Microsoft.AspNetCore.Cors" Version="2.2.0" />
</ItemGroup>
</Project>

@ -1,9 +0,0 @@
using Volo.Abp.Application.Dtos;
namespace Volo.Abp.Identity
{
public class GetIdentityRolesInput : PagedAndSortedResultRequestDto
{
public string Filter { get; set; }
}
}

@ -1,13 +1,21 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Application.Services;
namespace Volo.Abp.Identity
{
public interface IIdentityRoleAppService : ICrudAppService<IdentityRoleDto, Guid, GetIdentityRolesInput, IdentityRoleCreateDto, IdentityRoleUpdateDto>
public interface IIdentityRoleAppService : IApplicationService
{
//TODO: remove after a better design
Task<List<IdentityRoleDto>> GetAllListAsync();
Task<ListResultDto<IdentityRoleDto>> GetListAsync();
Task<IdentityRoleDto> CreateAsync(IdentityRoleCreateDto input);
Task<IdentityRoleDto> GetAsync(Guid id);
Task<IdentityRoleDto> UpdateAsync(Guid id, IdentityRoleUpdateDto input);
Task DeleteAsync(Guid id);
}
}

@ -31,22 +31,11 @@ namespace Volo.Abp.Identity
);
}
public async Task<PagedResultDto<IdentityRoleDto>> GetListAsync(GetIdentityRolesInput input) //TODO: Remove this method since it's not used
public async Task<ListResultDto<IdentityRoleDto>> GetListAsync()
{
var count = (int) await _roleRepository.GetCountAsync();
var list = await _roleRepository.GetListAsync();
return new PagedResultDto<IdentityRoleDto>(
count,
ObjectMapper.Map<List<IdentityRole>, List<IdentityRoleDto>>(list)
);
}
public async Task<List<IdentityRoleDto>> GetAllListAsync() //TODO: Rename to GetList (however it's not possible because of the design of the IAsyncCrudAppService)
{
var list = await _roleRepository.GetListAsync();
return ObjectMapper.Map<List<IdentityRole>, List<IdentityRoleDto>>(list);
return new ListResultDto<IdentityRoleDto>(ObjectMapper.Map<List<IdentityRole>, List<IdentityRoleDto>>(list));
}
[Authorize(IdentityPermissions.Roles.Create)]

@ -1,5 +1,4 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Volo.Abp.Application.Dtos;
@ -21,16 +20,16 @@ namespace Volo.Abp.Identity
}
[HttpGet]
[Route("{id}")]
public virtual Task<IdentityRoleDto> GetAsync(Guid id)
public virtual Task<ListResultDto<IdentityRoleDto>> GetListAsync()
{
return _roleAppService.GetAsync(id);
return _roleAppService.GetListAsync();
}
[HttpGet]
public virtual Task<PagedResultDto<IdentityRoleDto>> GetListAsync(GetIdentityRolesInput input)
[Route("{id}")]
public virtual Task<IdentityRoleDto> GetAsync(Guid id)
{
return _roleAppService.GetListAsync(input);
return _roleAppService.GetAsync(id);
}
[HttpPost]
@ -52,12 +51,5 @@ namespace Volo.Abp.Identity
{
return _roleAppService.DeleteAsync(id);
}
[HttpGet]
[Route("all")]
public virtual Task<List<IdentityRoleDto>> GetAllListAsync()
{
return _roleAppService.GetAllListAsync();
}
}
}

@ -14,6 +14,9 @@
var _dataTable = _$table.DataTable(abp.libs.datatables.normalizeConfiguration({
order: [[1, "asc"]],
searching:false,
paging:false,
info:false,
ajax: abp.libs.datatables.createAjax(_identityRoleAppService.getList),
columnDefs: [
{

@ -28,9 +28,9 @@ namespace Volo.Abp.Identity.Web.Pages.Identity.Users
{
UserInfo = new UserInfoViewModel();
var roleDtoList = await _identityRoleAppService.GetAllListAsync();
var roleDtoList = await _identityRoleAppService.GetListAsync();
Roles = ObjectMapper.Map<List<IdentityRoleDto>, AssignedRoleViewModel[]>(roleDtoList);
Roles = ObjectMapper.Map<IReadOnlyList<IdentityRoleDto>, AssignedRoleViewModel[]>(roleDtoList.Items);
foreach (var role in Roles)
{

@ -30,8 +30,8 @@ namespace Volo.Abp.Identity.Web.Pages.Identity.Users
{
UserInfo = ObjectMapper.Map<IdentityUserDto, UserInfoViewModel>(await _identityUserAppService.GetAsync(id));
Roles = ObjectMapper.Map<List<IdentityRoleDto>, AssignedRoleViewModel[]>(
await _identityRoleAppService.GetAllListAsync()
Roles = ObjectMapper.Map<IReadOnlyList<IdentityRoleDto>, AssignedRoleViewModel[]>(
(await _identityRoleAppService.GetListAsync()).Items
);
var userRoleNames = (await _identityUserAppService.GetRolesAsync(UserInfo.Id)).Items.Select(r => r.Name).ToList();

@ -38,11 +38,10 @@ namespace Volo.Abp.Identity
{
//Act
var result = await _roleAppService.GetListAsync(new GetIdentityRolesInput());
var result = await _roleAppService.GetListAsync();
//Assert
result.TotalCount.ShouldBeGreaterThan(0);
result.Items.Count.ShouldBeGreaterThan(0);
}

@ -2,6 +2,7 @@
using System.IO;
using System.Linq;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Cors;
using Microsoft.AspNetCore.DataProtection;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
@ -134,6 +135,7 @@ namespace MyCompanyName.MyProjectName
.Select(o => o.RemovePostFix("/"))
.ToArray()
)
.WithAbpExposedHeaders()
.SetIsOriginAllowedToAllowWildcardSubdomains()
.AllowAnyHeader()
.AllowAnyMethod()

@ -3,6 +3,7 @@ using System.IO;
using System.Linq;
using System.Net.Http;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Cors;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
@ -133,6 +134,7 @@ namespace MyCompanyName.MyProjectName
.Select(o => o.RemovePostFix("/"))
.ToArray()
)
.WithAbpExposedHeaders()
.SetIsOriginAllowedToAllowWildcardSubdomains()
.AllowAnyHeader()
.AllowAnyMethod()

@ -3,6 +3,7 @@ using System.IO;
using System.Linq;
using Localization.Resources.AbpUi;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Cors;
using Microsoft.AspNetCore.DataProtection;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.DependencyInjection;
@ -114,6 +115,7 @@ namespace MyCompanyName.MyProjectName
.Select(o => o.RemovePostFix("/"))
.ToArray()
)
.WithAbpExposedHeaders()
.SetIsOriginAllowedToAllowWildcardSubdomains()
.AllowAnyHeader()
.AllowAnyMethod()

Loading…
Cancel
Save