User Permissions

I'm working on a project and I have been asked to add user permissions so an admin user can select the different sections a user has privileges for.

My thinking was have a checkbox for each of the sections. When the form is submitted add the chosen sections to an array use the PHP function serialize to store the array in the database.

And when the user logins in unserialize the array store it in the session data(encrypted), then when the user access the section check the id is in the array, if it is then permission is granted.

I wanted to see if anyone had an opinion if this was a good/bad way of doing this? I haven't actually written any code yet for this as I'm still planning it out.

[eluser]Cristian Gilè[/eluser]
Yes, this is a simple and valid solution but, for my projects, I adopt Zend ACL that provides a lightweight and flexible access control list (ACL) for privileges management (

Cristian Gilè

Thanks Christian. Just had at the Zend ACL, looks really interesting I will keep it in mind for future project.

I think for now I will stick with my solution mainly for ease of implementation in a half built project. I wish I had known about it earlier!!

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.