Bugzilla – Attachment 105847 Details for
Bug 24003
REST API should set C4::Context->userenv
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 24003: (follow-up) Add all userenv parameters
Bug-24003-follow-up-Add-all-userenv-parameters.patch (text/plain), 2.00 KB, created by
Martin Renvoize (ashimema)
on 2020-06-12 15:46:10 UTC
(
hide
)
Description:
Bug 24003: (follow-up) Add all userenv parameters
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2020-06-12 15:46:10 UTC
Size:
2.00 KB
patch
obsolete
>From 439cc68ca29f8631c6698ab653b9e037e976a212 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Tue, 9 Jun 2020 12:40:32 -0300 >Subject: [PATCH] Bug 24003: (follow-up) Add all userenv parameters > >This patch makes the API set more userenv params than just the >borrowernumber. To test: > >1. Apply this patch >2. Run: > $ kshell > k$ prove t/db_dependent/api/v1/auth_* >=> SUCCESS: All tests pass >3. Sign off :-D > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > Koha/REST/V1/Auth.pm | 32 ++++++++++++++++++++++++++++++-- > 1 file changed, 30 insertions(+), 2 deletions(-) > >diff --git a/Koha/REST/V1/Auth.pm b/Koha/REST/V1/Auth.pm >index 8e9336a9e0..9f137af35b 100644 >--- a/Koha/REST/V1/Auth.pm >+++ b/Koha/REST/V1/Auth.pm >@@ -249,8 +249,7 @@ sub authenticate_api_request { > C4::Context->interface('api'); > > if ( $user and !$cookie_auth ) { # cookie-auth sets this and more, don't mess with that >- C4::Context->_new_userenv( $user->borrowernumber ); >- C4::Context->set_userenv( $user->borrowernumber ); >+ $c->_set_userenv( $user ); > } > > if ( !$authorization and >@@ -490,4 +489,33 @@ sub _basic_auth { > return Koha::Patrons->find({ userid => $user_id }); > } > >+=head3 _set_userenv >+ >+ $c->_set_userenv( $patron ); >+ >+Internal method that sets C4::Context->userenv >+ >+=cut >+ >+sub _set_userenv { >+ my ( $c, $patron ) = @_; >+ >+ my $library = $patron->library; >+ >+ C4::Context->_new_userenv( $patron->borrowernumber ); >+ C4::Context->set_userenv( >+ $patron->borrowernumber, # number, >+ $patron->userid, # userid, >+ $patron->cardnumber, # cardnumber >+ $patron->firstname, # firstname >+ $patron->surname, # surname >+ $library->branchcode, # branch >+ $library->branchname, # branchname >+ $patron->flags, # flags, >+ $patron->email, # emailaddress >+ ); >+ >+ return $c; >+} >+ > 1; >-- >2.20.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 24003
:
95228
|
95230
|
105579
|
105580
|
105581
|
105586
|
105587
|
105588
|
105633
|
105634
|
105635
|
105666
|
105844
|
105845
|
105846
| 105847 |
106087
|
106088
|
106089
|
106090