Bug 22529

Summary: /svc/members/search relies on quirks of haspermission
Product: Koha Reporter: Martin Renvoize <martin.renvoize>
Component: Architecture, internals, and plumbingAssignee: Jonathan Druart <jonathan.druart>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: enhancement    
Priority: P5 - low CC: 1joynelson, jonathan.druart, josef.moravec
Version: master   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22483
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
20.05.00
Bug Depends on: 22483    
Bug Blocks:    
Attachments: Bug 22529: Use new C4::Auth::haspermission from svc/members/search
Bug 22529: Use new C4::Auth::haspermission from svc/members/search
Bug 22529: Use new C4::Auth::haspermission from svc/members/search

Description Martin Renvoize 2019-03-18 10:05:19 UTC
Just parking this one here so we don't lose the comment from a closed bug 22483

>(In reply to Martin Renvoize from comment #0)
>> This functionality was in use in two places. /svc/members/search and
>> /Koha/REST/V1/Auth.pm.
>
>
>About /svc/members/search: at first glance I think we should rewrite this code to adapt it, not the other way around.
Comment 1 Jonathan Druart 2019-05-06 16:05:46 UTC
Created attachment 89372 [details] [review]
Bug 22529: Use new C4::Auth::haspermission from svc/members/search

The svc/members/search script can be used to retrieve patrons with a
specific permission. This feature is only used once, to link patrons to
funds.
The code in the script is duplicated from what we have in
C4::Auth::haspermission, and it makes sense to clean it.

Test plan:
Create a fund and add users to this fund.
When you search for users you must only have a list of patrons with the
acquisition.order_manage permission.
Comment 2 Bernardo Gonzalez Kriegel 2020-03-03 16:04:13 UTC
Created attachment 100042 [details] [review]
Bug 22529: Use new C4::Auth::haspermission from svc/members/search

The svc/members/search script can be used to retrieve patrons with a
specific permission. This feature is only used once, to link patrons to
funds.
The code in the script is duplicated from what we have in
C4::Auth::haspermission, and it makes sense to clean it.

Test plan:
Create a fund and add users to this fund.
When you search for users you must only have a list of patrons with the
acquisition.order_manage permission.

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Works as described. No errors
Comment 3 Martin Renvoize 2020-03-04 11:18:33 UTC
Created attachment 100096 [details] [review]
Bug 22529: Use new C4::Auth::haspermission from svc/members/search

The svc/members/search script can be used to retrieve patrons with a
specific permission. This feature is only used once, to link patrons to
funds.
The code in the script is duplicated from what we have in
C4::Auth::haspermission, and it makes sense to clean it.

Test plan:
Create a fund and add users to this fund.
When you search for users you must only have a list of patrons with the
acquisition.order_manage permission.

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Works as described. No errors
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 4 Martin Renvoize 2020-03-04 11:19:32 UTC
Took me a short while to wrap my head back around this one.. sorry it's languished so long..

I'm confident in the change, thanks for taking it on Jonathan.

PQA
Comment 5 Martin Renvoize 2020-03-04 16:13:33 UTC
Nice work everyone!

Pushed to master for 20.05
Comment 6 Joy Nelson 2020-04-01 21:18:11 UTC
enhancement not backported to 19.11.x