Bug 12873 - Reserve can be cancelled by any logged in user

It is possible to cancel reservations through simply running opac-modreserve.pl with existing reserve_id number. This may provide remove even all reservations from system. The only limitation is that user have to be logged in. Simplest solution is to check whether reserve belongs to user or not.

Test plan:
1. Create reserves by 2 different users, and get their ID's
2. Before patch, hold may by cancelled by anyone who run site:
http://example.com/cgi-bin/koha/opac-modrequest.pl?reserve_id=XXX
3. After patch hold may by cancelled only by user whose reserve is.

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit 60875757c7)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
This commit is contained in:
Rafal Kopaczka 2014-09-04 16:40:33 +02:00 committed by Fridolin Somers
parent 79b0191649
commit 214e87d886
1 changed files with 3 additions and 1 deletions

View File

@ -45,7 +45,9 @@ my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
my $reserve_id = $query->param('reserve_id');
if ($reserve_id && $borrowernumber) {
CancelReserve({ reserve_id => $reserve_id });
my $reserve = GetReserve($reserve_id);
CancelReserve({ reserve_id => $reserve_id }) if $borrowernumber == $reserve->{borrowernumber} ;
}
print $query->redirect("/cgi-bin/koha/opac-user.pl#opac-user-holds");