rbac数据库设计 mysql_基于角色的权限管理数据库设计(RBAC)

此文章来自也算赌徒的我的关于'基于角色的访问控制'的权限管理的数据库的设计

*/

use [master]

go

-- 检查数据库 [RBAC]是否存在,如果存在则删除(只测试用,不然会丢数据.)

-- Search from the sysdatabase to see that if the [RBAC] database

exist.

-- If exists then drop it else create it.

if exists(select * from sysdatabases where name = 'RBAC')

drop database [RBAC]

go

-- 创建数据库 [RBAC]

-- Create the database named by '[RBAC]'.

create database [RBAC]

go

-- 使用数据库 [RBAC]

-- Use the database of '[RBAC]'.

use [RBAC]

go

-- 创建 "用户" 数据表 [RBAC_User]

-- Create the datatable named by '[RBAC_User]' to save users.

create table [RBAC_User]

(

--用户编号

[User_ID] int primary key not null,

--用户名称

[User_Name] varchar(20) not null,

--用户密码

[User_PassWord] varchar(20) not null,

--用户状态

[User_Lock] bit not null

)

go

-- 添加测试数据

-- Add data for test

insert into [RBAC_User]

values(1,'FightingYang','PassWord',0);

go

insert into [RBAC_User] values(2,'Supper3000','Teacher',0);

go

insert into [RBAC_User] values(3,'JianzhongLi','Teacher',1);

go

select * from [RBAC_User]

go

-- 创建 "组" 数据表 [RBAC_Group]

-- Create the datatable named by '[RBAC_Group]' to save

groups.

create table [RBAC_Group]

(

--组编号

[Group_ID] int primary key not null,

--组名称

[Group_Name] varcha

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值