我目前有一个项目,其中需要在 MVC 中重写具有基于奇怪角色的设置的程序 PHP 站点(可能是 codeigniter,因为我是 MVC 的新手),我无法完全了解最佳的继续方式。
当前站点使用某种前端控制器来检查数据库中登录用户的安全级别,并根据反映安全级别的目录结构构建页面。
IE
目录结构:
root
-admin (sees everything and everyone elses subordinates)
-- Reports listing managers, and their users
-- CRUD for managers and their reports
-- CRUD for users and their reports (types listed below)
-manager (has users as subordinates, and can see all data related to them)
-- Reports listing the manager's users
-- CRUD for users and their reports (types listed below)
-user (Can only see their own information)
-- Reports listing the users information (lists, calendars, calls, etc.)
-- CRUD for users reports (types listed above)
db 用户表 psuedo
1 = admin
2 = manager
3 = user
UserAccountTable
id
pass
user
email
security level (1,2,3)
manager Table
manager ID
User Account ID
other fields containing personal info
user Info Table
user Info id
User Account ID
Manager ID
other fields containing personal info
前控制器伪
load header
load menu
determine level from db
if 1 load requested file from admin folder
if 2 load requested file from manager folder
if 3 load requested file from user folder
load footer
主要问题:
当前设计中是否存在任何突出的固有问题(如果您需要有关当前结构的更多细节来回答,请告诉我)?
鉴于当前站点的上述结构,在 MVC 结构中使用当前自上而下的安全类型(1 看到 2 和 3,2 看到 3,3 只看到 3)重新设计安全性将是一种可靠的方法,是吗?可以对数据库进行最小的更改吗?
我不是在寻找代码(尽管如果有人知道这样的事情,我可以看看以收集一些理解,那将是有帮助的),但更多的是对过程的概念性理解。