Conversation
|
Cool stuff! I'll take a look at this soon. Is there a reason why you bumped the ruby version? Seems like JR works on Ruby >= 2.0 so we shouldn't have the need to bump ruby version on our side. The ruby version is also specified in |
|
Ah, I just bumped it because our system runs on this version. That's a good reason, I will omit this commit :) |
I guess we already do that? https://github.com/venuu/jsonapi-authorization/blob/v0.6.1/.travis.yml#L9 |
|
Hey @lgebhardt, you said in the JR authorization issue that you could help should we need help with the operations processor refactoring, so here we are. It seems that processor callbacks for these operation types:
no longer can reach out to the include directives as before. Tracing back from this library to JR, it seems that the culprit is in Is it true that showing related resources with
The reason why this gems Our specs work on the request level and ensure that a certain request will be checked for authorization. For these four operations, the include directives are never authorized and go through even when they shouldn't. |
|
And also @acid, once we get tests passing against the master branch of JR, we should look into how we can get this to be backwards compatible with older releases. We want to support JR 0.7.0 for quite some time. Seems like the JR (operations) processor API hasn't changed much, but changed enough so that we will have to have some sort of compatibility layer in place for us to be able to make this pass against 0.7.0, 0.7.1.beta1 and current master. I don't have much expertise on how to write such compatibility layers so if you have any ideas, or someone else has, on how to do that or how other gems handle these sorts of dependency gem API changes elegantly, I'm all ears. |
|
The most common approach I've seen is projects just putting a notice like:
In the readme. It avoids the issue entirely. If you need a compatibility layer, I guess you'd need to define the Sadly, the way JR is built makes it extremely difficult to avoid private APIs, and personally I don't think it's worth the time and effort trying to avoid the inevitable problems through complicated (and error-prone) metaprogramming hackery. |
|
Thanks for the input @NuckChorris! We might go for that approach, as JR does have quite a difficult API for processors. |
|
Hey, sorry for being so late to the party! I think it's a good idea to take the approach @NuckChorris mentioned. But apparently JR need to bump to a new version number for that. I will provide a pull request for this. |
we need to differ versions for venuu/jsonapi-authorization#24 I've choosen to increase the minor version number as of a lot of things have changed since 0.7.0.
|
@acid I'm trying to get a release out ASAP. I just need to get a few PRs merged. |
|
@lgebhardt I just did a PR for a version bump https://github.com/cerebris/jsonapi-resources/pull/765 |
|
While we're waiting for JR to release a new version, we could make this PR ready for new changes, too 😄
Thanks for all of your work on this PR! Really stoked to be able to stay compatible with unreleased upstream versions like this, great work all around! 💞 |
|
If you're gonna try and follow along with JR, it might be good to also match numbers — so instead of bumping your current 0.6 --> 0.7 for JR 0.8 support, just skip 0.7 straight to 0.8 to line up with JR's minors (which really ought to be majors, technically speaking, but that's a whole other argument!) Otherwise you end up that JA 0.7 supports JR 0.8 and for JR 0.7 you need JA 0.6 — my head hurts just thinking about it! |
|
I think it's just coincidental that we're almost at the same version number as JR. We want to be able to iterate on this gem and not have to keep our hands tied to the JR version numbering at the same time. It's a shame that it's quite difficult to keep compatibility with JR 0.7 with this change. However, we might be able to be compatible with new JR releases even though this gem wouldn't have to updated. I hope it's enough to just specify the dependencies properly in our gemspec and bundler will take care of checking for any possible dependency version conflicts. |
|
@acid now that JR has released version 0.8.0.beta1, this PR could be finished up to target that gem version. If you don't feel like doing the README changes I specced above, I can do those later, too :) |
|
First of, sorry that I didn't worked on this PR for a while. I'm a big fan of SemVer combined with something like the angular commit message conventions. Maybe this would also be something for this repo? In the meantime it couldn't hurt to jump to the same version number as JR. I'll try to find the time to work on this tonight and let you then know @valscion :) |
cb3068b to
f3eae62
Compare
f3eae62 to
d3fa555
Compare
|
@valscion I've gone through all updates as proposed and it works \o/ I'm a little bit too tired for the documentation changes, sorry for that. And I'm unsure if we actually need those, too. |
|
Looks good, thanks! I can add the documentation changes later myself. Also there seems to be some funky whitespace changes in the case statements but I'll follow up with a fix for them myself. Thanks for your work here! 👍 |
Update README to accommodate changes done in #24
Refactoring the authorized_operation_processor to recent changes in jsonapi_resources. This is unfinished as model_includes aren't authorized correctly.
Also we should think about renaming
authorized_operation_processor.rbtoauthorized_processor.rb.Also, this branch should be tested against JR@master, so it will fail horribly on travis.
[ ] fix model_includes
[ ] tell travis to run specs against master of JR
[ ] update documentation