> So is that the best way to check owner against user? Well im sure there is
> no best way since every situation is different but doing it this way is just
> as good?
> Simply try to get the request as normal and then process it. If $data then
> there is a record do whatever with the data, if no $data then the user is
> attempting to get something not theirs so $data will be empty tell user they
> are an idiot :)
>
> Just curious since some of the function
>
> $data = $this->User->somefunctionToReturnUserRecord();
>
> If($data){
>
>
> }
> If (!$data){
>
> }
I think there are two separate issues here: whether the logged-in User
owns the Record; and whether the User has any Records at all. In the
first case, it comes down to getting $user_id =
$this->Auth->user('id') and then doing a find with the conditions that
the Record.id == $id and Record.user_id == $user_id.
Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
No comments:
Post a Comment