building Role based application

2019-02-07 06:55发布

问题:

I have to make a small website

where I have 7 type of users. which can login into system.

some of users have permissions to only add equipments and others can add/edit. some of them can only view.

There will be some common fields for all users adding equipments in system and some fields will be user specific.

I have to track all changes in equipments with user changing equipments.

Can any one explain what will be best way to do this job.

Way in the sense table structure for users and tracking changes in equipments and users tracking for both login and what changes done by them.

Am using php and mysql database.

I don't want to go for CMS,Frameworks. It's a small application.

回答1:

It sounds like you are going to need a role-based access control system. Developing one is not really a trivial task, so as already suggested, finding a framework or ready-made class that does the job would be a worthwhile start.

However, there's plenty of information out there on how to create one. Here's a few links to get you started:

Stackoverflow

Role Based Access Control
Role-based access to pages in PHP (dead link)

Other sites

A Role-Based Access Control (RBAC) system for PHP
Fine Grained Role Based Access Control (RBAC) system
Patterns Tutorial Series (part 1): RBAC Domain Model

A search for PHP RBAC will no doubt reveal many more.