[Bug 27760] New: Add handling for x-koha-override
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27760 Bug ID: 27760 Summary: Add handling for x-koha-override Change sponsored?: --- Product: Koha Version: master Hardware: All OS: All Status: NEW Severity: enhancement Priority: P5 - low Component: REST API Assignee: koha-bugs@lists.koha-community.org Reporter: tomascohen@gmail.com On the development of bug 26181, Martin and I were discussing a more generic approach, when suddenly the bug went SO => QA => Pushed to master => Backported to all stable branches :-D. My fault for not setting it 'In discussion'. We should use a follow-up to adjust the pushed implementation in line with bug 26181 comment 9. -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27760 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Depends on| |26181 Assignee|koha-bugs@lists.koha-commun |tomascohen@gmail.com |ity.org | Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26181 [Bug 26181] Holds placed via the REST API should not be forced by default even if AllowHoldPolicyOverride is enabled -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27760 Bug 27760 depends on bug 26181, which changed state. Bug 26181 Summary: Holds placed via the REST API should not be forced by default even if AllowHoldPolicyOverride is enabled https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26181 What |Removed |Added ---------------------------------------------------------------------------- Status|Pushed to oldstable |RESOLVED Resolution|--- |FIXED -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27760 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |martin.renvoize@ptfs-europe | |.com Keywords| |rel_21_05_candidate -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27760 --- Comment #1 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Created attachment 117308 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=117308&action=edit Bug 27760: Add stash_overrides helper This patch adds a simple helper that reads the x-koha-override request header, and processes it to stash a hashref with the passed overrides. No check on the overrides themselves is done, as they should be validated using the OpenAPI spec. To test: 1. Apply this patch 2. Run: $ kshell k$ prove t/db_dependent/api/v1/auth_authenticate_api_request.t => SUCCESS: Tests pass! 3. Sign off :-D -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27760 --- Comment #2 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Created attachment 117309 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=117309&action=edit Bug 27760: Make auhtenticate_api_request call stash_overrides By making this method call the helper, we make sure the overrides hashref is available to any controller to make us of it. To test: 1. Apply this patches 2. Run: $ kshell k$ prove t/db_dependent/api/v1/auth_authenticate_api_request.t \ t/Koha/REST/Plugin/Query.t => SUCCESS: Tests pass! The helper works as expected and the authenticate_api_request method invokes it! 3. Sign off :-D -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27760 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |Needs Signoff -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27760 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27760 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #117308|0 |1 is obsolete| | --- Comment #3 from David Nind <david@davidnind.com> --- Created attachment 117326 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=117326&action=edit Bug 27760: Add stash_overrides helper This patch adds a simple helper that reads the x-koha-override request header, and processes it to stash a hashref with the passed overrides. No check on the overrides themselves is done, as they should be validated using the OpenAPI spec. To test: 1. Apply this patch 2. Run: $ kshell k$ prove t/db_dependent/api/v1/auth_authenticate_api_request.t => SUCCESS: Tests pass! 3. Sign off :-D Signed-off-by: David Nind <david@davidnind.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27760 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #117309|0 |1 is obsolete| | --- Comment #4 from David Nind <david@davidnind.com> --- Created attachment 117327 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=117327&action=edit Bug 27760: Make auhtenticate_api_request call stash_overrides By making this method call the helper, we make sure the overrides hashref is available to any controller to make us of it. To test: 1. Apply this patches 2. Run: $ kshell k$ prove t/db_dependent/api/v1/auth_authenticate_api_request.t \ t/Koha/REST/Plugin/Query.t => SUCCESS: Tests pass! The helper works as expected and the authenticate_api_request method invokes it! 3. Sign off :-D Signed-off-by: David Nind <david@davidnind.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27760 --- Comment #5 from Tomás Cohen Arazi <tomascohen@gmail.com> --- I wanted to mention that it feels the right way to retrieve the headers in the code should use the validated data (by the OpenAPI plugin) so we could take advantage of data coercion and such. But I couldn't find a way to get the Mojolicious::Validator::Validation object ($c->validation) to give us the headers. So skipping that for now. I will follow-up on this once I get answers from the mojo/openapi devs on IRC. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27760 Kyle M Hall <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Passed QA -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27760 Kyle M Hall <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #117326|0 |1 is obsolete| | Attachment #117327|0 |1 is obsolete| | --- Comment #6 from Kyle M Hall <kyle@bywatersolutions.com> --- Created attachment 117342 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=117342&action=edit Bug 27760: Add stash_overrides helper This patch adds a simple helper that reads the x-koha-override request header, and processes it to stash a hashref with the passed overrides. No check on the overrides themselves is done, as they should be validated using the OpenAPI spec. To test: 1. Apply this patch 2. Run: $ kshell k$ prove t/db_dependent/api/v1/auth_authenticate_api_request.t => SUCCESS: Tests pass! 3. Sign off :-D Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27760 --- Comment #7 from Kyle M Hall <kyle@bywatersolutions.com> --- Created attachment 117343 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=117343&action=edit Bug 27760: Make auhtenticate_api_request call stash_overrides By making this method call the helper, we make sure the overrides hashref is available to any controller to make us of it. To test: 1. Apply this patches 2. Run: $ kshell k$ prove t/db_dependent/api/v1/auth_authenticate_api_request.t \ t/Koha/REST/Plugin/Query.t => SUCCESS: Tests pass! The helper works as expected and the authenticate_api_request method invokes it! 3. Sign off :-D Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27760 Kyle M Hall <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #117343|0 |1 is obsolete| | --- Comment #8 from Kyle M Hall <kyle@bywatersolutions.com> --- Created attachment 117344 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=117344&action=edit Bug 27760: Make authenticate_api_request call stash_overrides By making this method call the helper, we make sure the overrides hashref is available to any controller to make us of it. To test: 1. Apply this patches 2. Run: $ kshell k$ prove t/db_dependent/api/v1/auth_authenticate_api_request.t \ t/Koha/REST/Plugin/Query.t => SUCCESS: Tests pass! The helper works as expected and the authenticate_api_request method invokes it! 3. Sign off :-D Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27760 --- Comment #9 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Blimey.. I was about to SO this and by the time I'd read the code in splinter review it had been SO'd and QA'd!.. Impressive work chaps. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27760 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |27797 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27797 [Bug 27797] Make POST /holds use the stashed koha.overrides -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27760 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |27863 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27863 [Bug 27863] Holds API route for pickup_libraries should return all branches if 'AllowHoldPolicyOverride' is enabled -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27760 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- QA Contact| |kyle@bywatersolutions.com -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27760 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks|27863 | Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27863 [Bug 27863] Cannot select different pickup locations even with AllowHoldsPolicyOverride on request.pl -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27760 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Passed QA |Failed QA CC| |jonathan.druart@bugs.koha-c | |ommunity.org Keywords| |release-notes-needed --- Comment #10 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- 1. Missing POD 2. (In reply to Tomás Cohen Arazi from comment #5)
I will follow-up on this once I get answers from the mojo/openapi devs on IRC.
Any news? -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27760 --- Comment #11 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Created attachment 118108 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=118108&action=edit Bug 27760: Improve readabiliity using map -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27760 --- Comment #12 from Tomás Cohen Arazi <tomascohen@gmail.com> --- (In reply to Jonathan Druart from comment #10)
1. Missing POD
Well check.
2. (In reply to Tomás Cohen Arazi from comment #5)
I will follow-up on this once I get answers from the mojo/openapi devs on IRC.
Any news?
We need to upgrade our JSON::Validator. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27760 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords|release-notes-needed | Text to go in the| |This patches add a new release notes| |Mojolicious helper method | |that takes care of reading | |'x-koha-override' headers | |that contain | |comma-separated overrides | |(e.g. | |'pickup_location,too_many_h | |olds') and stashes them for | |later use in controller | |methods. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27760 --- Comment #13 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Created attachment 118110 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=118110&action=edit Bug 27760: (QA follow-up) Improve POD This patch improves the POD for the added helper, and also adds references to the JSON::Validator issue that explains the current implementation. A FIXME is added for when we upgrade our used JSON::Validator version. Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27760 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Failed QA |Passed QA -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27760 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Depends on| |28157 --- Comment #14 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Rebased on top of bug 28157. Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28157 [Bug 28157] Add the ability to set a library from which an API request pretends to come from -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27760 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |tomascohen@gmail.com -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27760 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #117344|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27760 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #118108|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27760 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #118110|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27760 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #117342|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27760 --- Comment #15 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Created attachment 120112 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=120112&action=edit Bug 27760: Add stash_overrides helper This patch adds a simple helper that reads the x-koha-override request header, and processes it to stash a hashref with the passed overrides. No check on the overrides themselves is done, as they should be validated using the OpenAPI spec. To test: 1. Apply this patch 2. Run: $ kshell k$ prove t/db_dependent/api/v1/auth_authenticate_api_request.t => SUCCESS: Tests pass! 3. Sign off :-D Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27760 --- Comment #16 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Created attachment 120113 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=120113&action=edit Bug 27760: Make authenticate_api_request call stash_overrides By making this method call the helper, we make sure the overrides hashref is available to any controller to make us of it. To test: 1. Apply this patches 2. Run: $ kshell k$ prove t/db_dependent/api/v1/auth_authenticate_api_request.t \ t/Koha/REST/Plugin/Query.t => SUCCESS: Tests pass! The helper works as expected and the authenticate_api_request method invokes it! 3. Sign off :-D Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27760 --- Comment #17 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Created attachment 120114 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=120114&action=edit Bug 27760: Improve readabiliity using map -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27760 --- Comment #18 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Created attachment 120115 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=120115&action=edit Bug 27760: (QA follow-up) Improve POD This patch improves the POD for the added helper, and also adds references to the JSON::Validator issue that explains the current implementation. A FIXME is added for when we upgrade our used JSON::Validator version. Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27760 David Cook <dcook@prosentient.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |dcook@prosentient.com.au --- Comment #19 from David Cook <dcook@prosentient.com.au> --- Looks like upgrading JSON::Validator would give us a few different wins across the board... -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27760 --- Comment #20 from Tomás Cohen Arazi <tomascohen@gmail.com> --- (In reply to David Cook from comment #19)
Looks like upgrading JSON::Validator would give us a few different wins across the board...
Oh yeah. But this is the very latest version. Would love to, though :-) -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27760 --- Comment #21 from David Cook <dcook@prosentient.com.au> --- (In reply to Tomás Cohen Arazi from comment #20)
(In reply to David Cook from comment #19)
Looks like upgrading JSON::Validator would give us a few different wins across the board...
Oh yeah. But this is the very latest version. Would love to, though :-)
Ahh that's harder :( -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27760 Jonathan Druart <jonathan.druart+koha@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Passed QA |Pushed to master Version(s)| |21.05.00 released in| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27760 --- Comment #22 from Jonathan Druart <jonathan.druart+koha@gmail.com> --- Pushed to master for 21.05, thanks to everybody involved! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27760 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords|rel_21_05_candidate | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27760 Fridolin Somers <fridolin.somers@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |fridolin.somers@biblibre.co | |m --- Comment #23 from Fridolin Somers <fridolin.somers@biblibre.com> --- Enhancement not pushed to 20.11.x -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org