RBAC权限框架_MVC权限框架
RBAC权限框架(Role-Based Access Control)基于角色的权限访问控制的框架,通过用户-角色-权限的关联,非常方便的进行权限管理,在这里不再说明什么是RBAC,请自行百度.
谢谢大家的捧场,如文章中有错误或者,请联系我或者给我发邮件linjie.rd@gmail.com,修正后将会有小礼品送出,谢谢
思路
小张、小王、小李要去动物园看动物,小张和小王提前在网上买好票了,小李没买到票。
三人到了动物园公共展区,这里不需要验票,三人可以看这一片的动物(允许匿名访问)。
继续向前走,到了特别展区,需要验证门票,小张和小王有门票顺利的进入特别展区,小李被拦了下来(身份认证)。
小李不甘心啊,找了个角落,偷偷FQ景区,结果被景区人员抓了被带到了警察局进行教育(非法访问)。
小王在特别展区嫌慢,自己偷偷一不小心走到没有权限的地方而被抓。
相对关系
权限:权限是指是否允许可被访问(被查看)和被使用的一种手段,通常设计具有上下级的关系,在本文中用的是树形结构。
用户:该操作系统的使用者,通过这个操作系统来完成某部分的工作生活。
角色:对用户的一种分类,对权限的一中整理,比如:普通员工有普通员工的权限,经理又经理 的权限。
在实际生活中,一个人有多个身份,比如,爸爸妈妈的孩子,孩子的父母,上班的职工等等。而一个公司的普通员工就有很多人。so,用户和角色是多对多的关系。
而一个角色,也可能有多个权限。比如,一个医生除了治病救人之外,也可以医疗护理。一个警察在打击犯罪的同时,也可以根据法律法规帮助别人。
而一个权限,可能是多个角色拥有的。一个警察在打击犯罪,普通市民也可以参与。往往一件事的事情(类比于一个权限),会有多个角色的参与。
所以,角色和权限也是多对多的关系
数据库设计
因为是RBAC,所以肯定有用户、角色、权限,用户和角色是多对多的关系,角色和权限是多对多的关系。所以,需要有用户表、用户角色关联表、角色表、角色权限关联表、权限表。
用户表:用户代码、用户名、密码。
角色表:角色代码、角色名称。
用户角色关联表:用户代码、角色代码。
权限表:权限代码、权限名称、链接地址、父级权限代码。
角色权限关联表:角色代码、权限代码。
这些已经是基础的表,往往生活工作中会比这复杂多了。在有的时候,还需要特殊用户权限关联管理表。
程序的设计
根据需求,管理员可以管理权限和维护用户信息等,用户可以实现自己的任务需求。
那么,最基础的是获取权限和判断是否有相应的权限,在页面上展示相应 的功能呢以及在操作的时候判断有木有操作的权限。
比如管理员登陆,可以添加角色用户权限等。而用户登录,能够管理商品,订单的信息等。
环境
使用vs2015,sql server2017编程,Win10 Home x64系统软件,兼容IE8,IE9,IE10,谷歌浏览器等,使用PowerDesigner建模,等等
框架技术
整体框架使用了MVC+多层,页面使用了MiniUI框架,考虑到用户量不是很多,使用了Code First。
Code
由于保密条例,不展示业务部分,只有权限
* 获取权限,用户登录后,根据用户所属的角色信息获取相应的权限。
* 判断是否有权限,在用户进行操作前判断是否有权限
实现
*登录: 用户打开网站时,首先判断当前页面不允许匿名访问,判断Session是否有用户会话信息,存在则加载用户信息,不存在读取Cookie,Cookie有登录信息并且没有过期,这加载用户信息,否者跳转登录页面
登录成功之后或者加载完用户信息之后,获取权限列表,显示对应的模块
* 操作: 当用户点击功能后或者在地址栏里输入地址访问,首先通过面向切面编程的思路,使用动作过滤器或者权限过滤器判断是否有对应的权限,有权限就允许操作,没有权限则视为无效操作或者非法操作
无效操作: 返回上一页或者上一步
非法操作: 清空登录信息,清空Session,释放Cookie,跳转到非法访问警告页面,3秒后跳转到登录页面
---------------- Common ----------------
1 public class UserPermissionFilter:System.Web.Mvc.ActionFilterAttribute 2 { 3 public override void OnActionExecuting(System.Web.Mvc.ActionExecutingContext filterContext) 4 { 5 #region 判断是否有 此 controller 和 action 的权限 6 LoginUserViewModel user = AdminUserBll.GetLoginUser(); 7 var permissionListAll = ModuleBll.Instance.GetLevelModuleListIsArrayAllInCache(); 8 if (null != user && !string.IsNullOrEmpty(user.user_name)) 9 { 10 bool ret = true; 11 if (user.PermissionList != null && user.PermissionList.Count > 0) 12 { 13 string action = filterContext.ActionDescriptor.ActionName; 14 string controller = filterContext.ActionDescriptor.ControllerDescriptor.ControllerName; 15 string url = (controller + "/" + action).ToUpper(); 16 var module = permissionListAll.FirstOrDefault(c => c.action_url.ToUpper() == url); 17 if ((controller.ToUpper() != "HOME" && action.ToUpper() != "LOGIN") && 18 controller.ToUpper() != "MENU" && module != null) /*此Action下的不作权限*/ 19 //&& module != null 20 { 21 ret = AdminUserBll.LoginUserIsPermission(controller, action, user); 22 } 23 if (!ret) 24 { 25 filterContext.HttpContext.Response.Redirect("/Home/NoRight", true); 26 //throw new System.Web.HttpException(403, "无权访问"); 27 } 28 } 29 } 30 else 31 { 32 filterContext.HttpContext.Response.Redirect("/login", true); 33 34 } 35 36 37 #endregion 38 39 base.OnActionExecuting(filterContext); 40 } 41 }
1 /// <summary> 2 /// 获取全部一维的模块View列表,在缓存中 3 /// </summary> 4 /// <returns></returns> 5 public List<LevelModuleViewModel> GetLevelModuleListIsArrayAllInCache() 6 { 7 return SystemCacheManager.GetCache("ModuleBll_GetLevelModuleListIsArrayAllInCache", 60, GetLevelMudleListIsArrayAll); 8 }
1 public static class SystemCacheManager 2 { 3 /// <summary> 4 /// 5 /// </summary> 6 /// <param name="key"></param> 7 /// <param name="timeOut"></param> 8 /// <param name="function"></param> 9 /// <returns></returns> 10 public static T GetCache<T>(string key, int timeOut, Func<T> function) 11 { 12 if (string.IsNullOrEmpty(key)) return default(T); 13 var configs = HttpContext.Current.Cache[key]; 14 if (configs == null) 15 { 16 configs = function(); 17 if (timeOut > -1) 18 { 19 HttpContext.Current.Cache.Insert(key, configs, 20 null, DateTime.Now.AddSeconds(timeOut), 21 System.Web.Caching.Cache.NoSlidingExpiration); 22 } 23 else 24 { 25 HttpContext.Current.Cache.Insert(key, configs); 26 } 27 return (T)configs; 28 } 29 return (T)configs; 30 } 31 32 33 /// <summary> 34 /// 35 /// </summary> 36 /// <param name="key"></param> 37 /// <param name="timeOut"></param> 38 /// <param name="function"></param> 39 /// <returns></returns> 40 public static T GetCache<T,Z>(string key, int timeOut, Func<Z,T> function,Z u1) 41 { 42 if (string.IsNullOrEmpty(key)) return default(T); 43 var configs = HttpContext.Current.Cache[key]; 44 if (configs == null) 45 { 46 configs = function(u1); 47 if (timeOut > -1) 48 { 49 HttpContext.Current.Cache.Insert(key, configs, 50 null, DateTime.Now.AddSeconds(timeOut), 51 System.Web.Caching.Cache.NoSlidingExpiration); 52 } 53 else 54 { 55 HttpContext.Current.Cache.Insert(key, configs); 56 } 57 return (T)configs; 58 } 59 return (T)configs; 60 } 61 }
/// <summary> /// 判断登录用户对请求是否有权限 /// </summary> /// <param name="controller"></param> /// <param name="action"></param> /// <param name="login"></param> /// <returns></returns> public static bool LoginUserIsPermission(string controller, string action, LoginUserViewModel login) { if (login.PermissionList != null && login.PermissionList.Count > 0) { string strUrl = controller + "/" + action; if (login.PermissionList.FirstOrDefault(c => c.action_url.ToUpper() == strUrl.ToUpper()) != null) { return true; } } return false; }
1 /// <summary> 2 /// 获取登录用户 3 /// </summary> 4 /// <returns></returns> 5 public static LoginUserViewModel GetLoginUser() 6 { 7 if (System.Web.HttpContext.Current.Session["LoginUser"] != null) 8 { 9 return (LoginUserViewModel)System.Web.HttpContext.Current.Session["LoginUser"]; 10 } 11 else 12 { 13 string userName = Library.Web.Cookie.CookieManager.GetCookie(userCookieKey); 14 if (!string.IsNullOrEmpty(userName)) 15 { 16 userName = StringDes.DesDecrypt(userName); 17 AdminUserDb user = Instance.GetModel(userName); 18 if (user != null) 19 { 20 LoginUserViewModel view = Instance.IniLogin(user); 21 return view; 22 } 23 } 24 } 25 return new LoginUserViewModel(); 26 }
public ActionResult Login(string loginName, string passWord) { ViewBag.LoginName = loginName; ViewBag.PassWord = passWord; ViewBag.ErrorMessage = ""; string md5PassWord = Library.Tools.Text.StringMd5.Md5Hash32Salt(passWord); AdminUserDb user = AdminUserBll.Instance.GetModel(loginName); if (user != null) { if (user.pass_word.ToUpper() == md5PassWord.ToUpper()&&user.user_status==1) { user.last_lgoin_date = DateTime.Now; user.last_login_ip = Request.UserHostAddress; AdminUserBll.Instance.IniLogin(user); return RedirectToAction("Index", "Home"); } else { ViewBag.errorMessage = "用户密码错误"; } } else { ViewBag.errorMessage = "用户密码错误"; } return View(); }
1 /// <summary> 2 /// 获取指定用户名的用户 3 /// </summary> 4 /// <param name="userName"></param> 5 /// <returns></returns> 6 public AdminUserDb GetModel(string userName) 7 { 8 9 return PermissionDal.GetModel(c => c.user_name == userName); 10 11 }
1 /// <summary> 2 /// 初始化登录用户 3 /// </summary> 4 /// <param name="user">登录用户</param> 5 /// <returns></returns> 6 public LoginUserViewModel IniLogin(AdminUserDb user) 7 { 8 if (user != null) 9 { 10 LoginUserViewModel loginUserViewModel = new LoginUserViewModel(); 11 loginUserViewModel.user_full_name = user.user_full_name; 12 loginUserViewModel.user_name = user.user_name; 13 List<ModuleDb> moduleDbList = ModuleBll.Instance.GetModuleList(user.user_name).ToList(); 14 if (moduleDbList != null && moduleDbList.Count > 0) 15 { 16 loginUserViewModel.PermissionList = moduleDbList; 17 loginUserViewModel.PermissionListLevel = ModuleBll.Instance.IniLevelModuleList(moduleDbList); 18 } 19 UpdateUserLogin(user); 20 System.Web.HttpContext.Current.Session["LoginUser"] = loginUserViewModel; 21 Library.Web.Cookie.CookieManager.SetCookie(userCookieKey, StringDes.DesEncrypt(loginUserViewModel.user_name)); 22 return loginUserViewModel; 23 } 24 return new LoginUserViewModel(); 25 }
1 --CREATE DATABASE center 2 --USE center 3 --GO 4 CREATE TABLE [dbo].[admin_user]( 5 [user_name] [nvarchar](50) PRIMARY KEY NOT NULL, 6 [pass_word] [nvarchar](100) NOT NULL, 7 [user_full_name] [nvarchar](100) NULL, 8 [user_status] [int] NOT NULL, 9 [last_lgoin_date] [datetime] NULL, 10 [last_login_ip] [nvarchar](255) NULL, 11 [creator_name] [nvarchar](50) NOT NULL, 12 [creator_date] [datetime] NOT NULL, 13 [modifi_name] [nvarchar](50) NULL, 14 [modifi_date] [datetime] NULL, 15 [user_img] [varchar](max) NULL 16 ) 17 GO 18 19 CREATE TABLE [dbo].[admin_user_role_relation]( 20 [id] [INT] PRIMARY KEY IDENTITY(1,1) NOT NULL, 21 [user_name] [nvarchar](50) NOT NULL, 22 [role_id] [int] NOT NULL, 23 [creator_name] [nvarchar](50) NOT NULL, 24 [creator_date] [datetime] NOT NULL 25 ) 26 GO 27 28 CREATE TABLE [dbo].[dictionary_table]( 29 [dt_key] [nvarchar](100) PRIMARY KEY NOT NULL, 30 [dt_type_key] [nvarchar](100) NOT NULL, 31 [dt_name] [nvarchar](100) NOT NULL, 32 [dt_status] [int] NOT NULL, 33 [dt_orderby] [decimal](18, 2) NOT NULL, 34 [creator_name] [nvarchar](50) NOT NULL, 35 [creator_date] [datetime] NOT NULL, 36 [modifi_name] [nvarchar](50) NULL, 37 [modifi_date] [datetime] NULL 38 ) 39 GO 40 41 CREATE TABLE [dbo].[dictionary_type_table]( 42 [dt_type_key] [nvarchar](100) PRIMARY KEY NOT NULL, 43 [dt_type_name] [nvarchar](100) NOT NULL, 44 [dt_type_remark] [nvarchar](200) NULL, 45 [dt_type_orderby] [decimal](18, 0) NOT NULL, 46 [creator_name] [nvarchar](50) NOT NULL, 47 [creator_date] [datetime] NOT NULL, 48 [modifi_name] [nvarchar](50) NULL, 49 [modifi_date] [datetime] NULL 50 ) 51 GO 52 53 CREATE TABLE [dbo].[module_db]( 54 [module_code] [nvarchar](50) PRIMARY KEY NOT NULL, 55 [module_name] [nvarchar](100) NOT NULL, 56 [parent_code] [nvarchar](50) NOT NULL, 57 [module_level] [int] NOT NULL, 58 [is_menu] [int] NOT NULL, 59 [is_action] [int] NOT NULL, 60 [action_url] [nvarchar](500) NULL, 61 [order_by] [decimal](10, 0) NOT NULL, 62 [module_status] [int] NOT NULL, 63 [creator_name] [nvarchar](50) NOT NULL, 64 [creator_date] [datetime] NOT NULL, 65 [modifi_name] [nvarchar](50) NULL, 66 [modifi_date] [datetime] NULL 67 ) 68 GO 69 70 CREATE TABLE [dbo].[role_db]( 71 [role_id] [INT] PRIMARY KEY IDENTITY(1,1) NOT NULL, 72 [role_name] [nvarchar](50) NOT NULL, 73 [role_status] [int] NOT NULL, 74 [creator_name] [nvarchar](50) NOT NULL, 75 [creator_date] [datetime] NOT NULL, 76 [modifi_name] [nvarchar](50) NULL, 77 [modifi_date] [datetime] NULL 78 ) 79 GO 80 81 CREATE TABLE [dbo].[role_module_relation]( 82 [id] [INT] PRIMARY KEY IDENTITY(1,1) NOT NULL, 83 [role_id] [int] NOT NULL, 84 [module_code] [nvarchar](255) NOT NULL, 85 [creator_name] [nvarchar](50) NOT NULL, 86 [creator_date] [datetime] NOT NULL 87 ) 88 GO 89 INSERT [dbo].[admin_user] ([user_name], [pass_word], [user_full_name], [user_status], [last_lgoin_date], [last_login_ip], [creator_name], [creator_date], [modifi_name], [modifi_date], [user_img]) VALUES (N'adm', N'dc2e86a6ae8315a3da26cae880baae8e', N'adm', 1, NULL, NULL, N'admin', CAST(N'2019-05-28T12:44:12.380' AS DateTime), NULL, NULL, NULL) 90 INSERT [dbo].[admin_user] ([user_name], [pass_word], [user_full_name], [user_status], [last_lgoin_date], [last_login_ip], [creator_name], [creator_date], [modifi_name], [modifi_date], [user_img]) VALUES (N'admin', N'dc2e86a6ae8315a3da26cae880baae8e', N'管理员', 1, CAST(N'2019-05-28T14:48:15.503' AS DateTime), N'::1', N'admin', CAST(N'2019-05-01T00:00:00.000' AS DateTime), NULL, NULL, NULL) 91 INSERT [dbo].[admin_user] ([user_name], [pass_word], [user_full_name], [user_status], [last_lgoin_date], [last_login_ip], [creator_name], [creator_date], [modifi_name], [modifi_date], [user_img]) VALUES (N'test', N'dc2e86a6ae8315a3da26cae880baae8e', N'测试账户', 1, CAST(N'2019-05-21T11:29:30.137' AS DateTime), N'::1', N'admin', CAST(N'2019-05-05T14:02:23.687' AS DateTime), NULL, NULL, NULL) 92 SET IDENTITY_INSERT [dbo].[admin_user_role_relation] ON 93 94 INSERT [dbo].[admin_user_role_relation] ([id], [user_name], [role_id], [creator_name], [creator_date]) VALUES (40, N'admin', 2, N'admin', CAST(N'2019-05-01T00:00:00.000' AS DateTime)) 95 INSERT [dbo].[admin_user_role_relation] ([id], [user_name], [role_id], [creator_name], [creator_date]) VALUES (120, N'admin', 1, N'admin', CAST(N'2019-05-01T00:00:00.000' AS DateTime)) 96 INSERT [dbo].[admin_user_role_relation] ([id], [user_name], [role_id], [creator_name], [creator_date]) VALUES (123, N'test', 2, N'admin', CAST(N'2019-05-05T14:02:23.687' AS DateTime)) 97 INSERT [dbo].[admin_user_role_relation] ([id], [user_name], [role_id], [creator_name], [creator_date]) VALUES (124, N'adm', 1, N'admin', CAST(N'2019-05-28T12:44:12.380' AS DateTime)) 98 INSERT [dbo].[admin_user_role_relation] ([id], [user_name], [role_id], [creator_name], [creator_date]) VALUES (125, N'adm', 2, N'admin', CAST(N'2019-05-28T12:44:12.380' AS DateTime)) 99 SET IDENTITY_INSERT [dbo].[admin_user_role_relation] OFF 100 INSERT [dbo].[dictionary_table] ([dt_key], [dt_type_key], [dt_name], [dt_status], [dt_orderby], [creator_name], [creator_date], [modifi_name], [modifi_date]) VALUES (N'fa-sex-false', N'fa-sex', N'女', 1, CAST(1.00 AS Decimal(18, 2)), N'admin', CAST(N'2019-05-07T13:51:17.207' AS DateTime), NULL, NULL) 101 INSERT [dbo].[dictionary_table] ([dt_key], [dt_type_key], [dt_name], [dt_status], [dt_orderby], [creator_name], [creator_date], [modifi_name], [modifi_date]) VALUES (N'fa-sex-true', N'fa-sex', N'男', 1, CAST(0.00 AS Decimal(18, 2)), N'admin', CAST(N'2019-05-07T13:50:48.100' AS DateTime), NULL, NULL) 102 INSERT [dbo].[dictionary_type_table] ([dt_type_key], [dt_type_name], [dt_type_remark], [dt_type_orderby], [creator_name], [creator_date], [modifi_name], [modifi_date]) VALUES (N'fa-sex', N'性别', N'性别', CAST(0 AS Decimal(18, 0)), N'admin', CAST(N'2019-05-07T13:49:48.733' AS DateTime), NULL, NULL) 103 INSERT [dbo].[module_db] ([module_code], [module_name], [parent_code], [module_level], [is_menu], [is_action], [action_url], [order_by], [module_status], [creator_name], [creator_date], [modifi_name], [modifi_date]) VALUES (N'fa-book', N'字典管理', N'fa-puzzle-piece', 3, 1, 1, N'DictionaryManager/List', CAST(0 AS Decimal(10, 0)), 1, N'admin', CAST(N'2019-05-01T00:00:00.000' AS DateTime), NULL, NULL) 104 INSERT [dbo].[module_db] ([module_code], [module_name], [parent_code], [module_level], [is_menu], [is_action], [action_url], [order_by], [module_status], [creator_name], [creator_date], [modifi_name], [modifi_date]) VALUES (N'fa-desktop', N'系统管理', N'yixin_public', 2, 1, 2, N'', CAST(0 AS Decimal(10, 0)), 1, N'admin', CAST(N'2019-05-01T00:00:00.000' AS DateTime), N'admin', CAST(N'2019-05-01T00:00:00.000' AS DateTime)) 105 INSERT [dbo].[module_db] ([module_code], [module_name], [parent_code], [module_level], [is_menu], [is_action], [action_url], [order_by], [module_status], [creator_name], [creator_date], [modifi_name], [modifi_date]) VALUES (N'fa-graduation-cap', N'模块菜单管理', N'fa-desktop', 3, 1, 1, N'ModuleManager/list', CAST(3 AS Decimal(10, 0)), 1, N'admin', CAST(N'2019-05-01T00:00:00.000' AS DateTime), N'admin', CAST(N'2019-05-01T00:00:00.000' AS DateTime)) 106 INSERT [dbo].[module_db] ([module_code], [module_name], [parent_code], [module_level], [is_menu], [is_action], [action_url], [order_by], [module_status], [creator_name], [creator_date], [modifi_name], [modifi_date]) VALUES (N'fa-paw', N'角色管理', N'fa-desktop', 3, 1, 1, N'rolemanager/list', CAST(1 AS Decimal(10, 0)), 1, N'admin', CAST(N'2019-05-01T00:00:00.000' AS DateTime), NULL, NULL) 107 INSERT [dbo].[module_db] ([module_code], [module_name], [parent_code], [module_level], [is_menu], [is_action], [action_url], [order_by], [module_status], [creator_name], [creator_date], [modifi_name], [modifi_date]) VALUES (N'fa-puzzle-piece', N'配置管理', N'yixin_public', 2, 1, 2, N'', CAST(2 AS Decimal(10, 0)), 1, N'admin', CAST(N'2019-05-01T00:00:00.000' AS DateTime), NULL, NULL) 108 INSERT [dbo].[module_db] ([module_code], [module_name], [parent_code], [module_level], [is_menu], [is_action], [action_url], [order_by], [module_status], [creator_name], [creator_date], [modifi_name], [modifi_date]) VALUES (N'fa-th-list', N'字典类别管理', N'fa-puzzle-piece', 3, 1, 1, N'DictionaryTypeManager/List', CAST(1 AS Decimal(10, 0)), 1, N'admin', CAST(N'2019-05-01T00:00:00.000' AS DateTime), N'admin', CAST(N'2019-05-01T00:00:00.000' AS DateTime)) 109 INSERT [dbo].[module_db] ([module_code], [module_name], [parent_code], [module_level], [is_menu], [is_action], [action_url], [order_by], [module_status], [creator_name], [creator_date], [modifi_name], [modifi_date]) VALUES (N'fa-user', N'用户管理', N'fa-desktop', 3, 1, 1, N'AdminUserManager/list', CAST(3 AS Decimal(10, 0)), 1, N'admin', CAST(N'2019-05-01T00:00:00.000' AS DateTime), NULL, NULL) 110 INSERT [dbo].[module_db] ([module_code], [module_name], [parent_code], [module_level], [is_menu], [is_action], [action_url], [order_by], [module_status], [creator_name], [creator_date], [modifi_name], [modifi_date]) VALUES (N'yixin_public', N'XX公共平台', N'', 1, 1, 2, N'', CAST(0 AS Decimal(10, 0)), 1, N'admin', CAST(N'2019-05-01T00:00:00.000' AS DateTime), N'admin', NULL) 111 SET IDENTITY_INSERT [dbo].[role_db] ON 112 113 INSERT [dbo].[role_db] ([role_id], [role_name], [role_status], [creator_name], [creator_date], [modifi_name], [modifi_date]) VALUES (1, N'管理员', 1, N'admin', CAST(N'2019-05-01T00:00:00.000' AS DateTime), N'admin', CAST(N'2019-05-01T00:00:00.000' AS DateTime)) 114 INSERT [dbo].[role_db] ([role_id], [role_name], [role_status], [creator_name], [creator_date], [modifi_name], [modifi_date]) VALUES (2, N'用户', 1, N'admin', CAST(N'2019-05-01T00:00:00.000' AS DateTime), N'admin', CAST(N'2019-05-21T11:29:05.307' AS DateTime)) 115 SET IDENTITY_INSERT [dbo].[role_db] OFF 116 SET IDENTITY_INSERT [dbo].[role_module_relation] ON 117 118 INSERT [dbo].[role_module_relation] ([id], [role_id], [module_code], [creator_name], [creator_date]) VALUES (127, 1, N'yixin_public', N'admin', CAST(N'2019-05-01T00:00:00.000' AS DateTime)) 119 INSERT [dbo].[role_module_relation] ([id], [role_id], [module_code], [creator_name], [creator_date]) VALUES (128, 1, N'fa-desktop', N'admin', CAST(N'2019-05-01T00:00:00.000' AS DateTime)) 120 INSERT [dbo].[role_module_relation] ([id], [role_id], [module_code], [creator_name], [creator_date]) VALUES (131, 1, N'fa-puzzle-piece', N'admin', CAST(N'2019-05-01T00:00:00.000' AS DateTime)) 121 INSERT [dbo].[role_module_relation] ([id], [role_id], [module_code], [creator_name], [creator_date]) VALUES (132, 1, N'fa-paw', N'admin', CAST(N'2019-05-01T00:00:00.000' AS DateTime)) 122 INSERT [dbo].[role_module_relation] ([id], [role_id], [module_code], [creator_name], [creator_date]) VALUES (133, 1, N'fa-graduation-cap', N'admin', CAST(N'2019-05-01T00:00:00.000' AS DateTime)) 123 INSERT [dbo].[role_module_relation] ([id], [role_id], [module_code], [creator_name], [creator_date]) VALUES (134, 1, N'fa-user', N'admin', CAST(N'2019-05-01T00:00:00.000' AS DateTime)) 124 INSERT [dbo].[role_module_relation] ([id], [role_id], [module_code], [creator_name], [creator_date]) VALUES (135, 1, N'fa-th-list', N'admin', CAST(N'2019-05-01T00:00:00.000' AS DateTime)) 125 INSERT [dbo].[role_module_relation] ([id], [role_id], [module_code], [creator_name], [creator_date]) VALUES (136, 1, N'fa-book', N'admin', CAST(N'2019-05-01T00:00:00.000' AS DateTime)) 126 INSERT [dbo].[role_module_relation] ([id], [role_id], [module_code], [creator_name], [creator_date]) VALUES (1226, 2, N'yixin_public', N'admin', CAST(N'2019-05-21T11:29:05.307' AS DateTime)) 127 INSERT [dbo].[role_module_relation] ([id], [role_id], [module_code], [creator_name], [creator_date]) VALUES (1227, 2, N'afghfeat', N'admin', CAST(N'2019-05-21T11:29:05.307' AS DateTime)) 128 INSERT [dbo].[role_module_relation] ([id], [role_id], [module_code], [creator_name], [creator_date]) VALUES (1228, 2, N'fa-puzzle-piece', N'admin', CAST(N'2019-05-21T11:29:05.307' AS DateTime)) 129 INSERT [dbo].[role_module_relation] ([id], [role_id], [module_code], [creator_name], [creator_date]) VALUES (1229, 2, N'fa-book', N'admin', CAST(N'2019-05-21T11:29:05.307' AS DateTime)) 130 INSERT [dbo].[role_module_relation] ([id], [role_id], [module_code], [creator_name], [creator_date]) VALUES (1230, 2, N'fa-th-list', N'admin', CAST(N'2019-05-21T11:29:05.307' AS DateTime)) 131 SET IDENTITY_INSERT [dbo].[role_module_relation] OFF 132 EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'用户名' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'admin_user', @level2type=N'COLUMN',@level2name=N'user_name' 133 GO 134 EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'用户密码 ' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'admin_user', @level2type=N'COLUMN',@level2name=N'pass_word' 135 GO 136 EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'用户全名' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'admin_user', @level2type=N'COLUMN',@level2name=N'user_full_name' 137 GO 138 EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'用户状态 1:有效 2:无效' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'admin_user', @level2type=N'COLUMN',@level2name=N'user_status' 139 GO 140 EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'最后登录日期' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'admin_user', @level2type=N'COLUMN',@level2name=N'last_lgoin_date' 141 GO 142 EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'最后登录ip' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'admin_user', @level2type=N'COLUMN',@level2name=N'last_login_ip' 143 GO 144 EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'创建人登录名' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'admin_user', @level2type=N'COLUMN',@level2name=N'creator_name' 145 GO 146 EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'创建日期' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'admin_user', @level2type=N'COLUMN',@level2name=N'creator_date' 147 GO 148 EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'修改人登录名' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'admin_user', @level2type=N'COLUMN',@level2name=N'modifi_name' 149 GO 150 EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'修改日期' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'admin_user', @level2type=N'COLUMN',@level2name=N'modifi_date' 151 GO 152 EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'创建人登录名' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'admin_user_role_relation', @level2type=N'COLUMN',@level2name=N'creator_name' 153 GO 154 EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'创建时间' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'admin_user_role_relation', @level2type=N'COLUMN',@level2name=N'creator_date' 155 GO 156 EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'字典key' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'dictionary_table', @level2type=N'COLUMN',@level2name=N'dt_key' 157 GO 158 EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'字典类别key' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'dictionary_table', @level2type=N'COLUMN',@level2name=N'dt_type_key' 159 GO 160 EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'字典名称' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'dictionary_table', @level2type=N'COLUMN',@level2name=N'dt_name' 161 GO 162 EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'字典状态 1:有效 2:无效' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'dictionary_table', @level2type=N'COLUMN',@level2name=N'dt_status' 163 GO 164 EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'排序字段' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'dictionary_table', @level2type=N'COLUMN',@level2name=N'dt_orderby' 165 GO 166 EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'创建人登陆名' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'dictionary_table', @level2type=N'COLUMN',@level2name=N'creator_name' 167 GO 168 EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'创建日期' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'dictionary_table', @level2type=N'COLUMN',@level2name=N'creator_date' 169 GO 170 EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'修改人登录名' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'dictionary_table', @level2type=N'COLUMN',@level2name=N'modifi_name' 171 GO 172 EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'修改日期' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'dictionary_table', @level2type=N'COLUMN',@level2name=N'modifi_date' 173 GO 174 EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'字典类别' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'dictionary_type_table', @level2type=N'COLUMN',@level2name=N'dt_type_key' 175 GO 176 EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'字典类别名称' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'dictionary_type_table', @level2type=N'COLUMN',@level2name=N'dt_type_name' 177 GO 178 EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'字典类别备注' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'dictionary_type_table', @level2type=N'COLUMN',@level2name=N'dt_type_remark' 179 GO 180 EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'创建人' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'dictionary_type_table', @level2type=N'COLUMN',@level2name=N'creator_name' 181 GO 182 EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'创建时间' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'dictionary_type_table', @level2type=N'COLUMN',@level2name=N'creator_date' 183 GO 184 EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'修改人' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'dictionary_type_table', @level2type=N'COLUMN',@level2name=N'modifi_name' 185 GO 186 EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'修改时间' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'dictionary_type_table', @level2type=N'COLUMN',@level2name=N'modifi_date' 187 GO 188 EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'模块code' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'module_db', @level2type=N'COLUMN',@level2name=N'module_code' 189 GO 190 EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'模块名称' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'module_db', @level2type=N'COLUMN',@level2name=N'module_name' 191 GO 192 EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'父模块code' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'module_db', @level2type=N'COLUMN',@level2name=N'parent_code' 193 GO 194 EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'模块级别' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'module_db', @level2type=N'COLUMN',@level2name=N'module_level' 195 GO 196 EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'是否是菜单 1:菜单 2:不是菜单' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'module_db', @level2type=N'COLUMN',@level2name=N'is_menu' 197 GO 198 EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'是否是菜单 1:请求 2:不是菜单' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'module_db', @level2type=N'COLUMN',@level2name=N'is_action' 199 GO 200 EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'请求url' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'module_db', @level2type=N'COLUMN',@level2name=N'action_url' 201 GO 202 EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'排序字段' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'module_db', @level2type=N'COLUMN',@level2name=N'order_by' 203 GO 204 EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'模块状态 1:有效 2:无效' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'module_db', @level2type=N'COLUMN',@level2name=N'module_status' 205 GO 206 EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'创建人用户名' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'module_db', @level2type=N'COLUMN',@level2name=N'creator_name' 207 GO 208 EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'创建日期' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'module_db', @level2type=N'COLUMN',@level2name=N'creator_date' 209 GO 210 EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'修改用户名' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'module_db', @level2type=N'COLUMN',@level2name=N'modifi_name' 211 GO 212 EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'修改日期' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'module_db', @level2type=N'COLUMN',@level2name=N'modifi_date' 213 GO 214 EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'角色id' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'role_module_relation', @level2type=N'COLUMN',@level2name=N'role_id' 215 GO 216 EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'模块code' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'role_module_relation', @level2type=N'COLUMN',@level2name=N'module_code' 217 GO 218 EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'创建用户名' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'role_module_relation', @level2type=N'COLUMN',@level2name=N'creator_name' 219 GO 220 EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'创建时间' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'role_module_relation', @level2type=N'COLUMN',@level2name=N'creator_date' 221 GO
源码 : https://github.com/linjierd/Jurisdiction
[仅限于下载学习,不允许用于商业用途]