在數據庫中新建個表PermissionItem表用於保存權限ID和頁面路徑的關系一個權限ID可以有多個頁面一般同一個權限ID下的頁面是為了實現同一個功能PermissionList表用於保存用戶所具有的權限
Code
USE [UrlAuthorize]
GO
/****** Object: Table [dbo][PermissionList] Script Date: // :: ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo][PermissionList](
[ID] [int] IDENTITY() NOT NULL
[PermissionID] [int] NOT NULL
[UserID] [int] NOT NULL
CONSTRAINT [PK_PermissionList] PRIMARY KEY CLUSTERED
(
[ID] ASC
)WITH (PAD_INDEX = OFF STATISTICS_NORECOMPUTE = OFF IGNORE_DUP_KEY = OFF ALLOW_ROW_LOCKS = ON ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET IDENTITY_INSERT [dbo][PermissionList] ON
INSERT [dbo][PermissionList] ([ID] [PermissionID] [UserID]) VALUES ( )
INSERT [dbo][PermissionList] ([ID] [PermissionID] [UserID]) VALUES ( )
SET IDENTITY_INSERT [dbo][PermissionList] OFF
/****** Object: Table [dbo][PermissionItem] Script Date: // :: ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo][PermissionItem](
[ID] [int] IDENTITY() NOT NULL
[PermissionID] [int] NOT NULL
[Name] [nvarchar]() NOT NULL
[Route] [varchar]() NOT NULL
CONSTRAINT [PK_PermissionItem] PRIMARY KEY CLUSTERED
(
[ID] ASC
)WITH (PAD_INDEX = OFF STATISTICS_NORECOMPUTE = OFF IGNORE_DUP_KEY = OFF ALLOW_ROW_LOCKS = ON ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
SET IDENTITY_INSERT [dbo][PermissionItem] ON
INSERT [dbo][PermissionItem] ([ID] [PermissionID] [Name] [Route]) VALUES ( N測試頁 N/Test/Page)
INSERT [dbo][PermissionItem] ([ID] [PermissionID] [Name] [Route]) VALUES ( N測試頁 N/Test/Page)
INSERT [dbo][PermissionItem] ([ID] [PermissionID] [Name] [Route]) VALUES ( N測試頁 N/Test/Page)
INSERT [dbo][PermissionItem] ([ID] [PermissionID] [Name] [Route]) VALUES ( N測試頁 N/Test/Page)
INSERT [dbo][PermissionItem] ([ID] [PermissionID] [Name] [Route]) VALUES ( N測試頁 N/Test/Page)
SET IDENTITY_INSERT [dbo][PermissionItem] OFF
.NET編程免費提供,內容來源於互聯網,本文歸原作者所有。