I agree with Dardo.  The key is to take a good look at the queries
being generated.

I am using Auth and ACL using 'crud' mode.  It works fine as
advertised.  I am also using the Acl Behavior.  I assume you are using
that, but just in case, you need to make sure you are using the Acl
Behavior in your user model and that the parentNode() function in your
User model is returning the correct value.

I believe that one of the older tutorials has outdated code in it's
parentNode() code.  If it makes you feel any better, I would say I
struggled with Auth and ACL for more than a week before I really had
it working the way I wanted it to.

-Aran


On Apr 2, 9:01 am, mbavio <[EMAIL PROTECTED]> wrote:
> I was doing exactly the same thing you want to do:
>
> function isAuthorized() {
> if ($this->Acl->check(array('foreign_key' => $this->Auth->user('id'),
> 'model' => 'User'),
>                         
> inflector::camelize($this->name).'/'.$this->params['action'],
>                         '*')) {
>                                 return true;
>                         }
>                 else {
>                                 return false;
>                 }
>
> and it works. However, it doesnt seem like the correct aproach to Auth/
> ACL. I´m trying to change it, but in case you want to continue with
> this way, ask me if you need some help.
>
> Cheers,
> mbavio
>
> On Apr 1, 7:50 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
> wrote:
>
> > Hi,
>
> > I decided on taking a different route and cutting out the ACL all
> > together. I changed the Auth system to be based on the controller
> > rather then actions
>
> > //$this->Auth->authorize = 'actions';
> > $this->Auth->authorize = 'controller';
>
> > This allows me to roll my own system using the
> > <ControllerName>::isAuthorized() function in each controller. For my
> > purposes this seems to be doing the trick.
>
> > thanks for the help.
>
> > On Mar 31, 10:11 pm, "Dardo Sordi Bogado" <[EMAIL PROTECTED]>
> > wrote:
>
> > > Get the SQL queries cake is making, post the here if that doesn't
> > > clarify the issue. Also check with an updated version of cake, there
> > > are some ACL related bugs that have been fixed in the branch. It will
> > > useful to help you, if  you include your Auth setup.
>
> > > On Mon, Mar 31, 2008 at 10:26 PM, Sam Sherlock <[EMAIL PROTECTED]> wrote:
> > > > AFAIK login and login are special functions, that don't require acl 
> > > > branches
> > > > (is it fair to call them that, part of a tree)
>
> > > > it won't solve the issue, are other controlers working with acl?
>
> > > > On 31/03/2008, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> > > > > Hi,
>
> > > > > I have spent hours and hours struggling with the ACL. It is about the
> > > > > most frustrating thing I have worked with. I have to use it because
> > > > > its inheritable permissions (if anyone has any alternatives to use I
> > > > > am all ears). Anyway, this is what my trees look like:
>
> > > > > Welcome to CakePHP v1.2.0.6311 beta Console
> > > > > -----------------------------------------------
> > > > > Aco tree:
> > > > > -----------------------------------------------
> > > > >   [1]ROOT
>
> > > > >     [2]Users
>
> > > > >       [3]menu
>
> > > > >       [6]logout
>
> > > > >     [4]Pages
>
> > > > >     [5]Candidates
>
> > > > >       [8]index
>
> > > > >     [7]Groups
>
> > > > > -------------------------
> > > > > Aro tree:
> > > > > -------------------------
> > > > >   [1]Admin
>
> > > > >     [2]
>
> > > > >     [3]
>
> > > > >   [4]Clients
>
> > > > >     [5]Client1
>
> > > > >       [6]client1user
>
> > > > >     [7]Client2
>
> > > > >       [8]client2user
> > > > > -----------------------------------------------
> > > > > So far so good. Then I grant access for Clients to index, and I check
> > > > > that client1user successfully inherited permission, which it does.
>
> > > > > >cake acl grant Clients index all
> > > > > >cake acl check client1user index all
> > > > > >>>client1user is allowed.
>
> > > > > Then when I login as client1user and go to /Candidates/index, I get
> > > > > redirected because the Acl thinks I don't have permission.
>
> > > > > Does anyone have any idea why this is happening and what I can do
> > > > > about it??
>
> > > > > *frustrated*
>
> > > > > Thanks in advance!
> > > > > -Eric
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" 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