Unfortunately that did not work for me. I ended up using the check()
method in my app_controller to determine access:
var $userId = null;
function beforeFilter()
{
if (null != ($this->userId = $this->Auth->user('id')))
{
// what user is trying to access
$page = $this->params['controller'] . '/' .
$this->params
['action'];
// check if user can access page.
if (!$this->Acl->check(array('User' => $this->userId),
$page))
$this->Redirect->flashWarning('You do not have
access to this
page.', array('controller' =>'pages', 'action' => 'unauthorized'));
}
}
Where Redirect->flashWarning is a flash/redirect method in my own
RedirectComponent.
Everything seems to work just fine. Is there a reason I shouldn't use
this method?
Trevor
On Apr 6, 5:38 am, "Dave Maharaj :: WidePixels.com"
<[email protected]> wrote:
> In your controllers do you have something like:
>
> function beforeFilter()
> {
> parent::beforeFilter();
>
> $this->Auth->allowedActions = array('register', 'index');// allow
> public access to these only
> $this->Auth->autoRedirect = true;
> }
>
> Dave
>
>
>
> -----Original Message-----
> From: trevorsg [mailto:[email protected]]
> Sent: April-06-09 2:07 AM
> To: CakePHP
> Subject: Woes of ACL
>
> Hey guys,
>
> I've been trying to solve an issue with ACL for two days now, but I just
> can't find any answers.
>
> Basically I'm trying to set up an application to work with Auth and Acl. I
> followed the tutorials in the Cookbook - I created the database tables, all
> of the ACOs and AROs are created. Then, I ran a deny for a particular user
> on the root node. But no matter what I do, every user has access to all
> parts of the application.
>
> I have started this app from scratch twice, and I get the same outcome each
> time. I think there is something fundamental that I'm missing.
> The AclComponent::check() method returns the proper boolean value for
> ARO/ACO pairs that I pass to it, but still users are never denied access to
> any parts of the site.
>
> Hopefully someone here can give me a steer in the right direction. I am
> happy to provide code or extra information if needed.
>
> Thanks very much for any help!
>
> Cheers,
> Trevor
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---