Summary: | Add optional extended_attributes param to POST /patrons | ||
---|---|---|---|
Product: | Koha | Reporter: | Tomás Cohen Arazi (tcohen) <tomascohen> |
Component: | REST API | Assignee: | Tomás Cohen Arazi (tcohen) <tomascohen> |
Status: | CLOSED FIXED | QA Contact: | Kyle M Hall (khall) <kyle> |
Severity: | enhancement | ||
Priority: | P5 - low | CC: | ephetteplace, fridolin.somers, jonathan.druart, joonas.kylmala, kyle, martin.renvoize, tomascohen |
Version: | Main | ||
Hardware: | All | ||
OS: | All | ||
Change sponsored?: | --- | Patch complexity: | Small patch |
Documentation contact: | Documentation submission: | ||
Text to go in the release notes: |
This development adds an optional parameter to the POST /patrons route, so extended attributes can be passed for patron creation.
It relies on the underlying code to handle extended attributes constraints/requirements (repeatable, mandatory, unique, etc).
The added attribute (to be passed in the body of the POST request) is 'extended_attributes' and consists of an array of extended attribute objects (properly described on the spec).
|
Version(s) released in: |
21.05.00
|
Circulation function: | |||
Bug Depends on: | 23666, 27855, 28157 | ||
Bug Blocks: | |||
Attachments: |
Bug 28002: Unit tests
Bug 28002: Add extended_attributes support to POST /patrons Bug 28002: Unit tests Bug 28002: Unit tests Bug 28002: Add extended_attributes support to POST /patrons Bug 28002: Unit tests Bug 28002: Add extended_attributes support to POST /patrons Bug 28002: Unit tests Bug 28002: Add extended_attributes support to POST /patrons Bug 28002: Unit tests |
Description
Tomás Cohen Arazi (tcohen)
2021-03-19 13:05:33 UTC
Created attachment 119047 [details] [review] Bug 28002: Unit tests Created attachment 119048 [details] [review] Bug 28002: Add extended_attributes support to POST /patrons This patch adds support for the 'extended_attributes' parameter in the route for adding a patron. It relies on Koha::Patron->extended_attributes for the tests. Exceptions are catch and the whole operation is rolled back. I chose to handle each exception on its own if branch, with bug 28020 in mind. To test: 1. Apply this patchset 2. Run: $ kshell k$ prove t/db_dependent/api/v1/patrons.t => SUCCES: Tests pass! 3. Check they cover all the exception situations! => SUCCESS: They do! 4. Sign off :-D Created attachment 119395 [details] [review] Bug 28002: Unit tests Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Created attachment 119396 [details] [review] Bug 28002: Unit tests Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Created attachment 119397 [details] [review] Bug 28002: Add extended_attributes support to POST /patrons This patch adds support for the 'extended_attributes' parameter in the route for adding a patron. It relies on Koha::Patron->extended_attributes for the tests. Exceptions are catch and the whole operation is rolled back. I chose to handle each exception on its own if branch, with bug 28020 in mind. To test: 1. Apply this patchset 2. Run: $ kshell k$ prove t/db_dependent/api/v1/patrons.t => SUCCES: Tests pass! 3. Check they cover all the exception situations! => SUCCESS: They do! 4. Sign off :-D Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Created attachment 119415 [details] [review] Bug 28002: Unit tests Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net> Created attachment 119416 [details] [review] Bug 28002: Add extended_attributes support to POST /patrons This patch adds support for the 'extended_attributes' parameter in the route for adding a patron. It relies on Koha::Patron->extended_attributes for the tests. Exceptions are catch and the whole operation is rolled back. I chose to handle each exception on its own if branch, with bug 28020 in mind. To test: 1. Apply this patchset 2. Run: $ kshell k$ prove t/db_dependent/api/v1/patrons.t => SUCCES: Tests pass! 3. Check they cover all the exception situations! => SUCCESS: They do! 4. Sign off :-D Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net> Created attachment 119417 [details] [review] Bug 28002: Unit tests Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net> Created attachment 119418 [details] [review] Bug 28002: Add extended_attributes support to POST /patrons This patch adds support for the 'extended_attributes' parameter in the route for adding a patron. It relies on Koha::Patron->extended_attributes for the tests. Exceptions are catch and the whole operation is rolled back. I chose to handle each exception on its own if branch, with bug 28020 in mind. To test: 1. Apply this patchset 2. Run: $ kshell k$ prove t/db_dependent/api/v1/patrons.t => SUCCES: Tests pass! 3. Check they cover all the exception situations! => SUCCESS: They do! 4. Sign off :-D Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net> Created attachment 119425 [details] [review] Bug 28002: Unit tests Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Kyle/Victor, it seems you overlapped on the QA step. Can any of you check you SO lines are ok? We need to discuss how to deal with the "library limitations". Tomas will send an email to the list. This implementation relies on Koha::Patron->extended_attributes, which is aware of library limitations by means of userenv. This, paired with bug 28157, should give us a secure way [1] to specify the library the request comes from and have Koha::Patron->extended_attributes act correctly. [1] The bug 28157 will reject the request if the alleged library is not valid for the caller user. Pushed to master for 21.05, thanks to everybody involved! So happy to see this having worked it way through.. a great team effort, especially thankful for all Tomas's work! Depends on Bug 23666 not in 20.11.x |