dre1080 / warden

More than just a user database auth package for FuelPHP
http://dre1080.github.com/warden
MIT License
46 stars 11 forks source link

Better ACL support #9

Closed rclanan closed 12 years ago

rclanan commented 12 years ago

Would it be possible to add more support for ACL. Instead of just checking for the roles. Could it actually check that the role has permission to use the resource? More in terms of what SimpleAuth is doing with ACL or what Crynobone is doing in his hybrid project? (https://github.com/crynobone/fuel-hybrid/blob/master/classes/acl.php).

Thanks

ShonM commented 12 years ago

+1

dre1080 commented 12 years ago

+1, would this rather be an extra column in roles or a config option?

ShonM commented 12 years ago

It would be 4 extra tables. In the conventional ACL system, you have resources, actions, permissions, and the groups/users requesting access.

Examples; Resources = Admin, Cart, Blog Actions = Read, Write, Checkout, Post Permissions = (requestor, resource) so "Mindy, Admin" or "Mandy, Blog" Permission Actions = (requestor, resource, action) so "Mindy, Admin, Read" or "Tom, Cart, Checkout"

So to check user "Mindy" for access to "Read" the "Admin" panel, we would basically run something like this;

check $user->id for $action on $resource, or, \Warden::check($user, 'admin', array('read')) <- the last array would allow us to check for multiple actions.

Running the above would give Many access to Read the Admin control panel, since we defined her, the resource, the action, and applied them to each other.

Personal opinion: The presence of entires should be access = true, if you want to revoke access you remove the entry. That way you don't pollute your tables with much unneeded data.

rclanan commented 12 years ago

+1 for ShonM response!

dre1080 commented 12 years ago

ahh yes, +1, thanks!