From 28342d4f00619517d16fc053da49c2eb006efb46 Mon Sep 17 00:00:00 2001 From: wwwk <1265346495@qq.com> Date: Fri, 6 May 2022 23:14:23 +0800 Subject: [PATCH] add identity controller summary --- .../Dto/OrganizationUnitAddUserDto.cs | 3 + .../Identity/Dto/OrganizationUnitCreateDto.cs | 7 +- .../Dto/OrganizationUnitGetChildrenDto.cs | 6 + .../Identity/IdentityClaimTypeController.cs | 43 +++++- .../Abp/Identity/IdentityRoleController.cs | 59 ++++++-- .../Abp/Identity/IdentityUserController.cs | 82 +++++++++-- .../Identity/OrganizationUnitController.cs | 128 +++++++++++++++--- 7 files changed, 279 insertions(+), 49 deletions(-) diff --git a/modules/identity/Sanhe.Abp.Identity.Application.Contracts/Sanhe/Abp/Identity/Dto/OrganizationUnitAddUserDto.cs b/modules/identity/Sanhe.Abp.Identity.Application.Contracts/Sanhe/Abp/Identity/Dto/OrganizationUnitAddUserDto.cs index c92f406..3eb3743 100644 --- a/modules/identity/Sanhe.Abp.Identity.Application.Contracts/Sanhe/Abp/Identity/Dto/OrganizationUnitAddUserDto.cs +++ b/modules/identity/Sanhe.Abp.Identity.Application.Contracts/Sanhe/Abp/Identity/Dto/OrganizationUnitAddUserDto.cs @@ -6,6 +6,9 @@ namespace Sanhe.Abp.Identity.Dto { public class OrganizationUnitAddUserDto { + /// + /// 用户Id + /// [Required] public List UserIds { get; set; } } diff --git a/modules/identity/Sanhe.Abp.Identity.Application.Contracts/Sanhe/Abp/Identity/Dto/OrganizationUnitCreateDto.cs b/modules/identity/Sanhe.Abp.Identity.Application.Contracts/Sanhe/Abp/Identity/Dto/OrganizationUnitCreateDto.cs index ed39c11..65389ef 100644 --- a/modules/identity/Sanhe.Abp.Identity.Application.Contracts/Sanhe/Abp/Identity/Dto/OrganizationUnitCreateDto.cs +++ b/modules/identity/Sanhe.Abp.Identity.Application.Contracts/Sanhe/Abp/Identity/Dto/OrganizationUnitCreateDto.cs @@ -8,10 +8,15 @@ namespace Sanhe.Abp.Identity.Dto { public class OrganizationUnitCreateDto : ExtensibleObject { + /// + /// 显示名称 + /// [Required] [DynamicStringLength(typeof(OrganizationUnitConsts), nameof(OrganizationUnitConsts.MaxDisplayNameLength))] public string DisplayName { get; set; } - + /// + /// 父Id + /// public Guid? ParentId { get; set; } } } diff --git a/modules/identity/Sanhe.Abp.Identity.Application.Contracts/Sanhe/Abp/Identity/Dto/OrganizationUnitGetChildrenDto.cs b/modules/identity/Sanhe.Abp.Identity.Application.Contracts/Sanhe/Abp/Identity/Dto/OrganizationUnitGetChildrenDto.cs index 0075777..3fa987f 100644 --- a/modules/identity/Sanhe.Abp.Identity.Application.Contracts/Sanhe/Abp/Identity/Dto/OrganizationUnitGetChildrenDto.cs +++ b/modules/identity/Sanhe.Abp.Identity.Application.Contracts/Sanhe/Abp/Identity/Dto/OrganizationUnitGetChildrenDto.cs @@ -6,8 +6,14 @@ namespace Sanhe.Abp.Identity.Dto { public class OrganizationUnitGetChildrenDto : IEntityDto { + /// + /// Id + /// [Required] public Guid Id { get; set; } + /// + /// 是否递归查询 + /// public bool Recursive { get; set; } } } diff --git a/modules/identity/Sanhe.Abp.Identity.HttpApi/Sanhe/Abp/Identity/IdentityClaimTypeController.cs b/modules/identity/Sanhe.Abp.Identity.HttpApi/Sanhe/Abp/Identity/IdentityClaimTypeController.cs index fd86f26..2adbe47 100644 --- a/modules/identity/Sanhe.Abp.Identity.HttpApi/Sanhe/Abp/Identity/IdentityClaimTypeController.cs +++ b/modules/identity/Sanhe.Abp.Identity.HttpApi/Sanhe/Abp/Identity/IdentityClaimTypeController.cs @@ -16,47 +16,78 @@ namespace Sanhe.Abp.Identity public class IdentityClaimTypeController : AbpController, IIdentityClaimTypeAppService { protected IIdentityClaimTypeAppService IdentityClaimTypeAppService { get; } + public IdentityClaimTypeController(IIdentityClaimTypeAppService identityClaimTypeAppService) { IdentityClaimTypeAppService = identityClaimTypeAppService; } + /// + /// 创建 + /// + /// + /// [HttpPost] - public virtual async Task CreateAsync(IdentityClaimTypeCreateDto input) + public async virtual Task CreateAsync(IdentityClaimTypeCreateDto input) { return await IdentityClaimTypeAppService.CreateAsync(input); } + /// + /// 删除 + /// + /// + /// [HttpDelete] [Route("{id}")] - public virtual async Task DeleteAsync(Guid id) + public async virtual Task DeleteAsync(Guid id) { await IdentityClaimTypeAppService.DeleteAsync(id); } + /// + /// 获取所有 + /// + /// [HttpGet] [Route("actived-list")] - public virtual async Task> GetAllListAsync() + public async virtual Task> GetAllListAsync() { return await IdentityClaimTypeAppService.GetAllListAsync(); } + /// + /// 根据Id获取 + /// + /// + /// [HttpGet] [Route("{id}")] - public virtual async Task GetAsync(Guid id) + public async virtual Task GetAsync(Guid id) { return await IdentityClaimTypeAppService.GetAsync(id); } + /// + /// 分页获取 + /// + /// + /// [HttpGet] - public virtual async Task> GetListAsync(IdentityClaimTypeGetByPagedDto input) + public async virtual Task> GetListAsync(IdentityClaimTypeGetByPagedDto input) { return await IdentityClaimTypeAppService.GetListAsync(input); } + /// + /// 根据Id修改 + /// + /// + /// + /// [HttpPut] [Route("{id}")] - public virtual async Task UpdateAsync(Guid id, IdentityClaimTypeUpdateDto input) + public async virtual Task UpdateAsync(Guid id, IdentityClaimTypeUpdateDto input) { return await IdentityClaimTypeAppService.UpdateAsync(id, input); } diff --git a/modules/identity/Sanhe.Abp.Identity.HttpApi/Sanhe/Abp/Identity/IdentityRoleController.cs b/modules/identity/Sanhe.Abp.Identity.HttpApi/Sanhe/Abp/Identity/IdentityRoleController.cs index dc03589..dbd2c23 100644 --- a/modules/identity/Sanhe.Abp.Identity.HttpApi/Sanhe/Abp/Identity/IdentityRoleController.cs +++ b/modules/identity/Sanhe.Abp.Identity.HttpApi/Sanhe/Abp/Identity/IdentityRoleController.cs @@ -16,31 +16,48 @@ namespace Sanhe.Abp.Identity public class IdentityRoleController : AbpController, IIdentityRoleAppService { protected IIdentityRoleAppService RoleAppService { get; } - public IdentityRoleController( - IIdentityRoleAppService roleAppService) + + public IdentityRoleController(IIdentityRoleAppService roleAppService) { RoleAppService = roleAppService; } #region OrganizationUnit + /// + /// 获取角色组织单元 + /// + /// + /// [HttpGet] [Route("{id}/organization-units")] - public virtual async Task> GetOrganizationUnitsAsync(Guid id) + public async virtual Task> GetOrganizationUnitsAsync(Guid id) { return await RoleAppService.GetOrganizationUnitsAsync(id); } + /// + /// 修改角色组织单元 + /// + /// + /// + /// [HttpPut] [Route("{id}/organization-units")] - public virtual async Task SetOrganizationUnitsAsync(Guid id, IdentityRoleAddOrRemoveOrganizationUnitDto input) + public async virtual Task SetOrganizationUnitsAsync(Guid id, IdentityRoleAddOrRemoveOrganizationUnitDto input) { await RoleAppService.SetOrganizationUnitsAsync(id, input); } + /// + /// 删除角色组织单元 + /// + /// + /// + /// [HttpDelete] [Route("{id}/organization-units/{ouId}")] - public virtual async Task RemoveOrganizationUnitsAsync(Guid id, Guid ouId) + public async virtual Task RemoveOrganizationUnitsAsync(Guid id, Guid ouId) { await RoleAppService.RemoveOrganizationUnitsAsync(id, ouId); } @@ -49,34 +66,56 @@ namespace Sanhe.Abp.Identity #region Claim + /// + /// 获取角色身份声明 + /// + /// + /// [HttpGet] [Route("{id}/claims")] - public virtual async Task> GetClaimsAsync(Guid id) + public async virtual Task> GetClaimsAsync(Guid id) { return await RoleAppService.GetClaimsAsync(id); } + /// + /// 创建角色身份声明 + /// + /// + /// + /// [HttpPost] [Route("{id}/claims")] - public virtual async Task AddClaimAsync(Guid id, IdentityRoleClaimCreateDto input) + public async virtual Task AddClaimAsync(Guid id, IdentityRoleClaimCreateDto input) { await RoleAppService.AddClaimAsync(id, input); } + /// + /// 修改角色身份声明 + /// + /// + /// + /// [HttpPut] [Route("{id}/claims")] - public virtual async Task UpdateClaimAsync(Guid id, IdentityRoleClaimUpdateDto input) + public async virtual Task UpdateClaimAsync(Guid id, IdentityRoleClaimUpdateDto input) { await RoleAppService.UpdateClaimAsync(id, input); } + /// + /// 删除角色身份声明 + /// + /// + /// + /// [HttpDelete] [Route("{id}/claims")] - public virtual async Task DeleteClaimAsync(Guid id, IdentityRoleClaimDeleteDto input) + public async virtual Task DeleteClaimAsync(Guid id, IdentityRoleClaimDeleteDto input) { await RoleAppService.DeleteClaimAsync(id, input); } - #endregion } } diff --git a/modules/identity/Sanhe.Abp.Identity.HttpApi/Sanhe/Abp/Identity/IdentityUserController.cs b/modules/identity/Sanhe.Abp.Identity.HttpApi/Sanhe/Abp/Identity/IdentityUserController.cs index 36d732c..afb29f1 100644 --- a/modules/identity/Sanhe.Abp.Identity.HttpApi/Sanhe/Abp/Identity/IdentityUserController.cs +++ b/modules/identity/Sanhe.Abp.Identity.HttpApi/Sanhe/Abp/Identity/IdentityUserController.cs @@ -16,31 +16,48 @@ namespace Sanhe.Abp.Identity public class IdentityUserController : AbpController, IIdentityUserAppService { protected IIdentityUserAppService UserAppService { get; } - public IdentityUserController( - IIdentityUserAppService userAppService) + + public IdentityUserController(IIdentityUserAppService userAppService) { UserAppService = userAppService; } #region OrganizationUnit + /// + /// 获取该用户的组织单位 + /// + /// + /// [HttpGet] [Route("{id}/organization-units")] - public virtual async Task> GetOrganizationUnitsAsync(Guid id) + public async virtual Task> GetOrganizationUnitsAsync(Guid id) { return await UserAppService.GetOrganizationUnitsAsync(id); } + /// + /// 修改该用户组织单位 + /// + /// + /// + /// [HttpPut] [Route("{id}/organization-units")] - public virtual async Task SetOrganizationUnitsAsync(Guid id, IdentityUserOrganizationUnitUpdateDto input) + public async virtual Task SetOrganizationUnitsAsync(Guid id, IdentityUserOrganizationUnitUpdateDto input) { await UserAppService.SetOrganizationUnitsAsync(id, input); } + /// + /// 删除该用户组织单位 + /// + /// + /// + /// [HttpDelete] [Route("{id}/organization-units/{ouId}")] - public virtual async Task RemoveOrganizationUnitsAsync(Guid id, Guid ouId) + public async virtual Task RemoveOrganizationUnitsAsync(Guid id, Guid ouId) { await UserAppService.RemoveOrganizationUnitsAsync(id, ouId); } @@ -49,54 +66,93 @@ namespace Sanhe.Abp.Identity #region Claim + /// + /// 获取用户身份声明 + /// + /// + /// [HttpGet] [Route("{id}/claims")] - public virtual async Task> GetClaimsAsync(Guid id) + public async virtual Task> GetClaimsAsync(Guid id) { return await UserAppService.GetClaimsAsync(id); } + /// + /// 创建用户身份声明 + /// + /// + /// + /// [HttpPost] [Route("{id}/claims")] - public virtual async Task AddClaimAsync(Guid id, IdentityUserClaimCreateDto input) + public async virtual Task AddClaimAsync(Guid id, IdentityUserClaimCreateDto input) { await UserAppService.AddClaimAsync(id, input); } + /// + /// 修改用户身份声明 + /// + /// + /// + /// [HttpPut] [Route("{id}/claims")] - public virtual async Task UpdateClaimAsync(Guid id, IdentityUserClaimUpdateDto input) + public async virtual Task UpdateClaimAsync(Guid id, IdentityUserClaimUpdateDto input) { await UserAppService.UpdateClaimAsync(id, input); } + /// + /// 删除用户身份声明 + /// + /// + /// + /// [HttpDelete] [Route("{id}/claims")] - public virtual async Task DeleteClaimAsync(Guid id, IdentityUserClaimDeleteDto input) + public async virtual Task DeleteClaimAsync(Guid id, IdentityUserClaimDeleteDto input) { await UserAppService.DeleteClaimAsync(id, input); } #endregion - + /// + /// 变更用户双因素验证选项 + /// + /// + /// + /// [HttpPut] [Route("change-two-factor")] - public virtual async Task ChangeTwoFactorEnabledAsync(Guid id, TwoFactorEnabledDto input) + public async virtual Task ChangeTwoFactorEnabledAsync(Guid id, TwoFactorEnabledDto input) { await UserAppService.ChangeTwoFactorEnabledAsync(id, input); } + /// + /// 锁定 + /// + /// 用户Id + /// 秒 + /// [HttpPut] [Route("{id}/lock/{seconds}")] - public virtual async Task LockAsync(Guid id, int seconds) + public async virtual Task LockAsync(Guid id, int seconds) { await UserAppService.LockAsync(id, seconds); } + /// + /// 解锁 + /// + /// 用户Id + /// [HttpPut] [Route("{id}/unlock")] - public virtual async Task UnLockAsync(Guid id) + public async virtual Task UnLockAsync(Guid id) { await UserAppService.UnLockAsync(id); } diff --git a/modules/identity/Sanhe.Abp.Identity.HttpApi/Sanhe/Abp/Identity/OrganizationUnitController.cs b/modules/identity/Sanhe.Abp.Identity.HttpApi/Sanhe/Abp/Identity/OrganizationUnitController.cs index 8686cfe..673018d 100644 --- a/modules/identity/Sanhe.Abp.Identity.HttpApi/Sanhe/Abp/Identity/OrganizationUnitController.cs +++ b/modules/identity/Sanhe.Abp.Identity.HttpApi/Sanhe/Abp/Identity/OrganizationUnitController.cs @@ -17,125 +17,215 @@ namespace Sanhe.Abp.Identity { protected IOrganizationUnitAppService OrganizationUnitAppService { get; } - public OrganizationUnitController( - IOrganizationUnitAppService organizationUnitAppService) + public OrganizationUnitController(IOrganizationUnitAppService organizationUnitAppService) { OrganizationUnitAppService = organizationUnitAppService; } + /// + /// 创建组织单位 + /// + /// + /// [HttpPost] - public virtual async Task CreateAsync(OrganizationUnitCreateDto input) + public async virtual Task CreateAsync(OrganizationUnitCreateDto input) { return await OrganizationUnitAppService.CreateAsync(input); } + /// + /// 删除组织单位 + /// + /// Id + /// [HttpDelete] [Route("{id}")] - public virtual async Task DeleteAsync(Guid id) + public async virtual Task DeleteAsync(Guid id) { await OrganizationUnitAppService.DeleteAsync(id); } + /// + /// 查找子单位 + /// + /// + /// [HttpGet] [Route("find-children")] - public virtual async Task> FindChildrenAsync(OrganizationUnitGetChildrenDto input) + public async virtual Task> FindChildrenAsync(OrganizationUnitGetChildrenDto input) { return await OrganizationUnitAppService.FindChildrenAsync(input); } + /// + /// 获取组织单位信息 + /// + /// Id + /// [HttpGet] [Route("{id}")] - public virtual async Task GetAsync(Guid id) + public async virtual Task GetAsync(Guid id) { return await OrganizationUnitAppService.GetAsync(id); } + /// + /// 获取根组织单位 + /// + /// [HttpGet] [Route("root-node")] - public virtual async Task> GetRootAsync() + public async virtual Task> GetRootAsync() { return await OrganizationUnitAppService.GetRootAsync(); } + /// + /// 最后一个组织节点 + /// + /// 父Id + /// [HttpGet] [Route("last-children")] - public virtual async Task GetLastChildOrNullAsync(Guid? parentId) + public async virtual Task GetLastChildOrNullAsync(Guid? parentId) { return await OrganizationUnitAppService.GetLastChildOrNullAsync(parentId); } + /// + /// 获取所有组织单位 + /// + /// [HttpGet] [Route("all")] - public virtual async Task> GetAllListAsync() + public async virtual Task> GetAllListAsync() { return await OrganizationUnitAppService.GetAllListAsync(); } + /// + /// 分页获取 + /// + /// + /// [HttpGet] - public virtual async Task> GetListAsync(OrganizationUnitGetByPagedDto input) + public async virtual Task> GetListAsync(OrganizationUnitGetByPagedDto input) { return await OrganizationUnitAppService.GetListAsync(input); } + /// + /// 获取该组织单位所有角色名称 + /// + /// Id + /// [HttpGet] [Route("{id}/role-names")] - public virtual async Task> GetRoleNamesAsync(Guid id) + public async virtual Task> GetRoleNamesAsync(Guid id) { return await OrganizationUnitAppService.GetRoleNamesAsync(id); } + /// + /// 分页获取未添加的角色 + /// + /// + /// + /// [HttpGet] [Route("{id}/unadded-roles")] - public virtual async Task> GetUnaddedRolesAsync(Guid id, OrganizationUnitGetUnaddedRoleByPagedDto input) + public async virtual Task> GetUnaddedRolesAsync(Guid id, OrganizationUnitGetUnaddedRoleByPagedDto input) { return await OrganizationUnitAppService.GetUnaddedRolesAsync(id, input); } + /// + /// 分页获取组织单位角色 + /// + /// + /// + /// [HttpGet] [Route("{id}/roles")] - public virtual async Task> GetRolesAsync(Guid id, PagedAndSortedResultRequestDto input) + public async virtual Task> GetRolesAsync(Guid id, PagedAndSortedResultRequestDto input) { return await OrganizationUnitAppService.GetRolesAsync(id, input); } + /// + /// 分页获取未添加的用户 + /// + /// + /// + /// [HttpGet] [Route("{id}/unadded-users")] - public virtual async Task> GetUnaddedUsersAsync(Guid id, OrganizationUnitGetUnaddedUserByPagedDto input) + public async virtual Task> GetUnaddedUsersAsync(Guid id, OrganizationUnitGetUnaddedUserByPagedDto input) { return await OrganizationUnitAppService.GetUnaddedUsersAsync(id, input); } + /// + /// 分页获取组织单位下用户 + /// + /// Id + /// 分页参数 + /// [HttpGet] [Route("{id}/users")] - public virtual async Task> GetUsersAsync(Guid id, GetIdentityUsersInput input) + public async virtual Task> GetUsersAsync(Guid id, GetIdentityUsersInput input) { return await OrganizationUnitAppService.GetUsersAsync(id, input); } + /// + /// 指定组织单位下添加用户 + /// + /// + /// + /// [HttpPost] [Route("{id}/users")] - public virtual async Task AddUsersAsync(Guid id, OrganizationUnitAddUserDto input) + public async virtual Task AddUsersAsync(Guid id, OrganizationUnitAddUserDto input) { await OrganizationUnitAppService.AddUsersAsync(id, input); } + /// + /// 指定组织单位下添加角色 + /// + /// + /// + /// [HttpPost] [Route("{id}/roles")] - public virtual async Task AddRolesAsync(Guid id, OrganizationUnitAddRoleDto input) + public async virtual Task AddRolesAsync(Guid id, OrganizationUnitAddRoleDto input) { await OrganizationUnitAppService.AddRolesAsync(id, input); } + /// + /// 移动 + /// + /// + /// + /// [HttpPut] [Route("{id}/move")] - public virtual async Task MoveAsync(Guid id, OrganizationUnitMoveDto input) + public async virtual Task MoveAsync(Guid id, OrganizationUnitMoveDto input) { await OrganizationUnitAppService.MoveAsync(id, input); } + /// + /// 修改组织单位信息 + /// + /// Id + /// + /// [HttpPut] [Route("{id}")] - public virtual async Task UpdateAsync(Guid id, OrganizationUnitUpdateDto input) + public async virtual Task UpdateAsync(Guid id, OrganizationUnitUpdateDto input) { return await OrganizationUnitAppService.UpdateAsync(id, input); }