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
[仅限于下载学习,不允许用于商业用途]