On Sep 21, 2:28 pm, elogic <[email protected]> wrote: > Is there any quick / better way to use Auth to limit the results based > on the users login details or is it just a matter of using if/else > statments to get what you want. > > For example, I have a list of products which all have a group id > assigned to them. Each user also has a group id. When the user is > logged in they are to only show the products that matches their group > id. > > I'm only new to cakephp and still do not know all the tricks or short > cuts for things like this. > > Thankyou
So we have users table, roles table, products table. users table has a role_id (FK) and products table also has a role_id (FK). With $this- >Auth->user() you can get the user details as array. Then check the product table with the retrieve role_id. Please note. Use the name roles for role table and role_id as a FK name. Use cakePhp Auth component for loin sessions. http://book.cakephp.org/view/1250/Authentication Understand how Auth is used and implemented. May be you need to use ACL at one stage. Experts might help more.. -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/cake-php
