Skip to content
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

Support for operation processors? #77

Open
jasonjho opened this issue Oct 24, 2017 · 3 comments
Open

Support for operation processors? #77

jasonjho opened this issue Oct 24, 2017 · 3 comments
Assignees
Labels

Comments

@jasonjho
Copy link

jasonjho commented Oct 24, 2017

@tiagopog Is there a way to use jsonapi-authorization, which plugs into JR as a custom operation processor? Based on the JR controller logic here (https://github.com/cerebris/jsonapi-resources/blob/v0.9.0/lib/jsonapi/acts_as_resource_controller.rb#L77), there seems to be some logic around how these processors are invoked -- but jsonapi-utils seems to be overriding this functionality, if I understand it correctly.

Do you have any recommendations for how best to integrate with something like jsonapi-authorization? Would love to take your ideas and make them work.

Thanks!

@tiagopog
Copy link
Owner

tiagopog commented Nov 8, 2017

Sorry for the long delay on answering you, @jasonjho. I hope to bring something still useful for you.

I went through the gem's code/documentation and saw that it works by defining a default processor as you pointed. Since JU overrides the #process_request method only for avoiding bugs with duplicate request parsing on JR's default-generated actions, the jsonapi-authorization would work as expected only for those default actions.

Having in mind that JU works by explicitly defining/overriding the controller actions (i.e. the usual Rails way) I would suggest you to use the JU combined directly with Pundit, since it's simple to implement and it's also less "magical" for not involving the resource layer.

FYK I have a production API running with this authorization setup that I have just mentioned and the implementation got pretty neat, so maybe a new abstraction layer (i.e. jsonapi-authorization) is not required :-)

@tiagopog tiagopog self-assigned this Nov 8, 2017
@jsmestad
Copy link

@tiagopog thanks for putting this together! It would be great to get some docs in the README about how to use jsonapi-authorization with JU

@kceb
Copy link

kceb commented Aug 19, 2021

@tiagopog I'm finding that I need an operation processor for other reasons. Is there support for it?

https://jsonapi-resources.com/v0.9/guide/operation_processors.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants