Bugzilla – Attachment 71504 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: Add new method Koha::Patron->can_see_patron_info
Bug-18403-Add-new-method-KohaPatron-canseepatronin.patch (text/plain), 1.98 KB, created by
Jonathan Druart
on 2018-02-12 19:33:39 UTC
(
hide
)
Description:
Bug 18403: Add new method Koha::Patron->can_see_patron_info
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2018-02-12 19:33:39 UTC
Size:
1.98 KB
patch
obsolete
>From 4134df83734d2fabd4806339854cfab41faab82d Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Thu, 6 Apr 2017 16:10:18 -0300 >Subject: [PATCH] Bug 18403: Add new method Koha::Patron->can_see_patron_info > >Technical note: >This is the method that will be called on the logged_in_user variable sent to >the template. Moreover we will check that the logged in user can access patron' >information when access to members/* and some circulation scripts will be done. > >Signed-off-by: Signed-off-by: Jon McGowan <jon.mcgowan@ptfs-europe.com> > >Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >--- > Koha/Patron.pm | 33 +++++++++++++++++++++++++++++++++ > 1 file changed, 33 insertions(+) > >diff --git a/Koha/Patron.pm b/Koha/Patron.pm >index e83eed6b55..782e5ee04c 100644 >--- a/Koha/Patron.pm >+++ b/Koha/Patron.pm >@@ -709,6 +709,39 @@ sub account_locked { > and $self->login_attempts >= $FailedLoginAttempts )? 1 : 0; > } > >+=head3 can_see_patron_infos >+ >+my $can_see = $patron->can_see_patron_infos( $patron ); >+ >+Return true if the patron (usually the logged in user) can see the patron's infos for a given patron >+ >+=cut >+ >+sub can_see_patron_infos { >+ my ( $self, $patron ) = @_; >+ my $can = 0; >+ if ( $self->branchcode eq $patron->branchcode ) { >+ $can = 1; >+ } elsif ( $self->can( { borrowers => 'view_borrower_infos_from_any_libraries' } ) ) { >+ $can = 1; >+ } elsif ( my $library_groups = $self->library->library_groups ) { >+ while ( my $library_group = $library_groups->next ) { >+ if ( $library_group->parent->has_child( $patron->library->branchcode ) ) { >+ $can = 1; >+ last; >+ } >+ } >+ } >+ return $can; >+} >+ >+sub can { >+ my ( $self, $flagsrequired ) = @_; >+ return unless $self->userid; >+ # TODO code from haspermission needs to be moved here! >+ return C4::Auth::haspermission( $self->userid, $flagsrequired ); >+} >+ > =head3 type > > =cut >-- >2.11.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 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