]> git.koha-community.org Git - koha.git/commit
Bug 18403: Add sub output_and_exit_if_error - unknown_patron & cannot_see_patron_infos
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Tue, 4 Apr 2017 21:48:45 +0000 (18:48 -0300)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Mon, 12 Feb 2018 18:41:38 +0000 (15:41 -0300)
commitcee2cf9ff927504f9c24f6519462a7d702c5c27d
tree057cd5f072c5ae158b54ecb5a7750299e54be828
parent4bc92169dcc04cd0bd586abf01828331711980cc
Bug 18403: Add sub output_and_exit_if_error - unknown_patron & cannot_see_patron_infos

Test plan:
Login with a patron that is not allowed to see patron's information for patrons
outside of his group. Try to access patron's information from scripts of the patron
module (members/*) and circ/circulation.pl.
You should be able to access patron's information of patrons outside of your group
and get "You are not allowed to see the information of this patron."
If you try and access a patron page with a borrowernumber that does not exist, you
should get "This patron does not exist"

Technical note:
A new C4::Output subroutine is created in this patch: "output_and_exit_if_error"
Executed at the beginning of the script it will permit not to copy/paste all the
different checks to know if the logged in user is authorised to see patron's information.
The design here can be discussed, but I did not find an alternative with as less changes.
On the way I refactor what we did with 'unknowuser' previously: it will now work with all
patron pages, not only the few that used it.
Note that the 'or die "Not logged in";' part should not be needed, but... who trusts
C4::Auth?
I think it could be used as a safeguard later. I am willing to sed and remove them
if required.

Changes in discharge.pl are mainly indentation changes.

With this patch we should now have a $patron variable that refer to the patron we
want to access. That will be very useful to remove plenty of code in members/* and
only pass this variable to the template (instead of 1 variable per patron's attribute).

Signed-off-by: Signed-off-by: Jon McGowan <jon.mcgowan@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
46 files changed:
C4/Output.pm
koha-tmpl/intranet-tmpl/prog/en/includes/acquisitions-toolbar.inc
koha-tmpl/intranet-tmpl/prog/en/includes/authorities-toolbar.inc
koha-tmpl/intranet-tmpl/prog/en/includes/blocking_errors.inc [new file with mode: 0644]
koha-tmpl/intranet-tmpl/prog/en/includes/budgets-admin-toolbar.inc
koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc
koha-tmpl/intranet-tmpl/prog/en/includes/labels-toolbar.inc
koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc
koha-tmpl/intranet-tmpl/prog/en/includes/patron-toolbar.inc
koha-tmpl/intranet-tmpl/prog/en/includes/patroncards-toolbar.inc
koha-tmpl/intranet-tmpl/prog/en/includes/reports-toolbar.inc
koha-tmpl/intranet-tmpl/prog/en/includes/rotating-collections-toolbar.inc
koha-tmpl/intranet-tmpl/prog/en/includes/serials-toolbar.inc
koha-tmpl/intranet-tmpl/prog/en/includes/virtualshelves-toolbar.inc
koha-tmpl/intranet-tmpl/prog/en/modules/members/discharge.tt
koha-tmpl/intranet-tmpl/prog/en/modules/members/housebound.tt
koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt
koha-tmpl/intranet-tmpl/prog/en/modules/members/statistics.tt
members/boraccount.pl
members/deletemem.pl
members/discharge.pl
members/discharges.pl
members/files.pl
members/housebound.pl
members/mancredit.pl
members/maninvoice.pl
members/member-flags.pl
members/member-password.pl
members/memberentry.pl
members/members-update-do.pl
members/mod_debarment.pl
members/moremember.pl
members/notices.pl
members/pay.pl
members/paycollect.pl
members/print_overdues.pl
members/printfeercpt.pl
members/printinvoice.pl
members/printslip.pl
members/purchase-suggestions.pl
members/readingrec.pl
members/routing-lists.pl
members/setstatus.pl
members/statistics.pl
members/summary-print.pl
members/update-child.pl