I don't think that Session is accessible from Model. But CMIIW.
If the above is true, then you'll need to move the matching logic into the controller. You can use the beforeFilter callback function on the active Controller to validate accessible shops. On 12/22/06, kjohn <[EMAIL PROTECTED]> wrote:
Hi all, I am a newbie to cakephp & php OO.. I am confused how best to handle the following case: - Shop hasAndBelongsToMany Users (who can edit the Shop details). - Now, in the shops view page (say shops/view/2), how to check that the currently logged in user can edit the shop (2) details? I was thinking of adding the following to the shop.php model: var $hasAndBelongsToMany = array('User' => array('className' => 'User', 'joinTable' => 'users_shops', 'conditions' => 'User.id = '. $this->Session->read('User.id'), ) ); If this works, I could just read the $shop['User'] to check if the current user can edit the Shop details. But it doesnt seem to work. Any better way to get this working? TIA john >
-- Adrian Godong [EMAIL PROTECTED] Microsoft Student Ambassador --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com 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 -~----------~----~----~----~------~----~------~--~---