//
namespace SafeCampus.Web.Core;
///
/// 业务角色管理控制器
///
[ApiDescriptionSettings(Tag = "角色管理")]
[Route("biz/organization/role")]
[RolePermission]
public class BizRoleController : IDynamicApiController
{
private readonly IResourceService _resourceService;
private readonly IRoleService _roleService;
private readonly ISysUserService _sysUserService;
public BizRoleController(IResourceService resourceService, IRoleService roleService, ISysUserService sysUserService)
{
_resourceService = resourceService;
_roleService = roleService;
_sysUserService = sysUserService;
}
///
/// 角色分页查询
///
///
///
[HttpGet("page")]
[DisplayName("角色分页查询")]
public async Task Page([FromQuery] RolePageInput input)
{
return await _roleService.Page(input);
}
///
/// 添加角色
///
///
///
[HttpPost("add")]
[DisplayName("添加角色")]
public async Task Add([FromBody] RoleAddInput input)
{
await _roleService.Add(input);
}
///
/// 修改角色
///
///
///
[HttpPost("edit")]
[DisplayName("修改角色")]
public async Task Edit([FromBody] RoleEditInput input)
{
await _roleService.Edit(input);
}
///
/// 删除角色
///
///
///
[HttpPost("delete")]
[DisplayName("删除角色")]
public async Task Delete([FromBody] BaseIdListInput input)
{
await _roleService.Delete(input);
}
///
/// 获取角色授权资源树
///
///
[HttpGet("resourceTreeSelector")]
[DisplayName("获取角色授权资源树")]
public async Task ResourceTreeSelector()
{
return await _roleService.ResourceTreeSelector();
}
///
/// 获取角色拥有资源
///
///
///
[HttpGet("ownResource")]
[DisplayName("获取角色拥有资源")]
public async Task OwnResource([FromQuery] BaseIdInput input)
{
return await _roleService.OwnResource(input, CateGoryConst.RELATION_SYS_ROLE_HAS_RESOURCE);
}
///
/// 给角色授权资源
///
///
///
[HttpPost("grantResource")]
[DisplayName("角色授权资源")]
public async Task GrantResource([FromBody] GrantResourceInput input)
{
await _roleService.GrantResource(input);
}
///
/// 获取角色下的用户
///
///
///
[HttpGet("ownUser")]
[DisplayName("获取角色下的用户")]
public async Task OwnUser([FromQuery] BaseIdInput input)
{
return await _roleService.OwnUser(input);
}
///
/// 给角色授权用户
///
///
///
[HttpPost("grantUser")]
[DisplayName("角色授权")]
public async Task GrantUser([FromBody] GrantUserInput input)
{
await _roleService.GrantUser(input);
}
///
/// 获取角色树
///
///
[HttpGet("tree")]
[DisplayName("获取角色树")]
public async Task Tree([FromQuery] RoleTreeInput input)
{
return await _roleService.Tree(input);
}
///
/// 获取角色详情
///
///
///
[HttpGet("detail")]
[DisplayName("获取角色详情")]
public async Task Detail([FromQuery] BaseIdInput input)
{
return await _roleService.Detail(input);
}
///
/// 获取角色选择器
///
///
[HttpGet("roleSelector")]
[DisplayName("获取角色选择器")]
public async Task RoleSelector([FromQuery] RoleSelectorInput input)
{
return await _roleService.RoleSelector(input);
}
}