完善登录
This commit is contained in:
@@ -16,7 +16,7 @@ TemplateFactory templateFactory = new();
|
||||
//List<string> entityNames = new() { "Banner" };
|
||||
string modelName = "Identity";
|
||||
string nameSpaces = "Yi.RBAC";
|
||||
List<string> entityNames = new() { "User" };
|
||||
List<string> entityNames = new() { "_" };
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
global using Yi.Framework.Core.Attributes;
|
||||
global using Yi.Framework.Core.Helper;
|
||||
global using Yi.Framework.Core.Model;
|
||||
global using Yi.Framework.Core.Model;
|
||||
global using Yi.Framework.Core.Exceptions;
|
||||
@@ -1,3 +1,4 @@
|
||||
global using Yi.Framework.Core.Attributes;
|
||||
global using Yi.Framework.Core.Helper;
|
||||
global using Yi.Framework.Core.Model;
|
||||
global using Yi.Framework.Core.Model;
|
||||
global using Yi.Framework.Core.Exceptions;
|
||||
@@ -4,25 +4,55 @@
|
||||
<name>Yi.RBAC.Application.Contracts</name>
|
||||
</assembly>
|
||||
<members>
|
||||
<member name="T:Yi.RBAC.Application.Contracts.Identity.Dtos.DeptCreateInputVo">
|
||||
<summary>
|
||||
Dept输入创建对象
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Yi.RBAC.Application.Contracts.Identity.Dtos.MenuCreateInputVo">
|
||||
<summary>
|
||||
Menu输入创建对象
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Yi.RBAC.Application.Contracts.Identity.Dtos.PostCreateInputVo">
|
||||
<summary>
|
||||
Post输入创建对象
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Yi.RBAC.Application.Contracts.Identity.Dtos.RoleCreateInputVo">
|
||||
<summary>
|
||||
Role输入创建对象
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Yi.RBAC.Application.Contracts.Identity.Dtos.UserCreateInputVo">
|
||||
<summary>
|
||||
User输入创建对象
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Yi.RBAC.Application.Contracts.Identity.IDeptService">
|
||||
<summary>
|
||||
Dept服务抽象
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Yi.RBAC.Application.Contracts.Identity.IMenuService">
|
||||
<summary>
|
||||
Menu服务抽象
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Yi.RBAC.Application.Contracts.Identity.IPostService">
|
||||
<summary>
|
||||
Post服务抽象
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Yi.RBAC.Application.Contracts.Identity.IRoleService">
|
||||
<summary>
|
||||
Role服务抽象
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Yi.RBAC.Application.Contracts.Identity.IUserService">
|
||||
<summary>
|
||||
User服务抽象
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Yi.RBAC.Application.Contracts.School.Dtos.StudentCreateInputVo">
|
||||
<summary>
|
||||
Student输入创建对象
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Yi.RBAC.Application.Contracts.School.IStudentService">
|
||||
<summary>
|
||||
Student
|
||||
</summary>
|
||||
</member>
|
||||
</members>
|
||||
</doc>
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Yi.RBAC.Application.Contracts.Identity.Dtos
|
||||
{
|
||||
/// <summary>
|
||||
/// Dept输入创建对象
|
||||
/// </summary>
|
||||
public class DeptCreateInputVo
|
||||
{
|
||||
public long Id { get; set; }
|
||||
public DateTime CreationTime { get; set; } = DateTime.Now;
|
||||
public long? CreatorId { get; set; }
|
||||
public bool State { get; set; }
|
||||
public string DeptName { get; set; }=string.Empty;
|
||||
public string DeptCode { get; set; } = string.Empty;
|
||||
public string? Leader { get; set; }
|
||||
public long ParentId { get; set; }
|
||||
public string? Remark { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Ddd.Dtos;
|
||||
|
||||
namespace Yi.RBAC.Application.Contracts.Identity.Dtos
|
||||
{
|
||||
public class DeptGetListInputVo : PagedAndSortedResultRequestDto
|
||||
{
|
||||
public long Id { get; set; }
|
||||
public DateTime CreationTime { get; set; } = DateTime.Now;
|
||||
public long? CreatorId { get; set; }
|
||||
public bool State { get; set; }
|
||||
public string DeptName { get; set; }=string.Empty;
|
||||
public string DeptCode { get; set; } = string.Empty;
|
||||
public string? Leader { get; set; }
|
||||
public long ParentId { get; set; }
|
||||
public string? Remark { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Ddd.Dtos;
|
||||
|
||||
namespace Yi.RBAC.Application.Contracts.Identity.Dtos
|
||||
{
|
||||
public class DeptGetListOutputDto : IEntityDto<long>
|
||||
{
|
||||
public long Id { get; set; }
|
||||
public DateTime CreationTime { get; set; } = DateTime.Now;
|
||||
public long? CreatorId { get; set; }
|
||||
public bool State { get; set; }
|
||||
public string DeptName { get; set; }=string.Empty;
|
||||
public string DeptCode { get; set; } = string.Empty;
|
||||
public string? Leader { get; set; }
|
||||
public long ParentId { get; set; }
|
||||
public string? Remark { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Ddd.Dtos;
|
||||
|
||||
namespace Yi.RBAC.Application.Contracts.Identity.Dtos
|
||||
{
|
||||
public class DeptGetOutputDto : IEntityDto<long>
|
||||
{
|
||||
public long Id { get; set; }
|
||||
public DateTime CreationTime { get; set; } = DateTime.Now;
|
||||
public long? CreatorId { get; set; }
|
||||
public bool State { get; set; }
|
||||
public string DeptName { get; set; }=string.Empty;
|
||||
public string DeptCode { get; set; } = string.Empty;
|
||||
public string? Leader { get; set; }
|
||||
public long ParentId { get; set; }
|
||||
public string? Remark { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Yi.RBAC.Application.Contracts.Identity.Dtos
|
||||
{
|
||||
public class DeptUpdateInputVo
|
||||
{
|
||||
public long Id { get; set; }
|
||||
public DateTime CreationTime { get; set; } = DateTime.Now;
|
||||
public long? CreatorId { get; set; }
|
||||
public bool State { get; set; }
|
||||
public string DeptName { get; set; }=string.Empty;
|
||||
public string DeptCode { get; set; } = string.Empty;
|
||||
public string? Leader { get; set; }
|
||||
public long ParentId { get; set; }
|
||||
public string? Remark { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.RBAC.Domain.Shared.Identity.EnumClasses;
|
||||
|
||||
namespace Yi.RBAC.Application.Contracts.Identity.Dtos
|
||||
{
|
||||
/// <summary>
|
||||
/// Menu输入创建对象
|
||||
/// </summary>
|
||||
public class MenuCreateInputVo
|
||||
{
|
||||
public long Id { get; set; }
|
||||
public DateTime CreationTime { get; set; } = DateTime.Now;
|
||||
public long? CreatorId { get; set; }
|
||||
public bool State { get; set; }
|
||||
public string MenuName { get; set; } = string.Empty;
|
||||
public MenuTypeEnum MenuType { get; set; } = MenuTypeEnum.Menu;
|
||||
public string? PermissionCode { get; set; }
|
||||
public long ParentId { get; set; }
|
||||
public string? MenuIcon { get; set; }
|
||||
public string? Router { get; set; }
|
||||
public bool IsLink { get; set; }
|
||||
public bool IsCache { get; set; }
|
||||
public bool IsShow { get; set; } = true;
|
||||
public string? Remark { get; set; }
|
||||
public string? Component { get; set; }
|
||||
public string? Query { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Ddd.Dtos;
|
||||
using Yi.RBAC.Domain.Shared.Identity.EnumClasses;
|
||||
|
||||
namespace Yi.RBAC.Application.Contracts.Identity.Dtos
|
||||
{
|
||||
public class MenuGetListInputVo : PagedAndSortedResultRequestDto
|
||||
{
|
||||
public long Id { get; set; }
|
||||
public DateTime CreationTime { get; set; } = DateTime.Now;
|
||||
public long? CreatorId { get; set; }
|
||||
public bool State { get; set; }
|
||||
public string MenuName { get; set; } = string.Empty;
|
||||
public MenuTypeEnum MenuType { get; set; } = MenuTypeEnum.Menu;
|
||||
public string? PermissionCode { get; set; }
|
||||
public long ParentId { get; set; }
|
||||
public string? MenuIcon { get; set; }
|
||||
public string? Router { get; set; }
|
||||
public bool IsLink { get; set; }
|
||||
public bool IsCache { get; set; }
|
||||
public bool IsShow { get; set; } = true;
|
||||
public string? Remark { get; set; }
|
||||
public string? Component { get; set; }
|
||||
public string? Query { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Ddd.Dtos;
|
||||
using Yi.RBAC.Domain.Shared.Identity.EnumClasses;
|
||||
|
||||
namespace Yi.RBAC.Application.Contracts.Identity.Dtos
|
||||
{
|
||||
public class MenuGetListOutputDto : IEntityDto<long>
|
||||
{
|
||||
public long Id { get; set; }
|
||||
public DateTime CreationTime { get; set; } = DateTime.Now;
|
||||
public long? CreatorId { get; set; }
|
||||
public bool State { get; set; }
|
||||
public string MenuName { get; set; } = string.Empty;
|
||||
public MenuTypeEnum MenuType { get; set; } = MenuTypeEnum.Menu;
|
||||
public string? PermissionCode { get; set; }
|
||||
public long ParentId { get; set; }
|
||||
public string? MenuIcon { get; set; }
|
||||
public string? Router { get; set; }
|
||||
public bool IsLink { get; set; }
|
||||
public bool IsCache { get; set; }
|
||||
public bool IsShow { get; set; } = true;
|
||||
public string? Remark { get; set; }
|
||||
public string? Component { get; set; }
|
||||
public string? Query { get; set; }
|
||||
//public List<MenuEntity>? Children { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Ddd.Dtos;
|
||||
using Yi.RBAC.Domain.Shared.Identity.EnumClasses;
|
||||
|
||||
namespace Yi.RBAC.Application.Contracts.Identity.Dtos
|
||||
{
|
||||
public class MenuGetOutputDto : IEntityDto<long>
|
||||
{
|
||||
public long Id { get; set; }
|
||||
public DateTime CreationTime { get; set; } = DateTime.Now;
|
||||
public long? CreatorId { get; set; }
|
||||
public bool State { get; set; }
|
||||
public string MenuName { get; set; } = string.Empty;
|
||||
public MenuTypeEnum MenuType { get; set; } = MenuTypeEnum.Menu;
|
||||
public string? PermissionCode { get; set; }
|
||||
public long ParentId { get; set; }
|
||||
public string? MenuIcon { get; set; }
|
||||
public string? Router { get; set; }
|
||||
public bool IsLink { get; set; }
|
||||
public bool IsCache { get; set; }
|
||||
public bool IsShow { get; set; } = true;
|
||||
public string? Remark { get; set; }
|
||||
public string? Component { get; set; }
|
||||
public string? Query { get; set; }
|
||||
//public List<MenuEntity>? Children { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.RBAC.Domain.Shared.Identity.EnumClasses;
|
||||
|
||||
namespace Yi.RBAC.Application.Contracts.Identity.Dtos
|
||||
{
|
||||
public class MenuUpdateInputVo
|
||||
{
|
||||
public long Id { get; set; }
|
||||
public DateTime CreationTime { get; set; } = DateTime.Now;
|
||||
public long? CreatorId { get; set; }
|
||||
public bool State { get; set; }
|
||||
public string MenuName { get; set; } = string.Empty;
|
||||
public MenuTypeEnum MenuType { get; set; } = MenuTypeEnum.Menu;
|
||||
public string? PermissionCode { get; set; }
|
||||
public long ParentId { get; set; }
|
||||
public string? MenuIcon { get; set; }
|
||||
public string? Router { get; set; }
|
||||
public bool IsLink { get; set; }
|
||||
public bool IsCache { get; set; }
|
||||
public bool IsShow { get; set; } = true;
|
||||
public string? Remark { get; set; }
|
||||
public string? Component { get; set; }
|
||||
public string? Query { get; set; }
|
||||
//public List<MenuEntity>? Children { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Yi.RBAC.Application.Contracts.Identity.Dtos
|
||||
{
|
||||
/// <summary>
|
||||
/// Post输入创建对象
|
||||
/// </summary>
|
||||
public class PostCreateInputVo
|
||||
{
|
||||
public long Id { get; set; }
|
||||
public DateTime CreationTime { get; set; } = DateTime.Now;
|
||||
public long? CreatorId { get; set; }
|
||||
public bool State { get; set; }
|
||||
public string PostCode { get; set; }=string.Empty;
|
||||
public string PostName { get; set; } = string.Empty;
|
||||
public string? Remark { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Ddd.Dtos;
|
||||
|
||||
namespace Yi.RBAC.Application.Contracts.Identity.Dtos
|
||||
{
|
||||
public class PostGetListInputVo : PagedAndSortedResultRequestDto
|
||||
{
|
||||
public long Id { get; set; }
|
||||
public DateTime CreationTime { get; set; } = DateTime.Now;
|
||||
public long? CreatorId { get; set; }
|
||||
public bool State { get; set; }
|
||||
public string PostCode { get; set; }=string.Empty;
|
||||
public string PostName { get; set; } = string.Empty;
|
||||
public string? Remark { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Ddd.Dtos;
|
||||
|
||||
namespace Yi.RBAC.Application.Contracts.Identity.Dtos
|
||||
{
|
||||
public class PostGetListOutputDto : IEntityDto<long>
|
||||
{
|
||||
public long Id { get; set; }
|
||||
public DateTime CreationTime { get; set; } = DateTime.Now;
|
||||
public long? CreatorId { get; set; }
|
||||
public bool State { get; set; }
|
||||
public string PostCode { get; set; }=string.Empty;
|
||||
public string PostName { get; set; } = string.Empty;
|
||||
public string? Remark { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Ddd.Dtos;
|
||||
|
||||
namespace Yi.RBAC.Application.Contracts.Identity.Dtos
|
||||
{
|
||||
public class PostGetOutputDto : IEntityDto<long>
|
||||
{
|
||||
public long Id { get; set; }
|
||||
public DateTime CreationTime { get; set; } = DateTime.Now;
|
||||
public long? CreatorId { get; set; }
|
||||
public bool State { get; set; }
|
||||
public string PostCode { get; set; }=string.Empty;
|
||||
public string PostName { get; set; } = string.Empty;
|
||||
public string? Remark { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Yi.RBAC.Application.Contracts.Identity.Dtos
|
||||
{
|
||||
public class PostUpdateInputVo
|
||||
{
|
||||
public long Id { get; set; }
|
||||
public DateTime CreationTime { get; set; } = DateTime.Now;
|
||||
public long? CreatorId { get; set; }
|
||||
public bool State { get; set; }
|
||||
public string PostCode { get; set; }=string.Empty;
|
||||
public string PostName { get; set; } = string.Empty;
|
||||
public string? Remark { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.RBAC.Domain.Shared.Identity.EnumClasses;
|
||||
|
||||
namespace Yi.RBAC.Application.Contracts.Identity.Dtos
|
||||
{
|
||||
/// <summary>
|
||||
/// Role输入创建对象
|
||||
/// </summary>
|
||||
public class RoleCreateInputVo
|
||||
{
|
||||
public long Id { get; set; }
|
||||
public DateTime CreationTime { get; set; } = DateTime.Now;
|
||||
public long? CreatorId { get; set; }
|
||||
public string? RoleName { get; set; }
|
||||
public string? RoleCode { get; set; }
|
||||
public string? Remark { get; set; }
|
||||
public DataScopeEnum DataScope { get; set; } = DataScopeEnum.ALL;
|
||||
public bool State { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Ddd.Dtos;
|
||||
using Yi.RBAC.Domain.Shared.Identity.EnumClasses;
|
||||
|
||||
namespace Yi.RBAC.Application.Contracts.Identity.Dtos
|
||||
{
|
||||
public class RoleGetListInputVo : PagedAndSortedResultRequestDto
|
||||
{
|
||||
public long Id { get; set; }
|
||||
public DateTime CreationTime { get; set; } = DateTime.Now;
|
||||
public long? CreatorId { get; set; }
|
||||
public string? RoleName { get; set; }
|
||||
public string? RoleCode { get; set; }
|
||||
public string? Remark { get; set; }
|
||||
public DataScopeEnum DataScope { get; set; } = DataScopeEnum.ALL;
|
||||
public bool State { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Ddd.Dtos;
|
||||
using Yi.RBAC.Domain.Shared.Identity.EnumClasses;
|
||||
|
||||
namespace Yi.RBAC.Application.Contracts.Identity.Dtos
|
||||
{
|
||||
public class RoleGetListOutputDto : IEntityDto<long>
|
||||
{
|
||||
public long Id { get; set; }
|
||||
public DateTime CreationTime { get; set; } = DateTime.Now;
|
||||
public long? CreatorId { get; set; }
|
||||
public string? RoleName { get; set; }
|
||||
public string? RoleCode { get; set; }
|
||||
public string? Remark { get; set; }
|
||||
public DataScopeEnum DataScope { get; set; } = DataScopeEnum.ALL;
|
||||
public bool State { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Ddd.Dtos;
|
||||
using Yi.RBAC.Domain.Shared.Identity.EnumClasses;
|
||||
|
||||
namespace Yi.RBAC.Application.Contracts.Identity.Dtos
|
||||
{
|
||||
public class RoleGetOutputDto : IEntityDto<long>
|
||||
{
|
||||
public long Id { get; set; }
|
||||
public DateTime CreationTime { get; set; } = DateTime.Now;
|
||||
public long? CreatorId { get; set; }
|
||||
public string? RoleName { get; set; }
|
||||
public string? RoleCode { get; set; }
|
||||
public string? Remark { get; set; }
|
||||
public DataScopeEnum DataScope { get; set; } = DataScopeEnum.ALL;
|
||||
public bool State { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.RBAC.Domain.Shared.Identity.EnumClasses;
|
||||
|
||||
namespace Yi.RBAC.Application.Contracts.Identity.Dtos
|
||||
{
|
||||
public class RoleUpdateInputVo
|
||||
{
|
||||
public long Id { get; set; }
|
||||
public DateTime CreationTime { get; set; } = DateTime.Now;
|
||||
public long? CreatorId { get; set; }
|
||||
public string? RoleName { get; set; }
|
||||
public string? RoleCode { get; set; }
|
||||
public string? Remark { get; set; }
|
||||
public DataScopeEnum DataScope { get; set; } = DataScopeEnum.ALL;
|
||||
public bool State { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -12,23 +12,20 @@ namespace Yi.RBAC.Application.Contracts.Identity.Dtos
|
||||
/// </summary>
|
||||
public class UserCreateInputVo
|
||||
{
|
||||
public long Id { get; set; }
|
||||
public string? Name { get; set; }
|
||||
public int? Age { get; set; }
|
||||
public string UserName { get; set; } = string.Empty;
|
||||
public string Password { get; set; } = string.Empty;
|
||||
public string Salt { get; set; } = string.Empty;
|
||||
public string? Icon { get; set; }
|
||||
public string? Nick { get; set; }
|
||||
public string? Email { get; set; }
|
||||
public string? Ip { get; set; }
|
||||
public string? Address { get; set; }
|
||||
public long? Phone { get; set; }
|
||||
public string? Introduction { get; set; }
|
||||
public string? Remark { get; set; }
|
||||
public SexEnum Sex { get; set; } = SexEnum.Unknown;
|
||||
public List<long>? RoleIds { get; set; }
|
||||
public List<long>? PostIds { get; set; }
|
||||
public long? DeptId { get; set; }
|
||||
public DateTime CreationTime { get; set; } = DateTime.Now;
|
||||
public long? CreatorId { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,5 +27,7 @@ namespace Yi.RBAC.Application.Contracts.Identity.Dtos
|
||||
public long? DeptId { get; set; }
|
||||
public DateTime CreationTime { get; set; } = DateTime.Now;
|
||||
public long? CreatorId { get; set; }
|
||||
|
||||
public bool State { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.RBAC.Application.Contracts.Identity.Dtos;
|
||||
using Yi.Framework.Ddd.Services.Abstract;
|
||||
|
||||
namespace Yi.RBAC.Application.Contracts.Identity
|
||||
{
|
||||
/// <summary>
|
||||
/// Dept服务抽象
|
||||
/// </summary>
|
||||
public interface IDeptService : ICrudAppService<DeptGetOutputDto, DeptGetListOutputDto, long, DeptGetListInputVo, DeptCreateInputVo, DeptUpdateInputVo>
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.RBAC.Application.Contracts.Identity.Dtos;
|
||||
using Yi.Framework.Ddd.Services.Abstract;
|
||||
|
||||
namespace Yi.RBAC.Application.Contracts.Identity
|
||||
{
|
||||
/// <summary>
|
||||
/// Menu服务抽象
|
||||
/// </summary>
|
||||
public interface IMenuService : ICrudAppService<MenuGetOutputDto, MenuGetListOutputDto, long, MenuGetListInputVo, MenuCreateInputVo, MenuUpdateInputVo>
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.RBAC.Application.Contracts.Identity.Dtos;
|
||||
using Yi.Framework.Ddd.Services.Abstract;
|
||||
|
||||
namespace Yi.RBAC.Application.Contracts.Identity
|
||||
{
|
||||
/// <summary>
|
||||
/// Post服务抽象
|
||||
/// </summary>
|
||||
public interface IPostService : ICrudAppService<PostGetOutputDto, PostGetListOutputDto, long, PostGetListInputVo, PostCreateInputVo, PostUpdateInputVo>
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.RBAC.Application.Contracts.Identity.Dtos;
|
||||
using Yi.Framework.Ddd.Services.Abstract;
|
||||
|
||||
namespace Yi.RBAC.Application.Contracts.Identity
|
||||
{
|
||||
/// <summary>
|
||||
/// Role服务抽象
|
||||
/// </summary>
|
||||
public interface IRoleService : ICrudAppService<RoleGetOutputDto, RoleGetListOutputDto, long, RoleGetListInputVo, RoleCreateInputVo, RoleUpdateInputVo>
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Ddd.Dtos;
|
||||
|
||||
namespace Yi.RBAC.Application.Contracts.School.Dtos
|
||||
{
|
||||
public class StudentGetOutputDto : IEntityDto<long>
|
||||
{
|
||||
public long Id { get; set; }
|
||||
public string Name { get; set; }
|
||||
public int? Height { get; set; }
|
||||
public string? Phone { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Yi.RBAC.Application.Contracts.School.Dtos
|
||||
{
|
||||
/// <summary>
|
||||
/// Student输入创建对象
|
||||
/// </summary>
|
||||
public class StudentCreateInputVo
|
||||
{
|
||||
public long Id { get; set; }
|
||||
public string Name { get; set; }
|
||||
public int? Height { get; set; }
|
||||
public string? Phone { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Ddd.Dtos;
|
||||
|
||||
namespace Yi.RBAC.Application.Contracts.School.Dtos
|
||||
{
|
||||
public class StudentGetListInputVo : PagedAndSortedResultRequestDto
|
||||
{
|
||||
public long Id { get; set; }
|
||||
public string Name { get; set; }
|
||||
public int? Height { get; set; }
|
||||
public string? Phone { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Ddd.Dtos;
|
||||
|
||||
namespace Yi.RBAC.Application.Contracts.School.Dtos
|
||||
{
|
||||
public class StudentGetListOutputDto : IEntityDto<long>
|
||||
{
|
||||
public long Id { get; set; }
|
||||
public string Name { get; set; }
|
||||
public int? Height { get; set; }
|
||||
public string? Phone { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Yi.RBAC.Application.Contracts.School.Dtos
|
||||
{
|
||||
public class StudentUpdateInputVo
|
||||
{
|
||||
public long Id { get; set; }
|
||||
public string Name { get; set; }
|
||||
public int? Height { get; set; }
|
||||
public string? Phone { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.RBAC.Application.Contracts.School.Dtos;
|
||||
using Yi.Framework.Ddd.Services.Abstract;
|
||||
|
||||
namespace Yi.RBAC.Application.Contracts.School
|
||||
{
|
||||
/// <summary>
|
||||
/// Student
|
||||
/// </summary>
|
||||
public interface IStudentService : ICrudAppService<StudentGetOutputDto, StudentGetListOutputDto, long, StudentGetListInputVo, StudentCreateInputVo, StudentUpdateInputVo>
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -11,15 +11,38 @@
|
||||
<param name="input"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="T:Yi.RBAC.Application.Identity.DeptService">
|
||||
<summary>
|
||||
Dept服务实现
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Yi.RBAC.Application.Identity.MenuService">
|
||||
<summary>
|
||||
Menu服务实现
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Yi.RBAC.Application.Identity.PostService">
|
||||
<summary>
|
||||
Post服务实现
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Yi.RBAC.Application.Identity.RoleService">
|
||||
<summary>
|
||||
Role服务实现
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Yi.RBAC.Application.Identity.UserService">
|
||||
<summary>
|
||||
User服务实现
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Yi.RBAC.Application.School.StudentService">
|
||||
<member name="M:Yi.RBAC.Application.Identity.UserService.CreateAsync(Yi.RBAC.Application.Contracts.Identity.Dtos.UserCreateInputVo)">
|
||||
<summary>
|
||||
Student服务实现
|
||||
添加用户
|
||||
</summary>
|
||||
<param name="input"></param>
|
||||
<returns></returns>
|
||||
<exception cref="T:Yi.Framework.Core.Exceptions.UserFriendlyException"></exception>
|
||||
</member>
|
||||
</members>
|
||||
</doc>
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace Yi.RBAC.Application.Identity
|
||||
[Autowired]
|
||||
private ICurrentUser _currentUser { get; set; }
|
||||
[Autowired]
|
||||
private UserManager _userManager { get; set; }
|
||||
private AccountManager _accountManager { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 登录
|
||||
@@ -38,16 +38,18 @@ namespace Yi.RBAC.Application.Identity
|
||||
{
|
||||
UserEntity user = new();
|
||||
//登录成功
|
||||
await _userManager.LoginValidationAsync(input.UserName, input.Password, x => user = x);
|
||||
await _accountManager.LoginValidationAsync(input.UserName, input.Password, x => user = x);
|
||||
|
||||
//获取用户信息
|
||||
var userInfo = await _userRepository.GetUserAllInfoAsync(user.Id);
|
||||
|
||||
//发送令牌
|
||||
var claimDic = new Dictionary<string, object>();
|
||||
claimDic.Add(nameof(ICurrentUser.Id), 123456);
|
||||
if (userInfo.PermissionCodes.Count == 0)
|
||||
{
|
||||
throw new UserFriendlyException(UserConst.用户无权限分配);
|
||||
}
|
||||
|
||||
var token = _jwtTokenManager.CreateToken(claimDic);
|
||||
//创建token
|
||||
var token = _jwtTokenManager.CreateToken(_accountManager.UserInfoToClaim(userInfo));
|
||||
return token;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
using Yi.RBAC.Application.Contracts.Identity;
|
||||
using NET.AutoWebApi.Setting;
|
||||
using Yi.RBAC.Application.Contracts.Identity.Dtos;
|
||||
using Yi.RBAC.Domain.Identity.Entities;
|
||||
using Yi.Framework.Ddd.Services;
|
||||
|
||||
namespace Yi.RBAC.Application.Identity
|
||||
{
|
||||
/// <summary>
|
||||
/// Dept服务实现
|
||||
/// </summary>
|
||||
[AppService]
|
||||
public class DeptService : CrudAppService<DeptEntity, DeptGetOutputDto, DeptGetListOutputDto, long, DeptGetListInputVo, DeptCreateInputVo, DeptUpdateInputVo>,
|
||||
IDeptService, IAutoApiService
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
using AutoMapper;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.RBAC.Application.Contracts.Identity.Dtos;
|
||||
using Yi.RBAC.Domain.Identity.Entities;
|
||||
|
||||
namespace Yi.RBAC.Application.Identity.MapperConfig
|
||||
{
|
||||
public class DeptProfile: Profile
|
||||
{
|
||||
public DeptProfile()
|
||||
{
|
||||
CreateMap<DeptGetListInputVo, DeptEntity>();
|
||||
CreateMap<DeptCreateInputVo, DeptEntity>();
|
||||
CreateMap<DeptUpdateInputVo, DeptEntity>();
|
||||
CreateMap<DeptEntity, DeptGetListOutputDto>();
|
||||
CreateMap<DeptEntity, DeptGetOutputDto>();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
using AutoMapper;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.RBAC.Application.Contracts.Identity.Dtos;
|
||||
using Yi.RBAC.Domain.Identity.Entities;
|
||||
|
||||
namespace Yi.RBAC.Application.Identity.MapperConfig
|
||||
{
|
||||
public class MenuProfile: Profile
|
||||
{
|
||||
public MenuProfile()
|
||||
{
|
||||
CreateMap<MenuGetListInputVo, MenuEntity>();
|
||||
CreateMap<MenuCreateInputVo, MenuEntity>();
|
||||
CreateMap<MenuUpdateInputVo, MenuEntity>();
|
||||
CreateMap<MenuEntity, MenuGetListOutputDto>();
|
||||
CreateMap<MenuEntity, MenuGetOutputDto>();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
using AutoMapper;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.RBAC.Application.Contracts.Identity.Dtos;
|
||||
using Yi.RBAC.Domain.Identity.Entities;
|
||||
|
||||
namespace Yi.RBAC.Application.Identity.MapperConfig
|
||||
{
|
||||
public class PostProfile: Profile
|
||||
{
|
||||
public PostProfile()
|
||||
{
|
||||
CreateMap<PostGetListInputVo, PostEntity>();
|
||||
CreateMap<PostCreateInputVo, PostEntity>();
|
||||
CreateMap<PostUpdateInputVo, PostEntity>();
|
||||
CreateMap<PostEntity, PostGetListOutputDto>();
|
||||
CreateMap<PostEntity, PostGetOutputDto>();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
using AutoMapper;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.RBAC.Application.Contracts.Identity.Dtos;
|
||||
using Yi.RBAC.Domain.Identity.Entities;
|
||||
|
||||
namespace Yi.RBAC.Application.Identity.MapperConfig
|
||||
{
|
||||
public class RoleProfile: Profile
|
||||
{
|
||||
public RoleProfile()
|
||||
{
|
||||
CreateMap<RoleGetListInputVo, RoleEntity>();
|
||||
CreateMap<RoleCreateInputVo, RoleEntity>();
|
||||
CreateMap<RoleUpdateInputVo, RoleEntity>();
|
||||
CreateMap<RoleEntity, RoleGetListOutputDto>();
|
||||
CreateMap<RoleEntity, RoleGetOutputDto>();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
using Yi.RBAC.Application.Contracts.Identity;
|
||||
using NET.AutoWebApi.Setting;
|
||||
using Yi.RBAC.Application.Contracts.Identity.Dtos;
|
||||
using Yi.RBAC.Domain.Identity.Entities;
|
||||
using Yi.Framework.Ddd.Services;
|
||||
|
||||
namespace Yi.RBAC.Application.Identity
|
||||
{
|
||||
/// <summary>
|
||||
/// Menu服务实现
|
||||
/// </summary>
|
||||
[AppService]
|
||||
public class MenuService : CrudAppService<MenuEntity, MenuGetOutputDto, MenuGetListOutputDto, long, MenuGetListInputVo, MenuCreateInputVo, MenuUpdateInputVo>,
|
||||
IMenuService, IAutoApiService
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
using Yi.RBAC.Application.Contracts.Identity;
|
||||
using NET.AutoWebApi.Setting;
|
||||
using Yi.RBAC.Application.Contracts.Identity.Dtos;
|
||||
using Yi.RBAC.Domain.Identity.Entities;
|
||||
using Yi.Framework.Ddd.Services;
|
||||
|
||||
namespace Yi.RBAC.Application.Identity
|
||||
{
|
||||
/// <summary>
|
||||
/// Post服务实现
|
||||
/// </summary>
|
||||
[AppService]
|
||||
public class PostService : CrudAppService<PostEntity, PostGetOutputDto, PostGetListOutputDto, long, PostGetListInputVo, PostCreateInputVo, PostUpdateInputVo>,
|
||||
IPostService, IAutoApiService
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
using Yi.RBAC.Application.Contracts.Identity;
|
||||
using NET.AutoWebApi.Setting;
|
||||
using Yi.RBAC.Application.Contracts.Identity.Dtos;
|
||||
using Yi.RBAC.Domain.Identity.Entities;
|
||||
using Yi.Framework.Ddd.Services;
|
||||
|
||||
namespace Yi.RBAC.Application.Identity
|
||||
{
|
||||
/// <summary>
|
||||
/// Role服务实现
|
||||
/// </summary>
|
||||
[AppService]
|
||||
public class RoleService : CrudAppService<RoleEntity, RoleGetOutputDto, RoleGetListOutputDto, long, RoleGetListInputVo, RoleCreateInputVo, RoleUpdateInputVo>,
|
||||
IRoleService, IAutoApiService
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,9 @@ using NET.AutoWebApi.Setting;
|
||||
using Yi.RBAC.Application.Contracts.Identity.Dtos;
|
||||
using Yi.RBAC.Domain.Identity.Entities;
|
||||
using Yi.Framework.Ddd.Services;
|
||||
using Yi.RBAC.Domain.Shared.Identity.ConstClasses;
|
||||
using Yi.RBAC.Domain.Identity;
|
||||
using Yi.Framework.Uow;
|
||||
|
||||
namespace Yi.RBAC.Application.Identity
|
||||
{
|
||||
@@ -13,5 +16,41 @@ namespace Yi.RBAC.Application.Identity
|
||||
public class UserService : CrudAppService<UserEntity, UserGetOutputDto, UserGetListOutputDto, long, UserGetListInputVo, UserCreateInputVo, UserUpdateInputVo>,
|
||||
IUserService, IAutoApiService
|
||||
{
|
||||
[Autowired]
|
||||
private UserManager _userManager { get; set; }
|
||||
|
||||
[Autowired]
|
||||
private IUnitOfWorkManager _unitOfWorkManager { get; set; }
|
||||
/// <summary>
|
||||
/// 添加用户
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="UserFriendlyException"></exception>
|
||||
public async override Task<UserGetOutputDto> CreateAsync(UserCreateInputVo input)
|
||||
{
|
||||
if (string.IsNullOrEmpty(input.Password))
|
||||
{
|
||||
throw new UserFriendlyException(UserConst.添加失败_密码为空);
|
||||
}
|
||||
if (await _repository.IsAnyAsync(u => input.UserName.Equals(u.UserName)))
|
||||
{
|
||||
throw new UserFriendlyException(UserConst.添加失败_用户存在);
|
||||
}
|
||||
var entities = await MapToEntityAsync(input);
|
||||
|
||||
entities.BuildPassword();
|
||||
|
||||
using (var uow = _unitOfWorkManager.CreateContext())
|
||||
{
|
||||
var returnEntity = await _repository.InsertReturnEntityAsync(entities);
|
||||
await _userManager.GiveUserSetRoleAsync(new List<long> { returnEntity.Id }, input.RoleIds);
|
||||
await _userManager.GiveUserSetPostAsync(new List<long> { returnEntity.Id }, input.PostIds);
|
||||
uow.Commit();
|
||||
|
||||
var result = await MapToGetOutputDtoAsync(returnEntity);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
using AutoMapper;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.RBAC.Application.Contracts.School.Dtos;
|
||||
using Yi.RBAC.Domain.School.Entities;
|
||||
|
||||
namespace Yi.RBAC.Application.School.MapperConfig
|
||||
{
|
||||
public class StudentProfile: Profile
|
||||
{
|
||||
public StudentProfile()
|
||||
{
|
||||
CreateMap<StudentGetListInputVo, StudentEntity>();
|
||||
CreateMap<StudentCreateInputVo, StudentEntity>();
|
||||
CreateMap<StudentUpdateInputVo, StudentEntity>();
|
||||
CreateMap<StudentEntity, StudentGetListOutputDto>();
|
||||
CreateMap<StudentEntity, StudentGetOutputDto>();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
using Yi.RBAC.Application.Contracts.School;
|
||||
using NET.AutoWebApi.Setting;
|
||||
using Yi.RBAC.Application.Contracts.School.Dtos;
|
||||
using Yi.RBAC.Domain.School.Entities;
|
||||
using Yi.Framework.Ddd.Services;
|
||||
|
||||
namespace Yi.RBAC.Application.School
|
||||
{
|
||||
/// <summary>
|
||||
/// Student服务实现
|
||||
/// </summary>
|
||||
[AppService]
|
||||
public class StudentService : CrudAppService<StudentEntity, StudentGetOutputDto, StudentGetListOutputDto, long, StudentGetListInputVo, StudentCreateInputVo, StudentUpdateInputVo>,
|
||||
IStudentService, IAutoApiService
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Yi.RBAC.Domain.Shared.Identity.ConstClasses
|
||||
{
|
||||
/// <summary>
|
||||
/// 常量定义
|
||||
/// </summary>
|
||||
|
||||
public class DeptConst
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Yi.RBAC.Domain.Shared.Identity.ConstClasses
|
||||
{
|
||||
/// <summary>
|
||||
/// 常量定义
|
||||
/// </summary>
|
||||
|
||||
public class MenuConst
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Yi.RBAC.Domain.Shared.Identity.ConstClasses
|
||||
{
|
||||
/// <summary>
|
||||
/// 常量定义
|
||||
/// </summary>
|
||||
|
||||
public class PostConst
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Yi.RBAC.Domain.Shared.Identity.ConstClasses
|
||||
{
|
||||
/// <summary>
|
||||
/// 常量定义
|
||||
/// </summary>
|
||||
|
||||
public class RoleConst
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -14,5 +14,12 @@ namespace Yi.RBAC.Domain.Shared.Identity.ConstClasses
|
||||
{
|
||||
public const string 登录失败_错误 = "登录失败!用户名或密码错误!";
|
||||
public const string 登录失败_不存在 = "登录失败!用户名不存在!";
|
||||
public const string 添加失败_密码为空 = "密码为空,添加失败!";
|
||||
public const string 添加失败_用户存在 = "用户已经存在,添加失败!";
|
||||
public const string 用户无权限分配 = "登录禁用!该用户分配无任何权限,无意义登录!";
|
||||
|
||||
public const string Admin = "cc";
|
||||
public const string AdminRolesCode = "admin";
|
||||
public const string AdminPermissionCode = "*:*:*";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Yi.RBAC.Domain.Shared.Identity.Dtos
|
||||
{
|
||||
public class UserRoleMenuDto
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using static Yi.Framework.Core.Helper.TreeHelper;
|
||||
|
||||
namespace Yi.RBAC.Domain.Shared.Identity.Dtos
|
||||
{
|
||||
public class Vue3RouterDto : ITreeModel<Vue3RouterDto>
|
||||
{
|
||||
public long Id { get; set; }
|
||||
public long ParentId { get; set; }
|
||||
public int OrderNum { get; set; }
|
||||
|
||||
public string Name { get; set; } = string.Empty;
|
||||
public string Path { get; set; } = string.Empty;
|
||||
public bool Hidden { get; set; }
|
||||
public string Redirect { get; set; } = string.Empty;
|
||||
public string Component { get; set; } = string.Empty;
|
||||
public bool AlwaysShow { get; set; }
|
||||
public Meta Meta { get; set; } = new Meta();
|
||||
public List<Vue3RouterDto>? Children { get; set; }
|
||||
}
|
||||
|
||||
|
||||
public class Meta
|
||||
{
|
||||
public string Title { get; set; } = string.Empty;
|
||||
public string Icon { get; set; } = string.Empty;
|
||||
public bool NoCache { get; set; }
|
||||
public string link { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Yi.RBAC.Domain.Shared.Identity.EnumClasses
|
||||
{
|
||||
public enum DataScopeEnum
|
||||
{
|
||||
ALL = 0,
|
||||
CUSTOM = 1,
|
||||
DEPT = 2,
|
||||
DEPT_FOLLOW = 3,
|
||||
USER = 4
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Yi.RBAC.Domain.Shared.Identity.EnumClasses
|
||||
{
|
||||
public enum MenuTypeEnum
|
||||
{
|
||||
Catalogue = 0, //目录
|
||||
Menu = 1, //菜单
|
||||
Component = 2//组件
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,387 @@
|
||||
<name>Yi.RBAC.Domain</name>
|
||||
</assembly>
|
||||
<members>
|
||||
<member name="T:Yi.RBAC.Domain.Identity.AccountManager">
|
||||
<summary>
|
||||
用户领域服务
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Yi.RBAC.Domain.Identity.AccountManager.LoginValidationAsync(System.String,System.String,System.Action{Yi.RBAC.Domain.Identity.Entities.UserEntity})">
|
||||
<summary>
|
||||
登录效验
|
||||
</summary>
|
||||
<param name="userName"></param>
|
||||
<param name="password"></param>
|
||||
<param name="userAction"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:Yi.RBAC.Domain.Identity.AccountManager.ExistAsync(System.String,System.Action{Yi.RBAC.Domain.Identity.Entities.UserEntity})">
|
||||
<summary>
|
||||
判断账户合法存在
|
||||
</summary>
|
||||
<param name="userName"></param>
|
||||
<param name="userAction"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:Yi.RBAC.Domain.Identity.AccountManager.UserInfoToClaim(Yi.RBAC.Domain.Identity.Dtos.UserRoleMenuDto)">
|
||||
<summary>
|
||||
令牌转换
|
||||
</summary>
|
||||
<param name="dto"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="T:Yi.RBAC.Domain.Identity.Entities.DeptEntity">
|
||||
<summary>
|
||||
部门表
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Yi.RBAC.Domain.Identity.Entities.DeptEntity.Id">
|
||||
<summary>
|
||||
主键
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Yi.RBAC.Domain.Identity.Entities.DeptEntity.IsDeleted">
|
||||
<summary>
|
||||
逻辑删除
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Yi.RBAC.Domain.Identity.Entities.DeptEntity.CreationTime">
|
||||
<summary>
|
||||
创建时间
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Yi.RBAC.Domain.Identity.Entities.DeptEntity.CreatorId">
|
||||
<summary>
|
||||
创建者
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Yi.RBAC.Domain.Identity.Entities.DeptEntity.LastModifierId">
|
||||
<summary>
|
||||
最后修改者
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Yi.RBAC.Domain.Identity.Entities.DeptEntity.LastModificationTime">
|
||||
<summary>
|
||||
最后修改时间
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Yi.RBAC.Domain.Identity.Entities.DeptEntity.OrderNum">
|
||||
<summary>
|
||||
排序
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Yi.RBAC.Domain.Identity.Entities.DeptEntity.State">
|
||||
<summary>
|
||||
状态
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Yi.RBAC.Domain.Identity.Entities.DeptEntity.DeptName">
|
||||
<summary>
|
||||
部门名称
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Yi.RBAC.Domain.Identity.Entities.DeptEntity.DeptCode">
|
||||
<summary>
|
||||
部门编码
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Yi.RBAC.Domain.Identity.Entities.DeptEntity.Leader">
|
||||
<summary>
|
||||
负责人
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Yi.RBAC.Domain.Identity.Entities.DeptEntity.ParentId">
|
||||
<summary>
|
||||
父级id
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Yi.RBAC.Domain.Identity.Entities.DeptEntity.Remark">
|
||||
<summary>
|
||||
描述
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Yi.RBAC.Domain.Identity.Entities.MenuEntity">
|
||||
<summary>
|
||||
菜单表
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Yi.RBAC.Domain.Identity.Entities.MenuEntity.Id">
|
||||
<summary>
|
||||
主键
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Yi.RBAC.Domain.Identity.Entities.MenuEntity.IsDeleted">
|
||||
<summary>
|
||||
逻辑删除
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Yi.RBAC.Domain.Identity.Entities.MenuEntity.CreationTime">
|
||||
<summary>
|
||||
创建时间
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Yi.RBAC.Domain.Identity.Entities.MenuEntity.CreatorId">
|
||||
<summary>
|
||||
创建者
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Yi.RBAC.Domain.Identity.Entities.MenuEntity.LastModifierId">
|
||||
<summary>
|
||||
最后修改者
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Yi.RBAC.Domain.Identity.Entities.MenuEntity.LastModificationTime">
|
||||
<summary>
|
||||
最后修改时间
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Yi.RBAC.Domain.Identity.Entities.MenuEntity.OrderNum">
|
||||
<summary>
|
||||
排序
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Yi.RBAC.Domain.Identity.Entities.MenuEntity.State">
|
||||
<summary>
|
||||
状态
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Yi.RBAC.Domain.Identity.Entities.MenuEntity.MenuName">
|
||||
<summary>
|
||||
菜单名
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Yi.RBAC.Domain.Identity.Entities.MenuEntity.MenuType">
|
||||
<summary>
|
||||
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Yi.RBAC.Domain.Identity.Entities.MenuEntity.PermissionCode">
|
||||
<summary>
|
||||
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Yi.RBAC.Domain.Identity.Entities.MenuEntity.ParentId">
|
||||
<summary>
|
||||
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Yi.RBAC.Domain.Identity.Entities.MenuEntity.MenuIcon">
|
||||
<summary>
|
||||
菜单图标
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Yi.RBAC.Domain.Identity.Entities.MenuEntity.Router">
|
||||
<summary>
|
||||
菜单组件路由
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Yi.RBAC.Domain.Identity.Entities.MenuEntity.IsLink">
|
||||
<summary>
|
||||
是否为外部链接
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Yi.RBAC.Domain.Identity.Entities.MenuEntity.IsCache">
|
||||
<summary>
|
||||
是否缓存
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Yi.RBAC.Domain.Identity.Entities.MenuEntity.IsShow">
|
||||
<summary>
|
||||
是否显示
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Yi.RBAC.Domain.Identity.Entities.MenuEntity.Remark">
|
||||
<summary>
|
||||
描述
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Yi.RBAC.Domain.Identity.Entities.MenuEntity.Component">
|
||||
<summary>
|
||||
组件路径
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Yi.RBAC.Domain.Identity.Entities.MenuEntity.Query">
|
||||
<summary>
|
||||
路由参数
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Yi.RBAC.Domain.Identity.Entities.MenuEntityExtensions">
|
||||
<summary>
|
||||
实体扩展
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Yi.RBAC.Domain.Identity.Entities.MenuEntityExtensions.Vue3RouterBuild(System.Collections.Generic.List{Yi.RBAC.Domain.Identity.Entities.MenuEntity})">
|
||||
<summary>
|
||||
构建vue3路由
|
||||
</summary>
|
||||
<param name="menus"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="T:Yi.RBAC.Domain.Identity.Entities.PostEntity">
|
||||
<summary>
|
||||
岗位表
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Yi.RBAC.Domain.Identity.Entities.PostEntity.Id">
|
||||
<summary>
|
||||
主键
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Yi.RBAC.Domain.Identity.Entities.PostEntity.IsDeleted">
|
||||
<summary>
|
||||
逻辑删除
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Yi.RBAC.Domain.Identity.Entities.PostEntity.CreationTime">
|
||||
<summary>
|
||||
创建时间
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Yi.RBAC.Domain.Identity.Entities.PostEntity.CreatorId">
|
||||
<summary>
|
||||
创建者
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Yi.RBAC.Domain.Identity.Entities.PostEntity.LastModifierId">
|
||||
<summary>
|
||||
最后修改者
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Yi.RBAC.Domain.Identity.Entities.PostEntity.LastModificationTime">
|
||||
<summary>
|
||||
最后修改时间
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Yi.RBAC.Domain.Identity.Entities.PostEntity.OrderNum">
|
||||
<summary>
|
||||
排序
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Yi.RBAC.Domain.Identity.Entities.PostEntity.State">
|
||||
<summary>
|
||||
状态
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Yi.RBAC.Domain.Identity.Entities.PostEntity.PostCode">
|
||||
<summary>
|
||||
岗位编码
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Yi.RBAC.Domain.Identity.Entities.PostEntity.PostName">
|
||||
<summary>
|
||||
岗位名称
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Yi.RBAC.Domain.Identity.Entities.PostEntity.Remark">
|
||||
<summary>
|
||||
描述
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Yi.RBAC.Domain.Identity.Entities.RoleDeptEntity">
|
||||
<summary>
|
||||
角色部门关系表
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Yi.RBAC.Domain.Identity.Entities.RoleDeptEntity.Id">
|
||||
<summary>
|
||||
主键
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Yi.RBAC.Domain.Identity.Entities.RoleDeptEntity.RoleId">
|
||||
<summary>
|
||||
角色id
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Yi.RBAC.Domain.Identity.Entities.RoleDeptEntity.DeptId">
|
||||
<summary>
|
||||
部门id
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Yi.RBAC.Domain.Identity.Entities.RoleEntity">
|
||||
<summary>
|
||||
角色表
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Yi.RBAC.Domain.Identity.Entities.RoleEntity.Id">
|
||||
<summary>
|
||||
主键
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Yi.RBAC.Domain.Identity.Entities.RoleEntity.IsDeleted">
|
||||
<summary>
|
||||
逻辑删除
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Yi.RBAC.Domain.Identity.Entities.RoleEntity.CreationTime">
|
||||
<summary>
|
||||
创建时间
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Yi.RBAC.Domain.Identity.Entities.RoleEntity.CreatorId">
|
||||
<summary>
|
||||
创建者
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Yi.RBAC.Domain.Identity.Entities.RoleEntity.LastModifierId">
|
||||
<summary>
|
||||
最后修改者
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Yi.RBAC.Domain.Identity.Entities.RoleEntity.LastModificationTime">
|
||||
<summary>
|
||||
最后修改时间
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Yi.RBAC.Domain.Identity.Entities.RoleEntity.OrderNum">
|
||||
<summary>
|
||||
排序
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Yi.RBAC.Domain.Identity.Entities.RoleEntity.RoleName">
|
||||
<summary>
|
||||
角色名
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Yi.RBAC.Domain.Identity.Entities.RoleEntity.RoleCode">
|
||||
<summary>
|
||||
角色编码
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Yi.RBAC.Domain.Identity.Entities.RoleEntity.Remark">
|
||||
<summary>
|
||||
描述
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Yi.RBAC.Domain.Identity.Entities.RoleEntity.DataScope">
|
||||
<summary>
|
||||
角色数据范围
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Yi.RBAC.Domain.Identity.Entities.RoleEntity.State">
|
||||
<summary>
|
||||
状态
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Yi.RBAC.Domain.Identity.Entities.RoleMenuEntity">
|
||||
<summary>
|
||||
角色菜单关系表
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Yi.RBAC.Domain.Identity.Entities.RoleMenuEntity.Id">
|
||||
<summary>
|
||||
主键
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Yi.RBAC.Domain.Identity.Entities.RoleMenuEntity.RoleId">
|
||||
<summary>
|
||||
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Yi.RBAC.Domain.Identity.Entities.RoleMenuEntity.MenuId">
|
||||
<summary>
|
||||
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Yi.RBAC.Domain.Identity.Entities.UserEntity">
|
||||
<summary>
|
||||
用户表
|
||||
@@ -119,6 +500,78 @@
|
||||
排序
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Yi.RBAC.Domain.Identity.Entities.UserEntity.State">
|
||||
<summary>
|
||||
状态
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Yi.RBAC.Domain.Identity.Entities.UserEntity.Roles">
|
||||
<summary>
|
||||
角色
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Yi.RBAC.Domain.Identity.Entities.UserEntity.Posts">
|
||||
<summary>
|
||||
岗位
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Yi.RBAC.Domain.Identity.Entities.UserEntity.Dept">
|
||||
<summary>
|
||||
部门
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Yi.RBAC.Domain.Identity.Entities.UserEntity.BuildPassword(System.String)">
|
||||
<summary>
|
||||
构建密码,MD5盐值加密
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Yi.RBAC.Domain.Identity.Entities.UserEntity.JudgePassword(System.String)">
|
||||
<summary>
|
||||
判断密码和加密后的密码是否相同
|
||||
</summary>
|
||||
<param name="password"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="T:Yi.RBAC.Domain.Identity.Entities.UserPostEntity">
|
||||
<summary>
|
||||
用户岗位表
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Yi.RBAC.Domain.Identity.Entities.UserPostEntity.Id">
|
||||
<summary>
|
||||
主键
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Yi.RBAC.Domain.Identity.Entities.UserPostEntity.UserId">
|
||||
<summary>
|
||||
用户id
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Yi.RBAC.Domain.Identity.Entities.UserPostEntity.PostId">
|
||||
<summary>
|
||||
岗位id
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Yi.RBAC.Domain.Identity.Entities.UserRoleEntity">
|
||||
<summary>
|
||||
用户角色关系表
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Yi.RBAC.Domain.Identity.Entities.UserRoleEntity.Id">
|
||||
<summary>
|
||||
主键
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Yi.RBAC.Domain.Identity.Entities.UserRoleEntity.RoleId">
|
||||
<summary>
|
||||
角色id
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Yi.RBAC.Domain.Identity.Entities.UserRoleEntity.UserId">
|
||||
<summary>
|
||||
用户id
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Yi.RBAC.Domain.Identity.Repositories.IUserRepository.GetUserAllInfoAsync(System.Int64)">
|
||||
<summary>
|
||||
获取当前登录用户的所有信息
|
||||
@@ -126,26 +579,20 @@
|
||||
<param name="userId"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="T:Yi.RBAC.Domain.Identity.UserManager">
|
||||
<member name="M:Yi.RBAC.Domain.Identity.UserManager.GiveUserSetRoleAsync(System.Collections.Generic.List{System.Int64},System.Collections.Generic.List{System.Int64})">
|
||||
<summary>
|
||||
用户领域服务
|
||||
给用户设置角色
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Yi.RBAC.Domain.Identity.UserManager.LoginValidationAsync(System.String,System.String,System.Action{Yi.RBAC.Domain.Identity.Entities.UserEntity})">
|
||||
<summary>
|
||||
登录效验
|
||||
</summary>
|
||||
<param name="userName"></param>
|
||||
<param name="password"></param>
|
||||
<param name="userAction"></param>
|
||||
<param name="userIds"></param>
|
||||
<param name="roleIds"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:Yi.RBAC.Domain.Identity.UserManager.ExistAsync(System.String,System.Action{Yi.RBAC.Domain.Identity.Entities.UserEntity})">
|
||||
<member name="M:Yi.RBAC.Domain.Identity.UserManager.GiveUserSetPostAsync(System.Collections.Generic.List{System.Int64},System.Collections.Generic.List{System.Int64})">
|
||||
<summary>
|
||||
判断账户合法存在
|
||||
给用户设置岗位
|
||||
</summary>
|
||||
<param name="userName"></param>
|
||||
<param name="userAction"></param>
|
||||
<param name="userIds"></param>
|
||||
<param name="postIds"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
</members>
|
||||
|
||||
@@ -0,0 +1,108 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Security.Claims;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Core.CurrentUsers;
|
||||
using Yi.Framework.Core.Exceptions;
|
||||
using Yi.Framework.Ddd.Repositories;
|
||||
using Yi.RBAC.Domain.Identity.Dtos;
|
||||
using Yi.RBAC.Domain.Identity.Entities;
|
||||
using Yi.RBAC.Domain.Shared.Identity.ConstClasses;
|
||||
|
||||
namespace Yi.RBAC.Domain.Identity
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 用户领域服务
|
||||
/// </summary>
|
||||
[AppService]
|
||||
public class AccountManager
|
||||
{
|
||||
private readonly IRepository<UserEntity> _repository;
|
||||
public AccountManager(IRepository<UserEntity> repository)
|
||||
{
|
||||
_repository = repository;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 登录效验
|
||||
/// </summary>
|
||||
/// <param name="userName"></param>
|
||||
/// <param name="password"></param>
|
||||
/// <param name="userAction"></param>
|
||||
/// <returns></returns>
|
||||
public async Task LoginValidationAsync(string userName, string password, Action<UserEntity>? userAction = null)
|
||||
{
|
||||
var user = new UserEntity();
|
||||
if (await ExistAsync(userName, o => user = o))
|
||||
{
|
||||
if (userAction is not null)
|
||||
{
|
||||
userAction.Invoke(user);
|
||||
}
|
||||
if (user.Password == MD5Helper.SHA2Encode(password, user.Salt))
|
||||
{
|
||||
return;
|
||||
}
|
||||
throw new UserFriendlyException(UserConst.登录失败_错误);
|
||||
}
|
||||
throw new UserFriendlyException(UserConst.登录失败_不存在);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 判断账户合法存在
|
||||
/// </summary>
|
||||
/// <param name="userName"></param>
|
||||
/// <param name="userAction"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<bool> ExistAsync(string userName, Action<UserEntity>? userAction = null)
|
||||
{
|
||||
var user = await _repository.GetFirstAsync(u => u.UserName == userName && u.State == true);
|
||||
if (userAction is not null)
|
||||
{
|
||||
userAction.Invoke(user);
|
||||
}
|
||||
if (user == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 令牌转换
|
||||
/// </summary>
|
||||
/// <param name="dto"></param>
|
||||
/// <returns></returns>
|
||||
|
||||
public Dictionary<string, object> UserInfoToClaim(UserRoleMenuDto dto)
|
||||
{
|
||||
var claims = new Dictionary<string, object>();
|
||||
claims.Add(nameof(ICurrentUser.Id), dto.User.Id);
|
||||
claims.Add(nameof(ICurrentUser.UserName), dto.User.UserName);
|
||||
if (dto.User.Email is not null)
|
||||
{
|
||||
claims.Add(nameof(ICurrentUser.Email), dto.User.Email);
|
||||
}
|
||||
if (dto.User.Phone is not null)
|
||||
{
|
||||
claims.Add(nameof(ICurrentUser.PhoneNumber), dto.User.Phone);
|
||||
}
|
||||
if (UserConst.Admin.Equals(dto.User.UserName))
|
||||
{
|
||||
claims.Add(nameof(ICurrentUser.Permission), UserConst.AdminPermissionCode);
|
||||
}
|
||||
else
|
||||
{
|
||||
claims.Add(nameof(ICurrentUser.Permission), dto.PermissionCodes.Where(x => !string.IsNullOrEmpty(x)));
|
||||
}
|
||||
|
||||
return claims;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.RBAC.Domain.Identity.Entities;
|
||||
|
||||
namespace Yi.RBAC.Domain.Identity.Dtos
|
||||
{
|
||||
public class UserRoleMenuDto
|
||||
{
|
||||
public UserEntity User { get; set; } = new();
|
||||
public HashSet<RoleEntity> Roles { get; set; } = new();
|
||||
public HashSet<MenuEntity> Menus { get; set; } = new();
|
||||
|
||||
public List<string> RoleCodes { get; set; } = new();
|
||||
public List<string> PermissionCodes { get; set; } = new();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text.Json.Serialization;
|
||||
using SqlSugar;
|
||||
using Yi.Framework.Data.Auditing;
|
||||
using Yi.Framework.Data.Entities;
|
||||
using Yi.Framework.Ddd.Entities;
|
||||
|
||||
namespace Yi.RBAC.Domain.Identity.Entities
|
||||
{
|
||||
/// <summary>
|
||||
/// 部门表
|
||||
///</summary>
|
||||
[SugarTable("Dept")]
|
||||
public partial class DeptEntity : IEntity<long>, ISoftDelete, IAuditedObject, IOrderNum, IState
|
||||
{
|
||||
/// <summary>
|
||||
/// 主键
|
||||
/// </summary>
|
||||
[SugarColumn(IsPrimaryKey = true)]
|
||||
public long Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 逻辑删除
|
||||
/// </summary>
|
||||
public bool IsDeleted { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 创建时间
|
||||
/// </summary>
|
||||
public DateTime CreationTime { get; set; } = DateTime.Now;
|
||||
|
||||
/// <summary>
|
||||
/// 创建者
|
||||
/// </summary>
|
||||
public long? CreatorId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 最后修改者
|
||||
/// </summary>
|
||||
public long? LastModifierId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 最后修改时间
|
||||
/// </summary>
|
||||
public DateTime? LastModificationTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 排序
|
||||
/// </summary>
|
||||
public int OrderNum { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// 状态
|
||||
/// </summary>
|
||||
public bool State { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 部门名称
|
||||
///</summary>
|
||||
public string DeptName { get; set; }=string.Empty;
|
||||
/// <summary>
|
||||
/// 部门编码
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName = "DeptCode")]
|
||||
public string DeptCode { get; set; } = string.Empty;
|
||||
/// <summary>
|
||||
/// 负责人
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName = "Leader")]
|
||||
public string? Leader { get; set; }
|
||||
/// <summary>
|
||||
/// 父级id
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName = "ParentId")]
|
||||
public long ParentId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 描述
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName = "Remark")]
|
||||
public string? Remark { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,196 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text.Json.Serialization;
|
||||
using SqlSugar;
|
||||
using Yi.Framework.Data.Auditing;
|
||||
using Yi.Framework.Data.Entities;
|
||||
using Yi.Framework.Ddd.Entities;
|
||||
using Yi.RBAC.Domain.Shared.Identity.Dtos;
|
||||
using Yi.RBAC.Domain.Shared.Identity.EnumClasses;
|
||||
|
||||
namespace Yi.RBAC.Domain.Identity.Entities
|
||||
{
|
||||
/// <summary>
|
||||
/// 菜单表
|
||||
///</summary>
|
||||
[SugarTable("Menu")]
|
||||
public partial class MenuEntity : IEntity<long>, ISoftDelete, IAuditedObject, IOrderNum, IState
|
||||
{
|
||||
/// <summary>
|
||||
/// 主键
|
||||
/// </summary>
|
||||
[SugarColumn(IsPrimaryKey = true)]
|
||||
public long Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 逻辑删除
|
||||
/// </summary>
|
||||
public bool IsDeleted { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 创建时间
|
||||
/// </summary>
|
||||
public DateTime CreationTime { get; set; } = DateTime.Now;
|
||||
|
||||
/// <summary>
|
||||
/// 创建者
|
||||
/// </summary>
|
||||
public long? CreatorId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 最后修改者
|
||||
/// </summary>
|
||||
public long? LastModifierId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 最后修改时间
|
||||
/// </summary>
|
||||
public DateTime? LastModificationTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 排序
|
||||
/// </summary>
|
||||
public int OrderNum { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// 状态
|
||||
/// </summary>
|
||||
public bool State { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 菜单名
|
||||
/// </summary>
|
||||
public string MenuName { get; set; } = string.Empty;
|
||||
/// <summary>
|
||||
///
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName = "MenuType")]
|
||||
public MenuTypeEnum MenuType { get; set; } = MenuTypeEnum.Menu;
|
||||
/// <summary>
|
||||
///
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName = "PermissionCode")]
|
||||
public string? PermissionCode { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName = "ParentId")]
|
||||
public long ParentId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 菜单图标
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName = "MenuIcon")]
|
||||
public string? MenuIcon { get; set; }
|
||||
/// <summary>
|
||||
/// 菜单组件路由
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName = "Router")]
|
||||
public string? Router { get; set; }
|
||||
/// <summary>
|
||||
/// 是否为外部链接
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName = "IsLink")]
|
||||
public bool IsLink { get; set; }
|
||||
/// <summary>
|
||||
/// 是否缓存
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName = "IsCache")]
|
||||
public bool IsCache { get; set; }
|
||||
/// <summary>
|
||||
/// 是否显示
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName = "IsShow")]
|
||||
public bool IsShow { get; set; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// 描述
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName = "Remark")]
|
||||
public string? Remark { get; set; }
|
||||
/// <summary>
|
||||
/// 组件路径
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName = "Component")]
|
||||
public string? Component { get; set; }
|
||||
/// <summary>
|
||||
/// 路由参数
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName = "Query")]
|
||||
public string? Query { get; set; }
|
||||
|
||||
[SugarColumn(IsIgnore = true)]
|
||||
public List<MenuEntity>? Children { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 实体扩展
|
||||
/// </summary>
|
||||
public static class MenuEntityExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// 构建vue3路由
|
||||
/// </summary>
|
||||
/// <param name="menus"></param>
|
||||
/// <returns></returns>
|
||||
public static List<Vue3RouterDto> Vue3RouterBuild(this List<MenuEntity> menus)
|
||||
{
|
||||
menus = menus.Where(m => m.MenuType != MenuTypeEnum.Component).ToList();
|
||||
List<Vue3RouterDto> routers = new();
|
||||
foreach (var m in menus)
|
||||
{
|
||||
|
||||
var r = new Vue3RouterDto();
|
||||
r.OrderNum = m.OrderNum;
|
||||
var routerName = m.Router?.Split("/").LastOrDefault();
|
||||
r.Id = m.Id;
|
||||
r.ParentId = m.ParentId;
|
||||
|
||||
//开头大写
|
||||
r.Name = routerName?.First().ToString().ToUpper() + routerName?.Substring(1);
|
||||
r.Path = m.Router!;
|
||||
r.Hidden = !m.IsShow;
|
||||
|
||||
|
||||
if (m.MenuType == MenuTypeEnum.Catalogue)
|
||||
{
|
||||
r.Redirect = "noRedirect";
|
||||
r.AlwaysShow = true;
|
||||
|
||||
//判断是否为最顶层的路由
|
||||
if (0 == m.ParentId)
|
||||
{
|
||||
r.Component = "Layout";
|
||||
}
|
||||
else
|
||||
{
|
||||
r.Component = "ParentView";
|
||||
}
|
||||
}
|
||||
if (m.MenuType == MenuTypeEnum.Menu)
|
||||
{
|
||||
r.Redirect = "noRedirect";
|
||||
r.AlwaysShow = true;
|
||||
r.Component = m.Component!;
|
||||
r.AlwaysShow = false;
|
||||
}
|
||||
r.Meta = new Meta
|
||||
{
|
||||
Title = m.MenuName!,
|
||||
Icon = m.MenuIcon!,
|
||||
NoCache = !m.IsCache
|
||||
};
|
||||
if (m.IsLink)
|
||||
{
|
||||
r.Meta.link = m.Router!;
|
||||
r.AlwaysShow = false;
|
||||
}
|
||||
|
||||
routers.Add(r);
|
||||
}
|
||||
return TreeHelper.SetTree(routers);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text.Json.Serialization;
|
||||
using SqlSugar;
|
||||
using Yi.Framework.Data.Auditing;
|
||||
using Yi.Framework.Data.Entities;
|
||||
using Yi.Framework.Ddd.Entities;
|
||||
|
||||
namespace Yi.RBAC.Domain.Identity.Entities
|
||||
{
|
||||
/// <summary>
|
||||
/// 岗位表
|
||||
///</summary>
|
||||
[SugarTable("Post")]
|
||||
public partial class PostEntity : IEntity<long>, ISoftDelete, IAuditedObject, IOrderNum, IState
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 主键
|
||||
/// </summary>
|
||||
[SugarColumn(IsPrimaryKey = true)]
|
||||
public long Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 逻辑删除
|
||||
/// </summary>
|
||||
public bool IsDeleted { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 创建时间
|
||||
/// </summary>
|
||||
public DateTime CreationTime { get; set; } = DateTime.Now;
|
||||
|
||||
/// <summary>
|
||||
/// 创建者
|
||||
/// </summary>
|
||||
public long? CreatorId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 最后修改者
|
||||
/// </summary>
|
||||
public long? LastModifierId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 最后修改时间
|
||||
/// </summary>
|
||||
public DateTime? LastModificationTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 排序
|
||||
/// </summary>
|
||||
public int OrderNum { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// 状态
|
||||
/// </summary>
|
||||
public bool State { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 岗位编码
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName = "PostCode")]
|
||||
public string PostCode { get; set; }=string.Empty;
|
||||
/// <summary>
|
||||
/// 岗位名称
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName = "PostName")]
|
||||
public string PostName { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 描述
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName = "Remark")]
|
||||
public string? Remark { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text.Json.Serialization;
|
||||
using SqlSugar;
|
||||
using Yi.Framework.Ddd.Entities;
|
||||
|
||||
namespace Yi.RBAC.Domain.Identity.Entities;
|
||||
|
||||
/// <summary>
|
||||
/// 角色部门关系表
|
||||
///</summary>
|
||||
[SugarTable("RoleDept")]
|
||||
public partial class RoleDeptEntity : IEntity<long>
|
||||
{
|
||||
/// <summary>
|
||||
/// 主键
|
||||
/// </summary>
|
||||
[SugarColumn(IsPrimaryKey = true)]
|
||||
public long Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 角色id
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName = "RoleId")]
|
||||
public long? RoleId { get; set; }
|
||||
/// <summary>
|
||||
/// 部门id
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName = "DeptId")]
|
||||
public long? DeptId { get; set; }
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
using SqlSugar;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Data.Auditing;
|
||||
using Yi.Framework.Data.Entities;
|
||||
using Yi.Framework.Ddd.Entities;
|
||||
using Yi.RBAC.Domain.Shared.Identity.EnumClasses;
|
||||
|
||||
namespace Yi.RBAC.Domain.Identity.Entities
|
||||
{
|
||||
/// <summary>
|
||||
/// 角色表
|
||||
/// </summary>
|
||||
[SugarTable("Role")]
|
||||
public class RoleEntity : IEntity<long>, ISoftDelete, IAuditedObject, IOrderNum, IState
|
||||
{
|
||||
/// <summary>
|
||||
/// 主键
|
||||
/// </summary>
|
||||
[SugarColumn(IsPrimaryKey = true)]
|
||||
public long Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 逻辑删除
|
||||
/// </summary>
|
||||
public bool IsDeleted { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 创建时间
|
||||
/// </summary>
|
||||
public DateTime CreationTime { get; set; } = DateTime.Now;
|
||||
|
||||
/// <summary>
|
||||
/// 创建者
|
||||
/// </summary>
|
||||
public long? CreatorId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 最后修改者
|
||||
/// </summary>
|
||||
public long? LastModifierId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 最后修改时间
|
||||
/// </summary>
|
||||
public DateTime? LastModificationTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 排序
|
||||
/// </summary>
|
||||
public int OrderNum { get; set; } = 0;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 角色名
|
||||
/// </summary>
|
||||
public string RoleName { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 角色编码
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName = "RoleCode")]
|
||||
public string RoleCode { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 描述
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName = "Remark")]
|
||||
public string? Remark { get; set; }
|
||||
/// <summary>
|
||||
/// 角色数据范围
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName = "DataScope")]
|
||||
public DataScopeEnum DataScope { get; set; } = DataScopeEnum.ALL;
|
||||
|
||||
/// <summary>
|
||||
/// 状态
|
||||
/// </summary>
|
||||
public bool State { get; set; }
|
||||
|
||||
|
||||
[Navigate(typeof(RoleMenuEntity), nameof(RoleMenuEntity.RoleId), nameof(RoleMenuEntity.MenuId))]
|
||||
public List<MenuEntity> Menus { get; set; }
|
||||
|
||||
[Navigate(typeof(RoleDeptEntity), nameof(RoleDeptEntity.RoleId), nameof(RoleDeptEntity.DeptId))]
|
||||
public List<DeptEntity> Depts { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text.Json.Serialization;
|
||||
using SqlSugar;
|
||||
using Yi.Framework.Ddd.Entities;
|
||||
|
||||
namespace Yi.RBAC.Domain.Identity.Entities;
|
||||
/// <summary>
|
||||
/// 角色菜单关系表
|
||||
///</summary>
|
||||
[SugarTable("RoleMenu")]
|
||||
public partial class RoleMenuEntity : IEntity<long>
|
||||
|
||||
{
|
||||
/// <summary>
|
||||
/// 主键
|
||||
/// </summary>
|
||||
[SugarColumn(IsPrimaryKey = true)]
|
||||
public long Id { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName = "RoleId")]
|
||||
public long RoleId { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName = "MenuId")]
|
||||
public long MenuId { get; set; }
|
||||
|
||||
}
|
||||
@@ -15,7 +15,7 @@ namespace Yi.RBAC.Domain.Identity.Entities
|
||||
/// 用户表
|
||||
/// </summary>
|
||||
[SugarTable("User")]
|
||||
public class UserEntity : IEntity<long>, ISoftDelete, IAuditedObject, IOrderNum
|
||||
public class UserEntity : IEntity<long>, ISoftDelete, IAuditedObject, IOrderNum,IState
|
||||
{
|
||||
/// <summary>
|
||||
/// 主键
|
||||
@@ -128,6 +128,71 @@ namespace Yi.RBAC.Domain.Identity.Entities
|
||||
/// 排序
|
||||
/// </summary>
|
||||
public int OrderNum { get; set; } = 0;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 状态
|
||||
/// </summary>
|
||||
public bool State { get; set; } = true;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 角色
|
||||
/// </summary>
|
||||
[Navigate(typeof(UserRoleEntity), nameof(UserRoleEntity.UserId), nameof(UserRoleEntity.RoleId))]
|
||||
public List<RoleEntity> Roles { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 岗位
|
||||
/// </summary>
|
||||
|
||||
[Navigate(typeof(UserPostEntity), nameof(UserPostEntity.UserId), nameof(UserPostEntity.PostId))]
|
||||
public List<PostEntity> Posts { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 部门
|
||||
/// </summary>
|
||||
|
||||
[Navigate(NavigateType.OneToOne, nameof(DeptId))]
|
||||
public DeptEntity? Dept { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 构建密码,MD5盐值加密
|
||||
/// </summary>
|
||||
public UserEntity BuildPassword(string? password = null)
|
||||
{
|
||||
//如果不传值,那就把自己的password当作传进来的password
|
||||
if (password == null)
|
||||
{
|
||||
if (Password == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(Password));
|
||||
}
|
||||
password = Password;
|
||||
}
|
||||
Salt = MD5Helper.GenerateSalt();
|
||||
Password = MD5Helper.SHA2Encode(password, Salt);
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 判断密码和加密后的密码是否相同
|
||||
/// </summary>
|
||||
/// <param name="password"></param>
|
||||
/// <returns></returns>
|
||||
public bool JudgePassword(string password)
|
||||
{
|
||||
if (this.Salt is null)
|
||||
{
|
||||
throw new ArgumentNullException(this.Salt);
|
||||
}
|
||||
var p = MD5Helper.SHA2Encode(password, Salt);
|
||||
if (Password == MD5Helper.SHA2Encode(password, Salt))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text.Json.Serialization;
|
||||
using SqlSugar;
|
||||
using Yi.Framework.Ddd.Entities;
|
||||
|
||||
namespace Yi.RBAC.Domain.Identity.Entities;
|
||||
/// <summary>
|
||||
/// 用户岗位表
|
||||
///</summary>
|
||||
[SugarTable("UserPost")]
|
||||
public partial class UserPostEntity : IEntity<long>
|
||||
{
|
||||
/// <summary>
|
||||
/// 主键
|
||||
/// </summary>
|
||||
[SugarColumn(IsPrimaryKey = true)]
|
||||
public long Id { get; set; }
|
||||
/// <summary>
|
||||
/// 用户id
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "UserId")]
|
||||
public long UserId { get; set; }
|
||||
/// <summary>
|
||||
/// 岗位id
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName = "PostId")]
|
||||
public long PostId { get; set; }
|
||||
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using SqlSugar;
|
||||
using Yi.Framework.Ddd.Entities;
|
||||
|
||||
namespace Yi.RBAC.Domain.Identity.Entities
|
||||
{
|
||||
/// <summary>
|
||||
/// 用户角色关系表
|
||||
///</summary>
|
||||
[SugarTable("UserRole")]
|
||||
public partial class UserRoleEntity : IEntity<long>
|
||||
{
|
||||
/// <summary>
|
||||
/// 主键
|
||||
/// </summary>
|
||||
[SugarColumn(IsPrimaryKey = true)]
|
||||
public long Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 角色id
|
||||
/// </summary>
|
||||
public long RoleId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 用户id
|
||||
/// </summary>
|
||||
public long UserId { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Ddd.Repositories;
|
||||
using Yi.RBAC.Domain.Identity.Dtos;
|
||||
using Yi.RBAC.Domain.Identity.Entities;
|
||||
using Yi.RBAC.Domain.Shared.Identity.Dtos;
|
||||
|
||||
|
||||
@@ -3,70 +3,80 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Core.Exceptions;
|
||||
using Yi.Framework.Ddd.Repositories;
|
||||
using Yi.RBAC.Domain.Identity.Entities;
|
||||
using Yi.RBAC.Domain.Shared.Identity.ConstClasses;
|
||||
|
||||
namespace Yi.RBAC.Domain.Identity
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 用户领域服务
|
||||
/// </summary>
|
||||
[AppService]
|
||||
public class UserManager
|
||||
{
|
||||
private readonly IRepository<UserEntity> _repository;
|
||||
public UserManager(IRepository<UserEntity> repository)
|
||||
{
|
||||
_repository = repository;
|
||||
}
|
||||
private readonly IRepository<UserRoleEntity> _repositoryUserRole;
|
||||
private readonly IRepository<UserPostEntity> _repositoryUserPost;
|
||||
public UserManager(IRepository<UserEntity> repository, IRepository<UserRoleEntity> repositoryUserRole, IRepository<UserPostEntity> repositoryUserPost) =>
|
||||
(_repository, _repositoryUserRole, _repositoryUserPost) =
|
||||
(repository, repositoryUserRole, repositoryUserPost);
|
||||
|
||||
/// <summary>
|
||||
/// 登录效验
|
||||
/// 给用户设置角色
|
||||
/// </summary>
|
||||
/// <param name="userName"></param>
|
||||
/// <param name="password"></param>
|
||||
/// <param name="userAction"></param>
|
||||
/// <param name="userIds"></param>
|
||||
/// <param name="roleIds"></param>
|
||||
/// <returns></returns>
|
||||
public async Task LoginValidationAsync(string userName, string password, Action<UserEntity>? userAction = null)
|
||||
public async Task GiveUserSetRoleAsync(List<long> userIds, List<long>? roleIds)
|
||||
{
|
||||
var user = new UserEntity();
|
||||
if (await ExistAsync(userName, o => user = o))
|
||||
//删除用户之前所有的用户角色关系(物理删除,没有恢复的必要)
|
||||
await _repositoryUserRole.DeleteAsync(u => userIds.Contains(u.UserId));
|
||||
|
||||
if (roleIds is not null)
|
||||
{
|
||||
if (userAction is not null)
|
||||
//遍历用户
|
||||
foreach (var userId in userIds)
|
||||
{
|
||||
userAction.Invoke(user);
|
||||
//添加新的关系
|
||||
List<UserRoleEntity> userRoleEntities = new();
|
||||
|
||||
foreach (var roleId in roleIds)
|
||||
{
|
||||
userRoleEntities.Add(new UserRoleEntity() { Id = SnowflakeHelper.NextId, UserId = userId, RoleId = roleId });
|
||||
}
|
||||
//一次性批量添加
|
||||
await _repositoryUserRole.InsertRangeAsync(userRoleEntities);
|
||||
}
|
||||
if (user.Password != MD5Helper.SHA2Encode(password, user.Salt))
|
||||
{
|
||||
return;
|
||||
}
|
||||
throw new UserFriendlyException(UserConst.登录失败_错误);
|
||||
}
|
||||
throw new UserFriendlyException(UserConst.登录失败_不存在);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 判断账户合法存在
|
||||
/// 给用户设置岗位
|
||||
/// </summary>
|
||||
/// <param name="userName"></param>
|
||||
/// <param name="userAction"></param>
|
||||
/// <param name="userIds"></param>
|
||||
/// <param name="postIds"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<bool> ExistAsync(string userName, Action<UserEntity>? userAction = null)
|
||||
public async Task GiveUserSetPostAsync(List<long> userIds, List<long>? postIds)
|
||||
{
|
||||
var user = await _repository.GetFirstAsync(u => u.UserName == userName && u.IsDeleted == false);
|
||||
if (userAction is not null)
|
||||
//删除用户之前所有的用户角色关系(物理删除,没有恢复的必要)
|
||||
await _repositoryUserPost.DeleteAsync(u => userIds.Contains(u.UserId));
|
||||
if (postIds is not null)
|
||||
{
|
||||
userAction.Invoke(user);
|
||||
//遍历用户
|
||||
foreach (var userId in userIds)
|
||||
{
|
||||
//添加新的关系
|
||||
List<UserPostEntity> userPostEntities = new();
|
||||
foreach (var post in postIds)
|
||||
{
|
||||
userPostEntities.Add(new UserPostEntity() { Id = SnowflakeHelper.NextId, UserId = userId, PostId = post });
|
||||
}
|
||||
|
||||
//一次性批量添加
|
||||
await _repositoryUserPost.InsertRangeAsync(userPostEntities);
|
||||
}
|
||||
|
||||
}
|
||||
if (user == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Data.DataSeeds;
|
||||
using Yi.Framework.Ddd.Repositories;
|
||||
using Yi.RBAC.Domain.School.Entities;
|
||||
|
||||
namespace Yi.RBAC.Domain.School.DataSeeds
|
||||
{
|
||||
[AppService(typeof(IDataSeed))]
|
||||
public class StudentDataSeed : AbstractDataSeed<StudentEntity>
|
||||
{
|
||||
public StudentDataSeed(IRepository<StudentEntity> repository) : base(repository)
|
||||
{
|
||||
}
|
||||
|
||||
public override List<StudentEntity> GetSeedData()
|
||||
{
|
||||
return new List<StudentEntity>() { new StudentEntity { Id = SnowflakeHelper.NextId, Name = "你好", Phone = "123", Height = 188, IsDeleted = false } ,
|
||||
new StudentEntity { Id = SnowflakeHelper.NextId, Name = "你好1", Phone = "123", Height = 188, IsDeleted = false },
|
||||
new StudentEntity { Id = SnowflakeHelper.NextId, Name = "你好2", Phone = "123", Height = 188, IsDeleted = false }
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
using SqlSugar;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Data.Entities;
|
||||
using Yi.Framework.Ddd.Entities;
|
||||
|
||||
namespace Yi.RBAC.Domain.School.Entities
|
||||
{
|
||||
[SugarTable("Student")]
|
||||
public class StudentEntity : IEntity<long>,ISoftDelete
|
||||
{
|
||||
[SugarColumn(IsPrimaryKey = true)]
|
||||
public long Id { get; set; }
|
||||
|
||||
public string Name { get; set; }
|
||||
|
||||
public int? Height { get; set; }
|
||||
|
||||
public string? Phone { get; set; }
|
||||
public bool IsDeleted { get; set; } = false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
using SqlSugar;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Core.Sqlsugar.Repositories;
|
||||
using Yi.Framework.Ddd.Repositories;
|
||||
using Yi.RBAC.Domain.Identity.Dtos;
|
||||
using Yi.RBAC.Domain.Identity.Entities;
|
||||
using Yi.RBAC.Domain.Identity.Repositories;
|
||||
using Yi.RBAC.Domain.Shared.Identity.ConstClasses;
|
||||
using Yi.RBAC.Domain.Shared.Identity.Dtos;
|
||||
|
||||
namespace Yi.RBAC.Sqlsugar.Repositories
|
||||
{
|
||||
[AppService]
|
||||
public class UserRepository : SqlsugarRepository<UserEntity>, IUserRepository
|
||||
{
|
||||
public UserRepository(ISqlSugarClient context) : base(context)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取用户id的全部信息
|
||||
/// </summary>
|
||||
/// <param name="userId"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="ArgumentNullException"></exception>
|
||||
public async Task<UserRoleMenuDto> GetUserAllInfoAsync(long userId)
|
||||
{
|
||||
var userRoleMenu = new UserRoleMenuDto();
|
||||
//首先获取到该用户全部信息,导航到角色、菜单,(菜单需要去重,完全交给Set来处理即可)
|
||||
|
||||
//得到用户
|
||||
var user = await _DbQueryable.Includes(u => u.Roles.Where(r => r.IsDeleted == false).ToList(), r => r.Menus.Where(m => m.IsDeleted == false).ToList()).InSingleAsync(userId);
|
||||
if (user is null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(userId));
|
||||
}
|
||||
user.Password = string.Empty;
|
||||
user.Salt = string.Empty;
|
||||
|
||||
//超级管理员特殊处理
|
||||
if (UserConst.Admin.Equals(user.UserName))
|
||||
{
|
||||
userRoleMenu.User = user;
|
||||
userRoleMenu.RoleCodes.Add(UserConst.AdminRolesCode);
|
||||
userRoleMenu.PermissionCodes.Add(UserConst.AdminPermissionCode);
|
||||
return userRoleMenu;
|
||||
}
|
||||
|
||||
//得到角色集合
|
||||
var roleList = user.Roles;
|
||||
|
||||
//得到菜单集合
|
||||
foreach (var role in roleList)
|
||||
{
|
||||
userRoleMenu.RoleCodes.Add(role.RoleCode);
|
||||
|
||||
if (role.Menus is not null)
|
||||
{
|
||||
foreach (var menu in role.Menus)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(menu.PermissionCode))
|
||||
{
|
||||
userRoleMenu.PermissionCodes.Add(menu.PermissionCode);
|
||||
}
|
||||
userRoleMenu.Menus.Add(menu);
|
||||
}
|
||||
}
|
||||
|
||||
//刚好可以去除一下多余的导航属性
|
||||
role.Menus =new List<MenuEntity>();
|
||||
userRoleMenu.Roles.Add(role);
|
||||
}
|
||||
|
||||
user.Roles = new List<RoleEntity>();
|
||||
userRoleMenu.User = user;
|
||||
|
||||
return userRoleMenu;
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
@@ -1,3 +1,4 @@
|
||||
global using Yi.Framework.Core.Attributes;
|
||||
global using Yi.Framework.Core.Helper;
|
||||
global using Yi.Framework.Core.Model;
|
||||
global using Yi.Framework.Core.Model;
|
||||
global using Yi.Framework.Core.Exceptions;
|
||||
Reference in New Issue
Block a user