cakephp / authorization

PSR7 Middleware for authorization
MIT License
76 stars 47 forks source link

Fix ControllerHookPolicy Code Example #215

Closed amayer5125 closed 2 years ago

amayer5125 commented 2 years ago

The old example had incorrect parameters for the __call method. The first param is the name of the method being called. The second param is all the arguments that were passed to the called method.

We are also given an identity, not an array which is what isAuthorized expects. To fix this we can pass $user->getOriginalData() to the old isAuthorized methods.

markstory commented 2 years ago

Thank you 🎉