liany920

导航

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

统计

RBAC经典的五张表

  • RBAC基于角色的访问控制(Role-Based Access Control),能更方便企业进行用户权限的管理。
    下面是RBAC经典的五张表:

    1.用户表:
点击查看代码
 /// <summary>
    /// 用户表
    /// </summary>
    [Table("Users")]
    public class Users
    {
        [Key]
        public int UserId { get; set; }
        [Required]
        [StringLength(50)]
        public string UserName { get; set; }
        [Required]
        [StringLength(50)]
        public string PassWord { get; set; }
        public int Age { get; set; }
        [StringLength(50)]
        public string? Email { get; set; }
        [StringLength(11)]
        public string? Phone { get; set; }
        [Required]
        [StringLength(50)]
        public string TrueName { get; set; }
    }
2.角色表:
点击查看代码
 /// <summary>
    /// 角色表
    /// </summary>
    [Table("Roles")]
    public class Roles
    {
        [Key]
        public int RoleId { get; set; }
        [Required]
        [StringLength(50)]
        public string RoleName { get; set; }
        [StringLength(50)]
        public string? Desc { get; set; }
    }
3.权限表:
点击查看代码
 /// <summary>
    /// 权限表
    /// </summary>
    [Table("Permision")]
    public class Permision
    {
        [DatabaseGenerated(DatabaseGeneratedOption.None)]
        public string PermisionId { get; set; }
        [Required]
        [StringLength(50)]
        public string PermisionName { get; set; }
        [Required]
        [StringLength(50)]
        public string ParentId { get; set; }
        [Required]
        [StringLength(500)]
        public string MenuUrl { get; set; }
        [Required]
        [StringLength(500)]
        public string Icon { get; set; }
    }
4.用户角色关系表:
点击查看代码
/// <summary>
    /// 用户角色关系表
    /// </summary>
    [Table("UserRole")]
    public class UserRole
    {
        [Key]
        public int UserRoleId { get; set; }
        public int UserId { get; set; }
        public int RoleId { get; set; }
    }
5.角色权限关系表:
点击查看代码
 /// <summary>
    /// 角色权限关系表
    /// </summary>
    [Table("RolePermision")]
    public class RolePermision
    {
        [Key]
        public int RolePermisionId { get; set; }

        public int RoleId { get; set; }
        public string PermisionId { get; set; }
    }

posted on   练练练  阅读(310)  评论(0编辑  收藏  举报

相关博文:
阅读排行:
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
· 提示词工程——AI应用必不可少的技术
· 地球OL攻略 —— 某应届生求职总结
· 字符编码:从基础到乱码解决
· SpringCloud带你走进微服务的世界
点击右上角即可分享
微信分享提示