我正在处理有关授权和身份验证的项目的一部分。但是我在具有不同权限的同一类型用户中遇到了问题。例如,
UserPermission Table
------------------------
UserId(int) //this is a AUTO INCREMENT primary key
UserBasicInformation(bool)
UserOperation(bool)
UserEntrance(bool)
UserExit(bool)
UserReport(bool)
AdminBasicInformation(bool)
AdminOperation(bool)
AdminSettings(bool)
UserPermissionId(int) // in this field I've kept key of users from UserDefs table
UserTitle(nvarchar)
UserDefs (brief)
--------------------------
UserId ///this is a AUTO INCREMENT primary key
UserType(int) //1,2
UserName(nvarchar) // admin,user
UserTitle(nvarchar) // alex,sara,....
UserId UserType UserName UserTitle
--------------------------------------------
1 1 Admin alex
2 1 Admin sara
3 2 user steve
4 2 user nicolas
这是 UserPermision表,我填充以便更好地理解。
UserId UserBasicInformation UserOperation UserEntrance UserExit
-----------------------------------------------------------------------------
1 0 0 0 0
2 0 0 0 0
3 1 1 1
UserReport AdminBasicInformation AdminOperation AdminSettings
-----------------------------------------------------------------------------
0 1 1 0
0 0 1 1
0 0 0 0
UserPermissionId UserTitle
-------------------------------
1 alex
1 sara
2 steve
如果你看看userDefs表我有两个管理员或两个用户,但他们在UserPermission表中是不同的权限。但现在,我不知道如何实现它。有些人说我使用会话你有什么想法?实际上,我会阅读userpermission表。