Welcome Guest, Not a member yet? Register   Sign In
Creating an admin area
#5

[eluser]Daniel Peraza[/eluser]
I faced the same problems when I first started to learn CI. I got really confused. I made a post at that time but it seems that I wasn't clear enough to get the lab technician's understanding. In the end I decided to take this approach:

- I created a base controller with all the stuff needed to check if the current user was logged in. If not, redirect to the login page. On the contrary, save some basic user information in the session and redirect to the admin page. All these things were implemented in the base controller's class methods.

- An admin controller, which extended the base controller class and actually perform the verification of the user's access rights. All common functionality shared by admins controllers was implemented here too.

- Several admin controller, which extended the admin controller, one for each of the DB tables to manage (the recommended approach to work with M-V-C as far as I have been taught). This eliminates the need for performing the access rights checks in every controller and centralizes the verification.

I posted to the forum the idea of implementing a kind of proxy pattern for factoring at runtime a version of the proper admin controller that suites the user's rights, thus, it would be impossible for a user to perform any action forbidden to her/his user group level, he/she will have exactly the rights needed to perform the actions he/she are allowed to do. But this is obviously more complicated and frequently unnecessary. It would take several levels of user group rights to be needed to do it.


Messages In This Thread
Creating an admin area - by El Forum - 02-06-2009, 10:38 AM
Creating an admin area - by El Forum - 02-12-2009, 04:12 PM
Creating an admin area - by El Forum - 02-12-2009, 04:57 PM
Creating an admin area - by El Forum - 02-12-2009, 06:58 PM
Creating an admin area - by El Forum - 02-13-2009, 12:27 PM
Creating an admin area - by El Forum - 02-23-2009, 03:14 AM
Creating an admin area - by El Forum - 02-23-2009, 05:25 AM
Creating an admin area - by El Forum - 02-24-2009, 02:58 AM
Creating an admin area - by El Forum - 02-24-2009, 06:04 AM
Creating an admin area - by El Forum - 02-25-2009, 07:08 AM
Creating an admin area - by El Forum - 02-25-2009, 07:23 AM
Creating an admin area - by El Forum - 02-26-2009, 08:31 PM
Creating an admin area - by El Forum - 02-27-2009, 07:21 AM
Creating an admin area - by El Forum - 04-09-2009, 08:37 AM
Creating an admin area - by El Forum - 04-09-2009, 09:49 AM
Creating an admin area - by El Forum - 04-09-2009, 09:54 AM



Theme © iAndrew 2016 - Forum software by © MyBB