mirror of https://github.com/abpframework/abp.git
11 changed files with 152 additions and 25 deletions
@ -1,28 +1,15 @@ |
|||||
using System; |
using Microsoft.Extensions.DependencyInjection; |
||||
using Microsoft.Extensions.DependencyInjection; |
|
||||
using Volo.Abp.AspNetCore.Mvc; |
using Volo.Abp.AspNetCore.Mvc; |
||||
using Volo.Abp.Modularity; |
using Volo.Abp.Modularity; |
||||
|
|
||||
namespace Volo.Abp.Identity |
namespace Volo.Abp.Identity |
||||
{ |
{ |
||||
[DependsOn(typeof(AbpIdentityApplicationModule), typeof(AbpAspNetCoreMvcModule))] |
[DependsOn(typeof(AbpIdentityApplicationContractsModule), typeof(AbpAspNetCoreMvcModule))] |
||||
public class AbpIdentityHttpApiModule : AbpModule |
public class AbpIdentityHttpApiModule : AbpModule |
||||
{ |
{ |
||||
public override void ConfigureServices(IServiceCollection services) |
public override void ConfigureServices(IServiceCollection services) |
||||
{ |
{ |
||||
services.AddAssemblyOf<AbpIdentityHttpApiModule>(); |
services.AddAssemblyOf<AbpIdentityHttpApiModule>(); |
||||
|
|
||||
services.Configure<AbpAspNetCoreMvcOptions>(options => |
|
||||
{ |
|
||||
options.ConventionalControllers.Create( |
|
||||
typeof(AbpIdentityApplicationModule).Assembly, |
|
||||
opts => |
|
||||
{ |
|
||||
opts.RootPath = "identity"; |
|
||||
opts.UrlControllerNameNormalizer = context => context.ControllerName.RemovePreFix("Identity"); |
|
||||
} |
|
||||
); |
|
||||
}); |
|
||||
} |
} |
||||
} |
} |
||||
} |
} |
||||
@ -0,0 +1,65 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Threading.Tasks; |
||||
|
using Microsoft.AspNetCore.Mvc; |
||||
|
using Volo.Abp.Application.Dtos; |
||||
|
using Volo.Abp.Application.Services; |
||||
|
using Volo.Abp.DependencyInjection; |
||||
|
using Volo.Abp.Permissions; |
||||
|
|
||||
|
namespace Volo.Abp.Identity |
||||
|
{ |
||||
|
[RemoteService] |
||||
|
[Area("identity")] |
||||
|
[Controller] |
||||
|
[ControllerName("Role")] |
||||
|
public class IdentityRoleController : IIdentityRoleAppService, ITransientDependency |
||||
|
{ |
||||
|
private readonly IIdentityRoleAppService _roleAppService; |
||||
|
|
||||
|
public IdentityRoleController(IIdentityRoleAppService roleAppService) |
||||
|
{ |
||||
|
_roleAppService = roleAppService; |
||||
|
} |
||||
|
|
||||
|
public virtual Task<IdentityRoleDto> GetAsync(Guid id) |
||||
|
{ |
||||
|
return _roleAppService.GetAsync(id); |
||||
|
} |
||||
|
|
||||
|
public virtual Task<PagedResultDto<IdentityRoleDto>> GetListAsync(GetIdentityRolesInput input) |
||||
|
{ |
||||
|
return _roleAppService.GetListAsync(input); |
||||
|
} |
||||
|
|
||||
|
public virtual Task<IdentityRoleDto> CreateAsync(IdentityRoleCreateDto input) |
||||
|
{ |
||||
|
return _roleAppService.CreateAsync(input); |
||||
|
} |
||||
|
|
||||
|
public virtual Task<IdentityRoleDto> UpdateAsync(Guid id, IdentityRoleUpdateDto input) |
||||
|
{ |
||||
|
return _roleAppService.UpdateAsync(id, input); |
||||
|
} |
||||
|
|
||||
|
public virtual Task DeleteAsync(Guid id) |
||||
|
{ |
||||
|
return _roleAppService.DeleteAsync(id); |
||||
|
} |
||||
|
|
||||
|
public virtual Task<List<IdentityRoleDto>> GetAllListAsync() |
||||
|
{ |
||||
|
return _roleAppService.GetAllListAsync(); |
||||
|
} |
||||
|
|
||||
|
public virtual Task<GetPermissionListResultDto> GetPermissionsAsync(Guid id) |
||||
|
{ |
||||
|
return _roleAppService.GetPermissionsAsync(id); |
||||
|
} |
||||
|
|
||||
|
public virtual Task UpdatePermissionsAsync(Guid id, UpdatePermissionsDto input) |
||||
|
{ |
||||
|
return _roleAppService.UpdatePermissionsAsync(id, input); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,69 @@ |
|||||
|
using System; |
||||
|
using System.Threading.Tasks; |
||||
|
using Microsoft.AspNetCore.Mvc; |
||||
|
using Volo.Abp.Application.Dtos; |
||||
|
using Volo.Abp.Application.Services; |
||||
|
using Volo.Abp.DependencyInjection; |
||||
|
using Volo.Abp.Permissions; |
||||
|
|
||||
|
namespace Volo.Abp.Identity |
||||
|
{ |
||||
|
[RemoteService] |
||||
|
[Area("identity")] |
||||
|
[Controller] |
||||
|
[ControllerName("User")] |
||||
|
public class IdentityUserController : IIdentityUserAppService, ITransientDependency //TODO: Try to implement these type wrapper controllers automatically!
|
||||
|
{ |
||||
|
private readonly IIdentityUserAppService _userAppService; |
||||
|
|
||||
|
public IdentityUserController(IIdentityUserAppService userAppService) |
||||
|
{ |
||||
|
_userAppService = userAppService; |
||||
|
} |
||||
|
|
||||
|
public virtual Task<IdentityUserDto> GetAsync(Guid id) |
||||
|
{ |
||||
|
return _userAppService.GetAsync(id); |
||||
|
} |
||||
|
|
||||
|
public virtual Task<PagedResultDto<IdentityUserDto>> GetListAsync(GetIdentityUsersInput input) |
||||
|
{ |
||||
|
return _userAppService.GetListAsync(input); |
||||
|
} |
||||
|
|
||||
|
public virtual Task<IdentityUserDto> CreateAsync(IdentityUserCreateDto input) |
||||
|
{ |
||||
|
return _userAppService.CreateAsync(input); |
||||
|
} |
||||
|
|
||||
|
public virtual Task<IdentityUserDto> UpdateAsync(Guid id, IdentityUserUpdateDto input) |
||||
|
{ |
||||
|
return _userAppService.UpdateAsync(id, input); |
||||
|
} |
||||
|
|
||||
|
public virtual Task DeleteAsync(Guid id) |
||||
|
{ |
||||
|
return _userAppService.DeleteAsync(id); |
||||
|
} |
||||
|
|
||||
|
public virtual Task<ListResultDto<IdentityRoleDto>> GetRolesAsync(Guid id) |
||||
|
{ |
||||
|
return _userAppService.GetRolesAsync(id); |
||||
|
} |
||||
|
|
||||
|
public virtual Task UpdateRolesAsync(Guid id, IdentityUserUpdateRolesDto input) |
||||
|
{ |
||||
|
return _userAppService.UpdateRolesAsync(id, input); |
||||
|
} |
||||
|
|
||||
|
public virtual Task<GetPermissionListResultDto> GetPermissionsAsync(Guid id) |
||||
|
{ |
||||
|
return _userAppService.GetPermissionsAsync(id); |
||||
|
} |
||||
|
|
||||
|
public virtual Task UpdatePermissionsAsync(Guid id, UpdatePermissionsDto input) |
||||
|
{ |
||||
|
return _userAppService.UpdatePermissionsAsync(id, input); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
Loading…
Reference in new issue