Keep the Auth->mapActions like you have it in the beginning and then
do this:

$this->Acl->check('henry', 'Votes', $this->Auth-
>actionMap['restart']);

You are right that you will then be able to leave out the actions from
the aco tree.

-Aran

On May 29, 3:48 pm, mcjustin <[EMAIL PROTECTED]> wrote:
> Thanks for the info!
>
> How would you suggest I map them for the Acl lib to recognize them? I
> was using the Auth->actionMap, but the Acl lib doesn't refer to the
> Auth lib...
>
> I suppose that my controller code could do the mapping, but I'm
> wondering if there's already some wiring for this in the libs...
>
> I was hoping to leave actions out of my aco tree, and just have
> something like
>     Controllers
>     ----Surveys (with appropriate crud flags)
> Are you suggesting that I include them in the aco tree, like:
>     Controllers
>     ----Surveys (no crud flags)
>     --------index
>     --------restart
>     --------blahaction
>
> btw, your tutorial is very helpful as well!
>
> On May 29, 2:42 pm, aranworld <[EMAIL PROTECTED]> wrote:
>
> > This is a case where you should be using:
>
> > $this->Acl->check('aro_alias', 'CamelCaseController', 'crud action');
>
> > So, in your case, to find out if the logged in user 'henry' should be
> > able to access /votes/restart, and you have mapped restart to
> > 'update', then you do this:
>
> > if( $this->Acl->check('henry', 'Votes', 'update') ){
> >     $this->set('display_restart', TRUE);} else {
>
> >     $this->set('display_restart', FALSE);
>
> > }
>
> > On May 29, 11:50 am, mcjustin <[EMAIL PROTECTED]> wrote:
>
> > > I'm setting the following in one of my controllers' beforeFilter()
> > > function:
> > >     Auth->authorize = 'crud'
> > >     $this->Auth->mapActions(
> > >                     array('show'=>'read',
> > >                             'restart'=>'update',
> > >                             ));
>
> > > I was planning to check the following in the 'index' action before
> > > presenting a link to the 'restart' action.
> > >     Auth->isAuthorized('crud', 'restart', 'aroX');
>
> > > But in 'crud' mode, Auth->isAuthorized ignores the second param, and
> > > simply checks the Acl for the current action ($this->params['action']). I 
> > > thought the intention of 'crud' mode was to be
>
> > > check actions of various names against the  CRUD access defined in the
> > > Acl; I'd like to do that in the index action before I present links to
> > > other actions.
>
> > > I've worked around this by adding a 'crudForAnyAction' case to the
> > > isAuthorized method, but it seems that perhaps I'm using this multi-
> > > headed beast improperly...
>
> > > Any advice would be greatly appreciated!
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to