[Bug 16330] New: REST API: add routes to add, update and delete patrons

classic Classic list List threaded Threaded
173 messages Options
123456
Reply | Threaded
Open this post in threaded view
|

[Bug 16330] REST API: add routes to add, update and delete patrons

bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16330

Lari Taskula <[hidden email]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #63646|0                           |1
        is obsolete|                            |

--- Comment #49 from Lari Taskula <[hidden email]> ---
Created attachment 63649
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=63649&action=edit
Bug 16330: REST API: add routes to add, update and delete patrons

This patch adds support for add, edit and delete patrons via REST API.

GET  /api/v1/patrons                   Get patron list from params
GET  /api/v1/patrons/<borrowernumber>  Get single patron
POST /api/v1/patrons                   Create a new patron
PUT  /api/v1/patrons/<borrowernumber>  Update data about patron
DEL  /api/v1/patrons/<borrowernumber>  Delete a patron

Revised Test plan:
1) Apply this patch
2) Run tests perl t/db_dependent/api/v1/patrons.t
3) Add a user with proper rights to use the REST API
4) play with your favourite REST client (curl/httpie, etc.):
   Authenticate with the user created above and get a CGISESSION id.
   Use the CGISESSION to add, edit and delete patrons via the API.
5) Use PUT /patrons/<borrowernumber> for a patron without borrowers
   flag. This should go into pending patron modification status and
   needs to be accepted by a librarian.

Please note there is no validation of body input in PUT/POST other
than branchcode,category,userid,cardnumber.

--
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[hidden email]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/
Reply | Threaded
Open this post in threaded view
|

[Bug 16330] REST API: add routes to add, update and delete patrons

bugzilla-daemon
In reply to this post by bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16330

Lari Taskula <[hidden email]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #63647|0                           |1
        is obsolete|                            |

--- Comment #50 from Lari Taskula <[hidden email]> ---
Created attachment 63650
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=63650&action=edit
Bug 16330: Spot unchanged modification-request in Koha::Patron::Modification

Throw Koha::Exceptions::NoChanges if attempting to create a modification
request
without changing anything.

This exception is caught in Patron REST API controller.

Also, validate changes via Koha::Patron->_validate

To test:
1. prove t/db_dependent/Koha/Patron/Modifications.t

--
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[hidden email]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/
Reply | Threaded
Open this post in threaded view
|

[Bug 16330] REST API: add routes to add, update and delete patrons

bugzilla-daemon
In reply to this post by bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16330

Blou <[hidden email]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |[hidden email]

--- Comment #51 from Blou <[hidden email]> ---
If i understand correctly, this patch is "In Discussion" since March(2017)
because of "borrowernumber vs patron_id".

Is it still on?  Has it been settled?  I'd love to test (live) this code, but I
don't want to tell our associates to deploy on a naming convention that will
change.  

Ready to sign off...

--
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[hidden email]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/
Reply | Threaded
Open this post in threaded view
|

[Bug 16330] REST API: add routes to add, update and delete patrons

bugzilla-daemon
In reply to this post by bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16330

Jonathan Druart <[hidden email]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         QA Contact|[hidden email]-communit |
                   |y.org                       |
          Component|Web services                |REST api

--
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[hidden email]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/
Reply | Threaded
Open this post in threaded view
|

[Bug 16330] REST API: add routes to add, update and delete patrons

bugzilla-daemon
In reply to this post by bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16330

Bob Birchall <[hidden email]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |[hidden email]

--
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[hidden email]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/
Reply | Threaded
Open this post in threaded view
|

[Bug 16330] REST API: add routes to add, update and delete patrons

bugzilla-daemon
In reply to this post by bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16330

--- Comment #52 from Tomás Cohen Arazi <[hidden email]> ---
(In reply to Blou from comment #51)
> If i understand correctly, this patch is "In Discussion" since March(2017)
> because of "borrowernumber vs patron_id".
>
> Is it still on?  Has it been settled?  I'd love to test (live) this code,
> but I don't want to tell our associates to deploy on a naming convention
> that will change.  
>
> Ready to sign off...

On my opinion this patches went too far (patron modifications are a different
entity) and updates should be constrained to authorized (by permission) users.

Cleanup is needed, and migration to OpenAPI plugin too.

Will try to work on this ASAP. Anyone willing to do it or help, please pm me

--
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[hidden email]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/
Reply | Threaded
Open this post in threaded view
|

[Bug 16330] REST API: add routes to add, update and delete patrons

bugzilla-daemon
In reply to this post by bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16330

Tomás Cohen Arazi <[hidden email]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #55147|0                           |1
        is obsolete|                            |

--
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[hidden email]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/
Reply | Threaded
Open this post in threaded view
|

[Bug 16330] REST API: add routes to add, update and delete patrons

bugzilla-daemon
In reply to this post by bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16330

Tomás Cohen Arazi <[hidden email]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #56666|0                           |1
        is obsolete|                            |

--
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[hidden email]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/
Reply | Threaded
Open this post in threaded view
|

[Bug 16330] REST API: add routes to add, update and delete patrons

bugzilla-daemon
In reply to this post by bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16330

Tomás Cohen Arazi <[hidden email]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #56667|0                           |1
        is obsolete|                            |

--
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[hidden email]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/
Reply | Threaded
Open this post in threaded view
|

[Bug 16330] REST API: add routes to add, update and delete patrons

bugzilla-daemon
In reply to this post by bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16330

Tomás Cohen Arazi <[hidden email]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #56668|0                           |1
        is obsolete|                            |

--
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[hidden email]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/
Reply | Threaded
Open this post in threaded view
|

[Bug 16330] REST API: add routes to add, update and delete patrons

bugzilla-daemon
In reply to this post by bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16330

Tomás Cohen Arazi <[hidden email]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #63649|0                           |1
        is obsolete|                            |

--- Comment #53 from Tomás Cohen Arazi <[hidden email]> ---
Created attachment 69546
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=69546&action=edit
Bug 16330: REST API: add routes to add, update and delete patrons

This patch adds support for add, edit and delete patrons via REST API.

GET  /api/v1/patrons                   Get patron list from params
GET  /api/v1/patrons/<borrowernumber>  Get single patron
POST /api/v1/patrons                   Create a new patron
PUT  /api/v1/patrons/<borrowernumber>  Update data about patron
DEL  /api/v1/patrons/<borrowernumber>  Delete a patron

Revised Test plan:
1) Apply this patch
2) Run tests perl t/db_dependent/api/v1/patrons.t
3) Add a user with proper rights to use the REST API
4) play with your favourite REST client (curl/httpie, etc.):
   Authenticate with the user created above and get a CGISESSION id.
   Use the CGISESSION to add, edit and delete patrons via the API.
5) Use PUT /patrons/<borrowernumber> for a patron without borrowers
   flag. This should go into pending patron modification status and
   needs to be accepted by a librarian.

Please note there is no validation of body input in PUT/POST other
than branchcode,category,userid,cardnumber.

Signed-off-by: Tomas Cohen Arazi <[hidden email]>

--
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[hidden email]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/
Reply | Threaded
Open this post in threaded view
|

[Bug 16330] REST API: add routes to add, update and delete patrons

bugzilla-daemon
In reply to this post by bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16330

Tomás Cohen Arazi <[hidden email]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #63650|0                           |1
        is obsolete|                            |

--- Comment #54 from Tomás Cohen Arazi <[hidden email]> ---
Created attachment 69547
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=69547&action=edit
Bug 16330: Spot unchanged modification-request in Koha::Patron::Modification

Throw Koha::Exceptions::NoChanges if attempting to create a modification
request
without changing anything.

This exception is caught in Patron REST API controller.

Also, validate changes via Koha::Patron->_validate

To test:
1. prove t/db_dependent/Koha/Patron/Modifications.t

--
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[hidden email]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/
Reply | Threaded
Open this post in threaded view
|

[Bug 16330] REST API: add routes to add, update and delete patrons

bugzilla-daemon
In reply to this post by bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16330

--- Comment #55 from Tomás Cohen Arazi <[hidden email]> ---
Created attachment 69548
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=69548&action=edit
Bug 16330: Move patches to OpenAPI

This patch refactors the original work so it implements the controllers
and the spec using Mojolicious::Plugin::OpenAPI, and OpenAPI for the
specification.

It removes the ability for patrons without permissions to edit their own data
or their
guarantee's. This will be moved to a patron modification requests endpoint for
simplicity.

It makes use of bugs 19410 and 19686 and their dependencies to deal with
parameters handling,
query building and pagination.

Tests are adapted.

To test:
- Apply this patches and the dependencies
- Run:
  $ kshell
 k$ prove t/db_dependent/api/v1/patrons.t
=> SUCCESS: Tests pass!
- Sign off :-D

Sponsored-by: ByWater Solutions

Signed-off-by: Tomas Cohen Arazi <[hidden email]>

--
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[hidden email]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/
Reply | Threaded
Open this post in threaded view
|

[Bug 16330] REST API: add routes to add, update and delete patrons

bugzilla-daemon
In reply to this post by bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16330

--- Comment #56 from Tomás Cohen Arazi <[hidden email]> ---
Created attachment 69549
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=69549&action=edit
Bug 16330: (QA followup) fix spelling in comment

Signed-off-by: Tomas Cohen Arazi <[hidden email]>

--
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[hidden email]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/
Reply | Threaded
Open this post in threaded view
|

[Bug 16330] REST API: add routes to add, update and delete patrons

bugzilla-daemon
In reply to this post by bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16330

--- Comment #57 from Tomás Cohen Arazi <[hidden email]> ---
Created attachment 69550
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=69550&action=edit
Bug 16330: (QA followup) Add missing POD for exceptions

This patch adds POD to the exceptions files introduced by this patchset.

Note: the qa scripts give false positives on Exceptions. But the patchset
was missing them anyway.

Signed-off-by: Tomas Cohen Arazi <[hidden email]>

--
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[hidden email]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/
Reply | Threaded
Open this post in threaded view
|

[Bug 16330] REST API: add routes to add, update and delete patrons

bugzilla-daemon
In reply to this post by bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16330

--- Comment #58 from Tomás Cohen Arazi <[hidden email]> ---
Created attachment 69551
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=69551&action=edit
Bug 16330: (QA followup) Repect guidelines on plurals Patron > Patrons

Signed-off-by: Tomas Cohen Arazi <[hidden email]>

--
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[hidden email]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/
Reply | Threaded
Open this post in threaded view
|

[Bug 16330] REST API: add routes to add, update and delete patrons

bugzilla-daemon
In reply to this post by bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16330

Tomás Cohen Arazi <[hidden email]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|In Discussion               |Needs Signoff
   Patch complexity|Small patch                 |Medium patch
         QA Contact|                            |[hidden email]
         Depends on|16846                       |19410
           Severity|enhancement                 |new feature

--- Comment #59 from Tomás Cohen Arazi <[hidden email]> ---
I've rebased the previous work, and moved the code so it uses OpenAPI.

As the commit message ('Move patches to OpenAPI' patch) explains. I removed the
portion that dealt with patron modification requests.

I also make use of the helper functions introduced by bug 19410, bug 19686 and
their dependencies.

Benjamin, Lari and everyone involved. Please test the changes I made (big
changes) and please add your signatures to the patchset. Once you (or others)
test it, we can move forward with the QA process.


Referenced Bugs:

https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16846
[Bug 16846] Move patron related code to Koha::Patron
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19410
[Bug 19410] Add a helper function for generating object searches for the API
--
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[hidden email]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/
Reply | Threaded
Open this post in threaded view
|

[Bug 16330] REST API: add routes to add, update and delete patrons

bugzilla-daemon
In reply to this post by bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16330

Tomás Cohen Arazi <[hidden email]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Depends on|18230                       |


Referenced Bugs:

https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=18230
[Bug 18230] Generate Koha::Patron::Modification verification_token in ->new
--
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[hidden email]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/
Reply | Threaded
Open this post in threaded view
|

[Bug 16330] REST API: add routes to add, update and delete patrons

bugzilla-daemon
In reply to this post by bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16330

Dilan Johnpullé <[hidden email]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |[hidden email]

--- Comment #60 from Dilan Johnpullé <[hidden email]> ---
Attempted to apply the patch but ran into issues with one of the dependencies.
Attempting the test afterwards just results in a lot of ugly error messages.

This is the output from git when attempting to apply:

vagrant@kohadevbox:kohaclone((af7d618...))$ git bz apply -s 16330

Bug 16330 Depends on bug 19410
Follow? [(y)es, (n)o] y

Bug 19410 Depends on bug 19234
Follow? [(y)es, (n)o] y
Bug 19234 - Add query parameters handling helpers

69360 - Bug 19234: Unit tests for query parameters handling helpers
69361 - Bug 19234: Add query parameters handling helpers
69362 - Bug 19234: (followup) Make Query plugin available to endpoints

Apply? [(y)es, (n)o, (i)nteractive] y
Applying: Bug 19234: Unit tests for query parameters handling helpers
Applying: Bug 19234: Add query parameters handling helpers
Applying: Bug 19234: (followup) Make Query plugin available to endpoints

Bug 19410 Depends on bug 19278
Follow? [(y)es, (n)o] y

Bug 19278 Depends on bug 19369
Follow? [(y)es, (n)o] y

Bug 19369 Depends on bug 19234
Follow? [(y)es, (n)o] y
Bug 19234 - Add query parameters handling helpers

69360 - Bug 19234: Unit tests for query parameters handling helpers
69361 - Bug 19234: Add query parameters handling helpers
69362 - Bug 19234: (followup) Make Query plugin available to endpoints

Apply? [(y)es, (n)o, (i)nteractive] y
Applying: Bug 19234: Unit tests for query parameters handling helpers
Using index info to reconstruct a base tree...
Falling back to patching base and 3-way merge...
No changes -- Patch already applied.
Applying: Bug 19234: Add query parameters handling helpers
Using index info to reconstruct a base tree...
Falling back to patching base and 3-way merge...
No changes -- Patch already applied.
Applying: Bug 19234: (followup) Make Query plugin available to endpoints
Using index info to reconstruct a base tree...
M       Koha/REST/V1.pm
Falling back to patching base and 3-way merge...
No changes -- Patch already applied.
Bug 19369 - Add a helper function for translating pagination params into
SQL::Abstract

69363 - Bug 19369: Unit tests
69364 - Bug 19369: Add helper function for pagination attributes generation

Apply? [(y)es, (n)o, (i)nteractive] y
Applying: Bug 19369: Unit tests
Applying: Bug 19369: Add helper function for pagination attributes generation
Bug 19278 - Add a configurable default page size for endpoints

69365 - Bug 19278: Add RESTdefaultPageSize syspref
69366 - Bug 19278: Unit tests
69367 - Bug 19278: Make the pagination plugin use RESTdefaultPageSize
69368 - Bug 19278: Mention RESTdefaultPageSize in POD

Apply? [(y)es, (n)o, (i)nteractive] y
Applying: Bug 19278: Add RESTdefaultPageSize syspref
Applying: Bug 19278: Unit tests
Applying: Bug 19278: Make the pagination plugin use RESTdefaultPageSize
Applying: Bug 19278: Mention RESTdefaultPageSize in POD

Bug 19410 Depends on bug 19369
Follow? [(y)es, (n)o] y

Bug 19369 Depends on bug 19234
Follow? [(y)es, (n)o] y
Bug 19234 - Add query parameters handling helpers

69360 - Bug 19234: Unit tests for query parameters handling helpers
69361 - Bug 19234: Add query parameters handling helpers
69362 - Bug 19234: (followup) Make Query plugin available to endpoints

Apply? [(y)es, (n)o, (i)nteractive] y
Applying: Bug 19234: Unit tests for query parameters handling helpers
Using index info to reconstruct a base tree...
Falling back to patching base and 3-way merge...
No changes -- Patch already applied.
Applying: Bug 19234: Add query parameters handling helpers
Using index info to reconstruct a base tree...
Falling back to patching base and 3-way merge...
No changes -- Patch already applied.
Applying: Bug 19234: (followup) Make Query plugin available to endpoints
Using index info to reconstruct a base tree...
M       Koha/REST/V1.pm
Falling back to patching base and 3-way merge...
No changes -- Patch already applied.
Bug 19369 - Add a helper function for translating pagination params into
SQL::Abstract

69363 - Bug 19369: Unit tests
69364 - Bug 19369: Add helper function for pagination attributes generation

Apply? [(y)es, (n)o, (i)nteractive] y
Applying: Bug 19369: Unit tests
Using index info to reconstruct a base tree...
M       t/Koha/REST/Plugin/Pagination.t
Falling back to patching base and 3-way merge...
Auto-merging t/Koha/REST/Plugin/Pagination.t
CONFLICT (content): Merge conflict in t/Koha/REST/Plugin/Pagination.t
Failed to merge in the changes.
Patch failed at 0001 Bug 19369: Unit tests
The copy of the patch that failed is found in:
   /home/vagrant/kohaclone/.git/rebase-apply/patch
When you have resolved this problem run "git bz apply --continue".
If you would prefer to skip this patch, instead run "git bz apply --skip".
To restore the original branch and stop patching run "git bz apply --abort".
Patch left in /tmp/Bug-19369-Unit-tests-aBwR2M.patch

Cannot apply cleanly patches from bug 19369. Everything will be left dirty.
git bz apply --continue will not continue the process if patches from other bug
reports need to be applied.

--
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[hidden email]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/
Reply | Threaded
Open this post in threaded view
|

[Bug 16330] REST API: add routes to add, update and delete patrons

bugzilla-daemon
In reply to this post by bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16330

--- Comment #61 from Dilan Johnpullé <[hidden email]> ---
Just attempted applying each dependency manually in order. Have got 16330 to
apply now and will follow test plan instructions.

--
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[hidden email]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/
Reply | Threaded
Open this post in threaded view
|

[Bug 16330] REST API: add routes to add, update and delete patrons

bugzilla-daemon
In reply to this post by bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16330

--- Comment #62 from Dilan Johnpullé <[hidden email]> ---
Still getting error messages when running the test:

vagrant@kohadevbox:kohaclone((8c8b618...))$ sudo perl
t/db_dependent/api/v1/patrons.t
1..5
unable to locate Koha configuration file koha-conf.xml at C4/Context.pm line
243.
unable to locate Koha configuration file koha-conf.xml at C4/Context.pm line
243.
unable to locate Koha configuration file koha-conf.xml at C4/Context.pm line
243.
unable to locate Koha configuration file koha-conf.xml at C4/Context.pm line
243.
unable to locate Koha configuration file koha-conf.xml at C4/Context.pm line
243.
unable to locate Koha configuration file koha-conf.xml at C4/Context.pm line
243.
Use of uninitialized value in concatenation (.) or string at C4/Templates.pm
line 154.
unable to locate Koha configuration file koha-conf.xml at C4/Context.pm line
243.
unable to locate Koha configuration file koha-conf.xml at C4/Context.pm line
243.
Use of uninitialized value in concatenation (.) or string at
C4/Auth_with_cas.pm line 42.
unable to locate Koha configuration file koha-conf.xml at C4/Context.pm line
243.
unable to locate Koha configuration file koha-conf.xml at C4/Context.pm line
243.
Can't call method "config" on unblessed reference at Koha/Database.pm line 56.
# Looks like your test exited with 2 before it could output anything.

--
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[hidden email]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/
Reply | Threaded
Open this post in threaded view
|

[Bug 16330] REST API: add routes to add, update and delete patrons

bugzilla-daemon
In reply to this post by bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16330

--- Comment #63 from Magnus Enger <[hidden email]> ---
(In reply to Dilan Johnpullé from comment #62)
> Still getting error messages when running the test:
...
> unable to locate Koha configuration file koha-conf.xml at C4/Context.pm line

These errors should go away if you do "sudo koha-shell <dev-instance-name>" and
then run the tests from within that koha-shell.

If you are not on kohadevbox or another gitified setup that can use koha-shell,
you need to include some environment variables in your call to prove, something
like:

$ PERL5LIB=/home/me/kohaclone KOHA_CONF=/home/me/koha-site/koha-conf.xml prove
path/to/test.t

HTH

--
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[hidden email]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/
Reply | Threaded
Open this post in threaded view
|

[Bug 16330] REST API: add routes to add, update and delete patrons

bugzilla-daemon
In reply to this post by bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16330

--- Comment #64 from Tomás Cohen Arazi <[hidden email]> ---
(In reply to Dilan Johnpullé from comment #62)

> Still getting error messages when running the test:
>
> vagrant@kohadevbox:kohaclone((8c8b618...))$ sudo perl
> t/db_dependent/api/v1/patrons.t
> 1..5
> unable to locate Koha configuration file koha-conf.xml at C4/Context.pm line
> 243.
> unable to locate Koha configuration file koha-conf.xml at C4/Context.pm line
> 243.
> unable to locate Koha configuration file koha-conf.xml at C4/Context.pm line
> 243.
> unable to locate Koha configuration file koha-conf.xml at C4/Context.pm line
> 243.
> unable to locate Koha configuration file koha-conf.xml at C4/Context.pm line
> 243.
> unable to locate Koha configuration file koha-conf.xml at C4/Context.pm line
> 243.
> Use of uninitialized value in concatenation (.) or string at C4/Templates.pm
> line 154.
> unable to locate Koha configuration file koha-conf.xml at C4/Context.pm line
> 243.
> unable to locate Koha configuration file koha-conf.xml at C4/Context.pm line
> 243.
> Use of uninitialized value in concatenation (.) or string at
> C4/Auth_with_cas.pm line 42.
> unable to locate Koha configuration file koha-conf.xml at C4/Context.pm line
> 243.
> unable to locate Koha configuration file koha-conf.xml at C4/Context.pm line
> 243.
> Can't call method "config" on unblessed reference at Koha/Database.pm line
> 56.
> # Looks like your test exited with 2 before it could output anything.

You need to get into the instance's she'll:
$ sudo koha-shell kohadev
$ cd /home/vagrant/kohaclon

and then run the tests

If your devbox was created recently try

$ kshell

Also, one of the dependencies makes it retire an upgrade, so inside kshell you
need to perform the upgrade:

$ perl installer/data/mysql/updatedatabase.pl

before running the tests. Otherwise you will get tons of 503 errors instead of
the expected results.

--
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[hidden email]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/
Reply | Threaded
Open this post in threaded view
|

[Bug 16330] REST API: add routes to add, update and delete patrons

bugzilla-daemon
In reply to this post by bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16330

Tomás Cohen Arazi <[hidden email]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Blocks|                            |19774


Referenced Bugs:

https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19774
[Bug 19774] Adapt existing endpoints to new naming guidelines
--
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[hidden email]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/
Reply | Threaded
Open this post in threaded view
|

[Bug 16330] REST API: add routes to add, update and delete patrons

bugzilla-daemon
In reply to this post by bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16330

Tomás Cohen Arazi <[hidden email]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Blocks|19774                       |


Referenced Bugs:

https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19774
[Bug 19774] Adapt existing endpoints to new naming guidelines OMNIBUS
--
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[hidden email]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/
Reply | Threaded
Open this post in threaded view
|

[Bug 16330] REST API: add routes to add, update and delete patrons

bugzilla-daemon
In reply to this post by bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16330

Tomás Cohen Arazi <[hidden email]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Blocks|                            |19784


Referenced Bugs:

https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19784
[Bug 19784] Adapt /v1/patrons to new naming guidelines
--
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[hidden email]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/
Reply | Threaded
Open this post in threaded view
|

[Bug 16330] REST API: add routes to add, update and delete patrons

bugzilla-daemon
In reply to this post by bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16330

--- Comment #65 from Dilan Johnpullé <[hidden email]> ---
Hi Tomas, I was able to successfully run all the tests and add and delete
patrons using RESTer following your helpful advice in IRC. Unfortunately
attempting to update patrons (PUT /api/v1/patrons/<borrowernumber>) throws a
500 Internal Server Error. The Koha logs don't show anything in them related to
this and my apache logs don't show anything out of the ordinary either.

Thanks again for the help.

--
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[hidden email]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/
Reply | Threaded
Open this post in threaded view
|

[Bug 16330] REST API: add routes to add, update and delete patrons

bugzilla-daemon
In reply to this post by bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16330

--- Comment #66 from Benjamin Rokseth <[hidden email]> ---
One thing that needs to be fixed:
PUT endpoint uses C4::ModMember (which I think is plain wrong, but thats
another issue and I understand why...) and this requires borrowernumber as
param due to some internal lookups, categorycode e.g.)

tests pass since entire patron object is passed in, but that's a false
positive, since borrowernumber shouldn't be passed in body, its already a path
param. since path param must be authoritative, I suggest just overwriting body
param in the helper method already used.

Otherwise great work!

--
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[hidden email]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/
Reply | Threaded
Open this post in threaded view
|

[Bug 16330] REST API: add routes to add, update and delete patrons

bugzilla-daemon
In reply to this post by bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16330

--- Comment #67 from Tomás Cohen Arazi <[hidden email]> ---
Created attachment 69752
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=69752&action=edit
Bug 16330: (QA follow-up) ModMember requires borrowernumber

This patch fixes the tests so they highlight the fact that:
- PUT only worked on the tests because borrowernumber was passed on them
- ModMember expects borrowernumber on the hash it gets passed.

It also fixes the issue.

To test:
- Apply this patch
- Run:
  $ kshell
 k$ prove t/db_dependent/api/v1/patrons.t
=> SUCCESS: Tests pass

Signed-off-by: Tomas Cohen Arazi <[hidden email]>

--
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[hidden email]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/
Reply | Threaded
Open this post in threaded view
|

[Bug 16330] REST API: add routes to add, update and delete patrons

bugzilla-daemon
In reply to this post by bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16330

Benjamin Rokseth <[hidden email]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #69546|0                           |1
        is obsolete|                            |

--- Comment #68 from Benjamin Rokseth <[hidden email]> ---
Created attachment 69762
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=69762&action=edit
Bug 16330: REST API: add routes to add, update and delete patrons

This patch adds support for add, edit and delete patrons via REST API.

GET  /api/v1/patrons                   Get patron list from params
GET  /api/v1/patrons/<borrowernumber>  Get single patron
POST /api/v1/patrons                   Create a new patron
PUT  /api/v1/patrons/<borrowernumber>  Update data about patron
DEL  /api/v1/patrons/<borrowernumber>  Delete a patron

Revised Test plan:
1) Apply this patch
2) Run tests perl t/db_dependent/api/v1/patrons.t
3) Add a user with proper rights to use the REST API
4) play with your favourite REST client (curl/httpie, etc.):
   Authenticate with the user created above and get a CGISESSION id.
   Use the CGISESSION to add, edit and delete patrons via the API.
5) Use PUT /patrons/<borrowernumber> for a patron without borrowers
   flag. This should go into pending patron modification status and
   needs to be accepted by a librarian.

Please note there is no validation of body input in PUT/POST other
than branchcode,category,userid,cardnumber.

Signed-off-by: Tomas Cohen Arazi <[hidden email]>
Signed-off-by: Benjamin Rokseth <[hidden email]>

--
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[hidden email]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/
123456