Unfortunately the "Permissionable" behaviour is not adequate for my needs as some users need to be allowed to view certain tickets that they do not own and are not a member of a group with permission to view them.
I need a way to get a list of all the records in a certain model the current logged in user has access to. Then use the ids in a condition in the ticket query. On Aug 17, 10:59 am, Adrian <[email protected]> wrote: > Thanks for replying :). > > I have just read through and digested what your behaviour does and it > seems to be just what I need. I'll have a go at implementing it in to > my application. > > On Aug 16, 8:33 am, jmcneese <[email protected]> wrote: > > > this might work for > > you:http://jmcneese.wordpress.com/2009/04/19/rmac-ftw-part-1/ > > > On Aug 15, 6:50 am, Adrian <[email protected]> wrote: > > > > 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 -~----------~----~----~----~------~----~------~--~---
