I`m new with yii2.
My question is:
I have a controller, and i want to run a boolean function before some actions, that will tell the system if the user is allowed to access this action (a rule, basically).
What is the rightest way to do that?
I would suggest start reading the guide about authentication and authorization:
I’m sure your questions will be answered.
Is there a way to render a specific view or redirect to another page in case that the rule was failed?
Yes like phtamas said.
Look at his link - OR at the link I posted…
It is described there.
denyCallback and matchCallback