PHP - Good practice to apply multi-level PHP User Authorization -
Looking at a website site there are various web pages which can only be accessed by different groups of users. Say guest users can only access the welcome page / search page, while admin users can access the pages that update the DB, etc.
I have very little experience in this area and I would like to take some good practice with cleanliness / simple / safe implementation.
If possible, I would like to see some concrete examples / tutorials, even a book resource.
Thank you for your help
I have found that many applications are available online (Wordpress, Joomla, and many others) are very poorly organized in this area (in poor case, what do I do).
See how this works like Z Framework, CakePHP, Symphony for the MWC framework. MVC is used mostly for large projects which are more organized, so I am betting that they have done a lot of work on certification too. <2 p>
In 2 words, to work properly, all your page generation class (I recommend using OOP) should be obtained from a parent class, who will have access control methods. Or you can have classes with static functions for access control. Before any proceeding, ask these functions to check if the user has access to this functionality or not. Functionality can be divided into classes, with many ways (in MVC - Controllers and Action) you can store access information in the database: groupID, class, method, permission
, where permission is allowed to be a boolean Grants or rejection may occur. To speed up, to remove all user's permissions on the first query, store it in an array or object, so that the user does not make a query for each permission verification in the request, but instead the saved data is parsed
Comments
Post a Comment