Sounds like a good approach - I'll give it a whirl. Thanks. Jeremy Burns Class Outfit
http://www.classoutfit.com On 13 Jan 2013, at 04:40:06, Jamie <[email protected]> wrote: > How does that help? Well, you asked how to access ACL information inside your > plugin. That's how. As for referencing the ACL component inside of your > helper, while technically possible, that's not the best practice since you'd > be mixing the view and controller layers (since helpers live in the view > layer and components in the controller layer). So that's why I suggested the > helper. > > The best method I've found, and which I've been using for a while now, is > actually to gather up the array of links that will be in your menu inside of > a component. Do all of your permissions checks there, and then set the > resulting array of links as a view variable. Then, use your helper to parse > out that array into your <ul> menu. That allows you to keep the permission > checking where it (arguably) belongs, in the controller layer, while letting > the view layer just focus on displaying the information you give to it. > > On Friday, January 11, 2013 10:09:43 PM UTC-8, Jeremy Burns wrote: > How does that help? Why wouldn't I reference the Acl component inside my > current helper? > > For clarity... the helper parses a config file an build up an menu that > contains one or many links - typically <li>s into a <ul>. I want to be sure > that the current user has permissions for 'this' action before adding the > <li>. > > Jeremy Burns > Class Outfit > > http://www.classoutfit.com > > On 12 Jan 2013, at 03:19:45, Jamie <[email protected]> wrote: > >> Do you mean that you want to use check the user's permissions inside your >> plugin's helper? In that case, I would write another helper that you can use >> to check all of the ACL permissions. >> >> On Thursday, January 10, 2013 9:21:54 PM UTC-8, Jeremy Burns wrote: >> I have a Navigation plugin that contains a helper. It's used for creating >> menus dynamically. I want to check a user's permissions via ACL before >> adding a menu item. How can I user the ACL component inside the plugin? >> >> -- >> Like Us on FaceBook https://www.facebook.com/CakePHP >> Find us on Twitter http://twitter.com/CakePHP >> >> --- >> 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]. >> Visit this group at http://groups.google.com/group/cake-php?hl=en. >> >> > > > -- > Like Us on FaceBook https://www.facebook.com/CakePHP > Find us on Twitter http://twitter.com/CakePHP > > --- > 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]. > Visit this group at http://groups.google.com/group/cake-php?hl=en. > > -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- 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]. Visit this group at http://groups.google.com/group/cake-php?hl=en.
