-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Code documentation + Gates optimizations #136
Comments
Yes, I'm also getting a lot of "missing doc comment" warnings for classes and functions since the more recent versions of |
In refactoring the authorization system, I did review the various options. I use one policy (MatterPolicy) for one very special case (for customers connecting to see only their portfolio), and use gates for the rest. I did not see how I could implement my gates elsewhere than in the controllers, after thinking about the routes. Presently, many routes are defined as |
Yes you're totally right. |
Yes, I did understand the gates, i.e. facades, were primitive. But they are the implementation requiring the least code in our situation, when I realized that policies required a policy file for each model to control... I don't mind code splitting at all. I didn't realize the routes could be split, easily. It would be nice to split the routes as you suggest, indeed. I'd say it's not an urgent topic, but if you want to contribute your time to that, I won't stop you! |
In fact we would need a "global" policy file across all models, because the authorizations are independent of the models (except where the user is the client). I didn't find how to implement that. |
Perfect! I will start by adding some comments and a phpcs config to enable everyone to fit with the sniffer's recommandations. I'll submit a PR for that. |
Hello @jjdejong
I can see that the overall project is missing some code comments, not mandatory but it should help every future contributor to better understand some of the aspects of phpip.
Do you mind if I submit a pull request with some comments addition?
Also, I see with the commit
a4c4764
that you refactored the authorization system. I think we could also put each gate in a middleware and add it to the route definition. In my opinion, it could be more readable and prevent code duplication in the controller's methods where we can read a lot ofGate::authorize('XXXXX')
. What do you think?We could also create a dedicated ServiceProvider to register the gates?
Obviously, I will contribute if you're ok with all of this.
The text was updated successfully, but these errors were encountered: