Hi

I am trying to filter out records based on acl permissions.

I have my aro/acos and permissions set up but need a way to filter
results out from my "tickets" table based on the acl rules. I have
this working already in the afterFind() callback of my tickets
controller, I loop through the results, do an acl->check(...read) on
each ticket id and unset() the ones where the user does not have
permission to read:

---
                        App::import('Model', 'CakeSession');
                        $session = new CakeSession();

                        // ACL
                        App::import('Component', 'Acl');
                        $acl = new AclComponent();

                        $loggedInUser = $session->read('Auth.User');

                        foreach($results as $key => $value) {
                                if(!$acl->check(array('model' => 'User', 
'foreign_key' =>
$loggedInUser['user_id']), 'Ticket.' . $value['Ticket']['ticket_id'],
'read')) {
                                        unset($results[$key]);
                                }
                        }
---

This works but when listing all tickets there are over 2000 records,
resulting in very slow loading times.

Does anyone have any ideas of another approach to this?
--~--~---------~--~----~------------~-------~--~----~
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