-
Notifications
You must be signed in to change notification settings - Fork 59
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
Ways to abstract JSON Api Authorization #31
Comments
@valscion any feedback on this? We are at the point where we need to either use jsonapi authorization or fork and create a new authorization library. I would rather combine efforts then create a separate project. |
Thanks for the input! It seems to me like you are suggesting many things at once, which makes it a little overwhelming. I'll do my best to respond to each part. :) |
This shouldn't require any large scale changes. It's been discussed before, and would very likely be useful to others as well. A PR is more than welcome. As far as I can see, Pundit is only used inside |
Likewise, the user has to explicitly include The only thing
Do you think these are methods that could / should be added upstream to I consider it a strength of |
This is one proposal on how to solve #30, right? Having a single responsibility for each authorization call sounds very good in principle. It's difficult for me to say whether that is a practical way of doing things in this case. Maybe a PR would be the best way to shine a light on how you'd want to improve the As for your example, I wonder if there's a mistake in part |
I'm really happy to see that you want to contribute to this project! I want to encourage you to bring your suggested changes here, even when there's not a 100% agreement on them. If a PR gets rejected, it might just be an opportunity for a different approach, or a new, complementary library. If the approaches differ considerably, then sometimes a fork is the right thing to do. :) Right now, I'd be eager to the solutions you've come up with in your project! Hopefully I managed to answer at least some of your questions. |
@lime Thanks for the responses. It was a lot in one ticket, but I wanted to get a discussion together before I did any pull requests so that I didn't take the time to do several pull requests only to find out you weren't interested in these ideas anyway. Mainly I want to create class contracts / interfaces so that authorization classes could be created with a known pattern. I'll start break these ticket ideas into into several smaller pull requests, then we can discuss each one.
|
Hi there @aaronbhansen! How do you feel about this issue now that time has passed? If you have done some work regarding the abstraction layers, it might affect other additions coming along, such as the work on #40. It would be amazing to get the least amount of merge conflicts as possible 😄 |
@valscion sorry for the delay in movement on this. We planned to implement our json api implementation sooner, but are actually just getting to it now. We are about half way through the conversion and @nathanpalmer is actually working on the permissions aspect of the conversion now. Previous json api work had been done for clients, but we are finally getting to our own implementation. We should have examples and our implementation to show in a few weeks. I'll post an update once thats done. |
Ok, great! Thanks for the information. Keep us posted, as we might get some merge conflicts with #40. |
Any movement regarding this abstraction? Or can we close this issue, as it seems like it didn't get any traction? |
Mostly putting this out there as a discussion on possible ways to abstract the code to make it easier to extend. A few things I think would be useful:
Here are my thoughts and you can lend me yours, if Pundit is no longer a requirement, it be fairly easy for people to create a custom and even very simple Authorizer. I know that this is possible today, but in my case, we want to use a modify version of Pundit, this is where we start to run into conflicts.
If the scoping authorization is separated out, some of that logic for determining the relationships can be moved into a separate class and create a standard interface for others to use.
Lastly, if the Authorizers only have a single responsibility, it would be easier to have the Processor handle getting the classes, relationships, etc, and then calling the correct methods on the authorizers. Then if others wanted to even have a modified Pundit Authorizer, they could inherit from the base and in the case of ticket 30's discussion, they could implement the authorizer relationship however they wanted and leave the remaining methods the same.
This is mostly quick thoughts to see if its something you're interested in doing or if you've had any thoughts along the same line.
The text was updated successfully, but these errors were encountered: