Access control with CakePHP - Restricting access by database field -


I have an application in which there are database records related to a database, or a country in my user model field city_id and country_id If city_id is not zero, then the user should have access to records related to that city. There are about 8 other models with foreign key city_id, for example, post, advertisement, location, competition ...

I am setting up ACL and I have to know whether to deny a good The way is access to records which is not the same city as the authentic user, unless the authenticated user has no city in the city (which means they have access to each city). The same goes to the country, I have a regional country that works on the same purpose.

Before I guide you very much, and before actually making a heme and a terrible soap, thank you.

You have the function isAuthorized () in your controller or model itself You can check the complex authority you need to set it to AuthComponent: $ this-> AUTH- & gt; Authorized = 'controller';

In the KPHP Book

Comments