You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
144 lines
4.8 KiB
144 lines
4.8 KiB
3 years ago
|
using Microsoft.AspNetCore.Mvc;
|
||
|
using Sanhe.Abp.Identity.Dto;
|
||
|
using System;
|
||
|
using System.Threading.Tasks;
|
||
|
using Volo.Abp;
|
||
|
using Volo.Abp.Application.Dtos;
|
||
|
using Volo.Abp.AspNetCore.Mvc;
|
||
|
using Volo.Abp.Identity;
|
||
|
|
||
|
namespace Sanhe.Abp.Identity
|
||
|
{
|
||
|
[RemoteService(Name = IdentityRemoteServiceConsts.RemoteServiceName)]
|
||
|
[Area("identity")]
|
||
|
[ControllerName("organization-units")]
|
||
|
[Route("api/identity/organization-units")]
|
||
|
public class OrganizationUnitController : AbpController, IOrganizationUnitAppService
|
||
|
{
|
||
|
protected IOrganizationUnitAppService OrganizationUnitAppService { get; }
|
||
|
|
||
|
public OrganizationUnitController(
|
||
|
IOrganizationUnitAppService organizationUnitAppService)
|
||
|
{
|
||
|
OrganizationUnitAppService = organizationUnitAppService;
|
||
|
}
|
||
|
|
||
|
[HttpPost]
|
||
|
public virtual async Task<OrganizationUnitDto> CreateAsync(OrganizationUnitCreateDto input)
|
||
|
{
|
||
|
return await OrganizationUnitAppService.CreateAsync(input);
|
||
|
}
|
||
|
|
||
|
[HttpDelete]
|
||
|
[Route("{id}")]
|
||
|
public virtual async Task DeleteAsync(Guid id)
|
||
|
{
|
||
|
await OrganizationUnitAppService.DeleteAsync(id);
|
||
|
}
|
||
|
|
||
|
[HttpGet]
|
||
|
[Route("find-children")]
|
||
|
public virtual async Task<ListResultDto<OrganizationUnitDto>> FindChildrenAsync(OrganizationUnitGetChildrenDto input)
|
||
|
{
|
||
|
return await OrganizationUnitAppService.FindChildrenAsync(input);
|
||
|
}
|
||
|
|
||
|
[HttpGet]
|
||
|
[Route("{id}")]
|
||
|
public virtual async Task<OrganizationUnitDto> GetAsync(Guid id)
|
||
|
{
|
||
|
return await OrganizationUnitAppService.GetAsync(id);
|
||
|
}
|
||
|
|
||
|
[HttpGet]
|
||
|
[Route("root-node")]
|
||
|
public virtual async Task<ListResultDto<OrganizationUnitDto>> GetRootAsync()
|
||
|
{
|
||
|
return await OrganizationUnitAppService.GetRootAsync();
|
||
|
}
|
||
|
|
||
|
[HttpGet]
|
||
|
[Route("last-children")]
|
||
|
public virtual async Task<OrganizationUnitDto> GetLastChildOrNullAsync(Guid? parentId)
|
||
|
{
|
||
|
return await OrganizationUnitAppService.GetLastChildOrNullAsync(parentId);
|
||
|
}
|
||
|
|
||
|
[HttpGet]
|
||
|
[Route("all")]
|
||
|
public virtual async Task<ListResultDto<OrganizationUnitDto>> GetAllListAsync()
|
||
|
{
|
||
|
return await OrganizationUnitAppService.GetAllListAsync();
|
||
|
}
|
||
|
|
||
|
[HttpGet]
|
||
|
public virtual async Task<PagedResultDto<OrganizationUnitDto>> GetListAsync(OrganizationUnitGetByPagedDto input)
|
||
|
{
|
||
|
return await OrganizationUnitAppService.GetListAsync(input);
|
||
|
}
|
||
|
|
||
|
[HttpGet]
|
||
|
[Route("{id}/role-names")]
|
||
|
public virtual async Task<ListResultDto<string>> GetRoleNamesAsync(Guid id)
|
||
|
{
|
||
|
return await OrganizationUnitAppService.GetRoleNamesAsync(id);
|
||
|
}
|
||
|
|
||
|
[HttpGet]
|
||
|
[Route("{id}/unadded-roles")]
|
||
|
public virtual async Task<PagedResultDto<IdentityRoleDto>> GetUnaddedRolesAsync(Guid id, OrganizationUnitGetUnaddedRoleByPagedDto input)
|
||
|
{
|
||
|
return await OrganizationUnitAppService.GetUnaddedRolesAsync(id, input);
|
||
|
}
|
||
|
|
||
|
[HttpGet]
|
||
|
[Route("{id}/roles")]
|
||
|
public virtual async Task<PagedResultDto<IdentityRoleDto>> GetRolesAsync(Guid id, PagedAndSortedResultRequestDto input)
|
||
|
{
|
||
|
return await OrganizationUnitAppService.GetRolesAsync(id, input);
|
||
|
}
|
||
|
|
||
|
[HttpGet]
|
||
|
[Route("{id}/unadded-users")]
|
||
|
public virtual async Task<PagedResultDto<IdentityUserDto>> GetUnaddedUsersAsync(Guid id, OrganizationUnitGetUnaddedUserByPagedDto input)
|
||
|
{
|
||
|
return await OrganizationUnitAppService.GetUnaddedUsersAsync(id, input);
|
||
|
}
|
||
|
|
||
|
[HttpGet]
|
||
|
[Route("{id}/users")]
|
||
|
public virtual async Task<PagedResultDto<IdentityUserDto>> GetUsersAsync(Guid id, GetIdentityUsersInput input)
|
||
|
{
|
||
|
return await OrganizationUnitAppService.GetUsersAsync(id, input);
|
||
|
}
|
||
|
|
||
|
[HttpPost]
|
||
|
[Route("{id}/users")]
|
||
|
public virtual async Task AddUsersAsync(Guid id, OrganizationUnitAddUserDto input)
|
||
|
{
|
||
|
await OrganizationUnitAppService.AddUsersAsync(id, input);
|
||
|
}
|
||
|
|
||
|
[HttpPost]
|
||
|
[Route("{id}/roles")]
|
||
|
public virtual async Task AddRolesAsync(Guid id, OrganizationUnitAddRoleDto input)
|
||
|
{
|
||
|
await OrganizationUnitAppService.AddRolesAsync(id, input);
|
||
|
}
|
||
|
|
||
|
[HttpPut]
|
||
|
[Route("{id}/move")]
|
||
|
public virtual async Task MoveAsync(Guid id, OrganizationUnitMoveDto input)
|
||
|
{
|
||
|
await OrganizationUnitAppService.MoveAsync(id, input);
|
||
|
}
|
||
|
|
||
|
[HttpPut]
|
||
|
[Route("{id}")]
|
||
|
public virtual async Task<OrganizationUnitDto> UpdateAsync(Guid id, OrganizationUnitUpdateDto input)
|
||
|
{
|
||
|
return await OrganizationUnitAppService.UpdateAsync(id, input);
|
||
|
}
|
||
|
}
|
||
|
}
|