创建SQL角色与权限用到的五个数据库表

下文为您列举的五张表是在创建SQL角色与权限时需要用到的,如果您在创建SQL角色等方面遇到过问题,不妨一看,对您会有所启迪。

创新互联专注于韶关网站建设服务及定制,我们拥有丰富的企业做网站经验。 热诚为您提供韶关营销型网站建设,韶关网站制作、韶关网页设计、韶关网站官网定制、微信小程序开发服务,打造韶关网络公司原创品牌,更为您提供韶关网站排名全网营销落地服务。

创建SQL角色与权限要用到五张数据库表:
1,SQL用户信息表

 
 
 
  1. create table employee  
  2. (  
  3.    userid varchar(50) not null,  --用户ID  
  4.    username varchar(100),    --用户名  
  5.    userpassword varchar(100), --密码  
  6.    ..  
  7.    ..  
  8.    ..  
  9.    ..  
  10. )  
  11. alter table employee        --主键  
  12. add constraint pk_employee_userid primary key (userid) 

2,SQL角色表

 
 
 
  1. create table role  
  2. (  
  3.   roleid varchar(50) not null, --角色Id  
  4.   rolename varchar(100),        --角色名称  
  5. )  
  6. alter table tole     --主键  
  7. add constraint pk_role_roleid primary key (roleid) 

3,SQL权限表

 
 
 
  1. create table popedom  
  2. (  
  3.   popedomid int identity(1,1) not null, --权限Id  
  4.   popedomname varchar(100), --权限名称  
  5.   popedomfatherid int,      --权限父ID  
  6.   popedomurl varchar(100)   --树的连接路径  
  7.   ..  
  8.   ..  
  9. )  
  10. er table popedom       --主键  
  11. add constraint PK_popedom primary key (popedomid)   

添加数据如
insert into popedom values('我的办公桌',0,'')
insert into popedom values('电子邮箱',1,'../mail/EmaiolManage.aspx')
(添加数据的原则是一级接点的popedomfatherid 为0,如果是(我的办公桌)下面的接点,它们的popedomfatherid为(我的办公桌)的主键)

4,用户与角色关系表

 
 
 
  1. create table user_role  
  2. (  
  3.  connectionid int identity(1,1) not null, --关系ID  
  4.   userid varchar(50) not null,   --管理员表ID  
  5.   roleid varchar(50) not null   --角色Id  
  6. )  
  7. alter table user_role    --主键  
  8. add constraint PK_admin_role primary key(connectionid)   

5,角色与权限关系表

 
 
 
  1. create table role_popedom     --角色与权限表  
  2. (  
  3.   connectionid int identity(1,1), --关系Id  
  4.   roleid varchar(50) not null,      --角色ID  
  5.   popedomid int not null,   --权限Id  
  6.   popedom    int   --权限 (1为可用,2为不可用)  
  7. )  
  8. alter table role_popedom       --主键  
  9. add constraint PK_role_popedom primary key(connectionid) --主键  

网站标题:创建SQL角色与权限用到的五个数据库表
文章源于:http://www.zyruijie.cn/qtweb/news48/1548.html

网站建设、网络推广公司-创新互联,是专注品牌与效果的网站制作,网络营销seo公司;服务项目有等

广告

声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源: 创新互联