I've been trying to get Acl working for a long time now. I think I'm very close, but I'm tired of doing endless Google searches for an answer, so I'm just going to ask.
My Acl is all set up in the database, and Auth is working. It's the Acl check that I'm not getting. This article got me close: http://bakery.cakephp.org/articles/view/real-world-access-control But what is lacking is a way to generalize this. Like most articles & blog posts I've read about Acl, it focuses on setting up super- granular permissions, i.e., checking for one specific user. What I want to do (and what I imagine a lot of folks would find useful) is check the user on the fly in and see what permissions they have. So I apologize if I missed this somewhere, but it really has eluded me after about a month of trying. So without further complaining, here is my AppController class as it exists right now: class AppController extends Controller { var $components = array('Acl','Auth', 'Session'); var $helpers = array('Html', 'Javascript', 'Form'); function beforeFilter(){ $user = $this->Auth->identify(); $user_id = $user[0]; $page = $this->name.DS.$this->action; $access = $this->Acl->check($user_id, $page, '*'); if ($access === false) { $this->Session->setFlash("$page, $user_id"); } else { $this->Session->setFlash("$page, $user_id"); } } Right now, I'm just setting a flash message so I can debug this thing and see if the variables have the expected variables. Those who know more about this than I do will see that I'm clearly not using identify() correctly. But I think you can see what I'm trying to do. I want to retrieve the user info from the session and check it against the Acl permissions. How can I use AuthComponent::identify to get the user's id and then run the Acl check? I am at your mercy. Please help. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
