Bugzilla – Attachment 129334 Details for
Bug 29541
Patron images can be accessed with just 'catalogue' permission
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 29541: Prevent users from another group to access patron's images
Bug-29541-Prevent-users-from-another-group-to-acce.patch (text/plain), 1.89 KB, created by
Tomás Cohen Arazi (tcohen)
on 2022-01-12 12:08:37 UTC
(
hide
)
Description:
Bug 29541: Prevent users from another group to access patron's images
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2022-01-12 12:08:37 UTC
Size:
1.89 KB
patch
obsolete
>From b2013e880c646d5f08afbeaa87942d7373346639 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Mon, 6 Dec 2021 13:58:25 +0100 >Subject: [PATCH] Bug 29541: Prevent users from another group to access > patron's images > >We should respect group restrictions here. > >Test plan: >Create a patron from another group of libraries and don't let them >access info from patrons outside of this group. >Access the following link and confirm that you can see the image only >for patrons from their group > /cgi-bin/koha/members/patronimage.pl?borrowernumber=XX > >Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > members/patronimage.pl | 16 +++++++++++----- > 1 file changed, 11 insertions(+), 5 deletions(-) > >diff --git a/members/patronimage.pl b/members/patronimage.pl >index c4a6e5eb40..e5b2b23e72 100755 >--- a/members/patronimage.pl >+++ b/members/patronimage.pl >@@ -25,8 +25,7 @@ use Modern::Perl; > use CGI qw ( -utf8 ); > use C4::Auth qw( check_api_auth ); > use C4::Context; >-use C4::Members; >-use Koha::Patron::Images; >+use Koha::Patrons; > > $|=1; > >@@ -54,15 +53,22 @@ unless ( $status eq 'ok' ) { > exit 0; > } > >- >- > if ($query->param('borrowernumber')) { > $borrowernumber = $query->param('borrowernumber'); > } else { > $borrowernumber = shift; > } > >-my $patron_image = Koha::Patron::Images->find($borrowernumber); >+my $patron = Koha::Patrons->find( $borrowernumber ); >+my $userenv = C4::Context->userenv; >+my $logged_in_user = Koha::Patrons->find( $userenv->{number} ); >+ >+unless ( $logged_in_user->can_see_patron_infos( $patron ) ) { >+ print $query->header(-type => 'text/plain', -status => '403 Forbidden'); >+ exit 0; >+} >+ >+my $patron_image = $patron->image; > > # NOTE: Never dump the contents of $imagedata->{'patronimage'} via a warn to a log or nasty > # things will result... you have been warned! >-- >2.32.0
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 29541
:
127932
|
128276
|
128801
|
128802
|
129333
| 129334