I would like to enable urls in function of the accessRules of a controller. With the current structure of the CAccessController I can’t do this without to load each controllers for each urls that I need to check.
For example, I am in the route site/index and in the view I want to display an url that point to the route hello/index only if the user respect the accessrules of this route.
How can I do this?
Right now, I am thinking about to rewrite my own access controller with the access Rules in an external file. Do you have any other idea?
But checkAccess is to check if the user fit to a role, task or operation. But in the accessRules of a controller, we dont check only for roles. And anyway, when I want to had an url to access to an action of my controller, I want to know if the user can access to this action. At the end, it’s my controller who is check the authorization with the accessRules, so why should I use checkAccess? And if one day, I want to change the accessRules of my controller, so I will have to update the code checking if I should display or not the url…
I think there is a structure issue in Yii about access control.