Bugzilla – Attachment 62013 Details for
Bug 18403
Hide patron information if not part of the logged in user library group
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 18403: Send logged_in_user to template from C4::Auth
Bug-18403-Send-loggedinuser-to-template-from-C4Aut.patch (text/plain), 2.77 KB, created by
Jonathan Druart
on 2017-04-10 21:32:35 UTC
(
hide
)
Description:
Bug 18403: Send logged_in_user to template from C4::Auth
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2017-04-10 21:32:35 UTC
Size:
2.77 KB
patch
obsolete
>From 952bdebad554de1cda086b937c6d231afcc0958c Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Tue, 4 Apr 2017 16:43:58 -0300 >Subject: [PATCH] Bug 18403: Send logged_in_user to template from C4::Auth > >Technical note: >To ease future changes we are passing a logged_in_user variable to templates. >It contains the Koha::Patron object representing the logged in patron. >This will be very useful for this patch and even after (for instance we will be >able to replace easily loggedinusername and loggedinusernumber). >--- > C4/Auth.pm | 20 ++++++++++---------- > 1 file changed, 10 insertions(+), 10 deletions(-) > >diff --git a/C4/Auth.pm b/C4/Auth.pm >index 30fde1a..61b7cfc 100644 >--- a/C4/Auth.pm >+++ b/C4/Auth.pm >@@ -215,26 +215,26 @@ sub get_template_and_user { > # It's possible for $user to be the borrowernumber if they don't have a > # userid defined (and are logging in through some other method, such > # as SSL certs against an email address) >- my $borrower; >+ my $patron; > $borrowernumber = getborrowernumber($user) if defined($user); > if ( !defined($borrowernumber) && defined($user) ) { >- $borrower = Koha::Patrons->find( $user ); >- if ($borrower) { >- $borrower = $borrower->unblessed; >+ $patron = Koha::Patrons->find( $user ); >+ if ($patron) { > $borrowernumber = $user; > > # A bit of a hack, but I don't know there's a nicer way > # to do it. >- $user = $borrower->{firstname} . ' ' . $borrower->{surname}; >+ $user = $patron->firstname . ' ' . $patron->surname; > } > } else { >- $borrower = Koha::Patrons->find( $borrowernumber ); >- $borrower->unblessed if $borrower; # FIXME Otherwise, what to do? >+ $patron = Koha::Patrons->find( $borrowernumber ); >+ # FIXME What to do if $patron does not exist? > } > > # user info >- $template->param( loggedinusername => $user ); >- $template->param( loggedinusernumber => $borrowernumber ); >+ $template->param( loggedinusername => $user ); # FIXME Should be replaced with something like patron-title.inc >+ $template->param( loggedinusernumber => $borrowernumber ); # FIXME Should be replaced with logged_in_user.borrowernumber >+ $template->param( logged_in_user => $patron ); > $template->param( sessionID => $sessionID ); > > if ( $in->{'type'} eq 'opac' ) { >@@ -256,7 +256,7 @@ sub get_template_and_user { > ); > } > >- $template->param( "USER_INFO" => $borrower ); >+ $template->param( "USER_INFO" => $patron->unblessed ); > > my $all_perms = get_all_subpermissions(); > >-- >2.9.3
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 18403
:
62010
|
62011
|
62012
|
62013
|
62014
|
62015
|
62016
|
62017
|
62018
|
62019
|
62020
|
62021
|
62022
|
62023
|
62024
|
62025
|
62026
|
62027
|
62028
|
62029
|
62030
|
62031
|
62032
|
62033
|
62302
|
62303
|
62830
|
62831
|
62832
|
62833
|
62834
|
62835
|
62836
|
62837
|
62838
|
62839
|
62840
|
62841
|
62842
|
62843
|
62844
|
62845
|
62846
|
62847
|
62848
|
62849
|
62850
|
62851
|
62852
|
62853
|
62854
|
62855
|
71392
|
71394
|
71500
|
71501
|
71502
|
71503
|
71504
|
71505
|
71506
|
71507
|
71508
|
71509
|
71510
|
71511
|
71512
|
71513
|
71514
|
71515
|
71516
|
71517
|
71518
|
71519
|
71520
|
71521
|
71522
|
71523
|
71524
|
71525
|
71526
|
71527
|
71528
|
71529
|
71530
|
71767