Bugzilla – Attachment 95556 Details for
Bug 24067
Refactor REST API allow-owner authorization logic
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 24067: Use owner_authorization in POST /public/patrons/{patron_id}/password
Bug-24067-Use-ownerauthorization-in-POST-publicpat.patch (text/plain), 1.02 KB, created by
Lari Taskula
on 2019-11-19 14:37:23 UTC
(
hide
)
Description:
Bug 24067: Use owner_authorization in POST /public/patrons/{patron_id}/password
Filename:
MIME Type:
Creator:
Lari Taskula
Created:
2019-11-19 14:37:23 UTC
Size:
1.02 KB
patch
obsolete
>From 24896edf37c5d247ad2d788603300417db092374 Mon Sep 17 00:00:00 2001 >From: Lari Taskula <lari.taskula@hypernova.fi> >Date: Tue, 19 Nov 2019 13:59:02 +0000 >Subject: [PATCH] Bug 24067: Use owner_authorization in POST > /public/patrons/{patron_id}/password > >As an example, use this functionality in Koha::REST::V1::Patrons::Password > >To test: >1. prove t/db_dependent/api/v1/patrons_password.t >2. Observe success > >Sponsored-by: Koha-Suomi Oy >--- > Koha/REST/V1/Patrons/Password.pm | 11 +++++++++++ > 1 file changed, 11 insertions(+) > >diff --git a/Koha/REST/V1/Patrons/Password.pm b/Koha/REST/V1/Patrons/Password.pm >index e9d42d7fcb..dab2afdf91 100644 >--- a/Koha/REST/V1/Patrons/Password.pm >+++ b/Koha/REST/V1/Patrons/Password.pm >@@ -135,4 +135,15 @@ sub set_public { > }; > } > >+sub owner_authorization { >+ my ($c, $method, $user) = @_; >+ >+ if ($method eq 'set_public') { >+ my $patron_id = $c->match->stack->[-1]->{'patron_id'}; >+ return $user->borrowernumber == $patron_id ? 1 : 0; >+ } >+ >+ return 0; >+} >+ > 1; >-- >2.17.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 24067
:
95553
|
95554
|
95555
|
95556
|
95561
|
95571