Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Using ACL
  • I am trying to limit user to only some resources. I tried using ACL but can't figure out how to enable / use it. I am using SimpleAuth, login works, but I can't deny the user access to some resource. Could someone please give me a hint?
  • Hi, Auth::has_access(array($req->route->controller, $req->route->action) This is governed by your groups etc in config. Phil.
  • Phil, thanks for answering! Where is the right place to put this? In Controller_Common::before()?
    (where Controller_Common is some class all my Controllers extend) And then I just specify the roles in app/config/simpleauth.php? I am asking mostly to find the preferred way of doing things. I am quite sure I am not the first one to use authentication with FuelPHP. ;)
  • Hi Andy, Basically you put it where ever it is required. If you wish to allow global access to all controllers that extend Controller_Common using the rights allowed for this controller then yeah put it there but it can also be used at a controller method level etc... app/config/simpleauth.php
    Name your controllers and the various rights associated to them and their methods. It can be as fine grained as you want. eg.
    \Auth::has_access(array("comments", array("read", "post")) ;
    
    Phil.
  • Phil, thanks for the answer, appreciate it. Sometimes it's difficult to figure out what goes where. ;) Happy coding!
  • Your welcome :)
  • Hi, guys this really help.
    Can i apply ACL to modules, if i am developing my app based on modules

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion