1.开发人员在设计和实现系统时,关联资源和操作,并创造权限;
2.管理员可以为用户分配权限;
3.用户使用权限。
create table Users
(
ID int identity(1,1) primary key,
UserName varchar(16),
Password binary(16)
);
create table Roles
(
ID int identity(1,1) primary key,
Name nvarchar(10)
);
create table Permissions
(
ID int identity(1,1) primary key,
Name nvarchar(10)
);
create table UserRole
(
ID int identity(1,1) primary key,
UserID int foreign key references Users(ID),
RoleID int foreign key references Roles(ID)
);
create table RolePermission
(
ID int identity(1,1) primary key,
RoleID int foreign key references Roles(ID),
PermissionID int foreign key references Permissions(ID),
Allowed smallint default(0)
)
(
ID int identity(1,1) primary key,
UserName varchar(16),
Password binary(16)
);
create table Roles
(
ID int identity(1,1) primary key,
Name nvarchar(10)
);
create table Permissions
(
ID int identity(1,1) primary key,
Name nvarchar(10)
);
create table UserRole
(
ID int identity(1,1) primary key,
UserID int foreign key references Users(ID),
RoleID int foreign key references Roles(ID)
);
create table RolePermission
(
ID int identity(1,1) primary key,
RoleID int foreign key references Roles(ID),
PermissionID int foreign key references Permissions(ID),
Allowed smallint default(0)
)
本文转自Silent Void博客园博客,原文链接:http://www.cnblogs.com/happyhippy/archive/2007/06/01/767666.html,如需转载请自行联系原作者