Question

I have only just started using CakePHP (v2.4.1). I did a fresh install, then I created my database structure and did a cake bake to create all modules, controllers and views. Great! I have also created a login using the Auth component.

I have a users and user_types table along with a user_types_views and a views table as part of the database structure and I want to be able to give access to particular views at usertype level. So I need to reference the database to see if there are any user_types_views records for the usertype logged in, and set the access to authorised for each of these views.

Is this the best way to do it? and are there any hidden little gems in CakePHP which may speed up the process(like the 'cake bake' options).

Was it helpful?

Solution

the CRUD permission setup would do this for you. you'd have to set all the $permKeys to 1 or -1 for access or deny at each function(view) level. remember to use Crud as the authorize option in the auth properties.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top