I am trying to use RBAC on Yii2 and have a similar example to the RBAC user groups documentation where I have defined a default role for all my users and a rule to be executed on that role. This rule needs some parameters to validate the user has correct permissions.
The parameters for the rule are can be taken from the parameters in the action called in that controller for which I am applying rule.
My question is: Can I somehow get the parameters in the action on pass them on so that they get sent to the execute of the Rule?
Or should I use a matchCallback here and simply perform my own Yii::$app->user->can(‘Role’, [action parameters]) - however, I do not think I can get the action parameters in the callback function (at least not that I can find)
Or should I simply put a check within my action method itself and call Yii:$app->user->can… (which does work).
I am simply trying to find the correct way of implementing this logic. If the last item I listed is the way to go, I have many actions that need to check the same Role (with the params of the action) so I would need to do this on all my actions.
Or this is there a better way to try to implement what I am trying to accomplish.
Thanks for any help.