Bugzilla – Attachment 71528 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: rename Koha::Patron->can to has_permission
Bug-18403-rename-KohaPatron-can-to-haspermission.patch (text/plain), 2.42 KB, created by
Jonathan Druart
on 2018-02-12 20:41:57 UTC
(
hide
)
Description:
Bug 18403: rename Koha::Patron->can to has_permission
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2018-02-12 20:41:57 UTC
Size:
2.42 KB
patch
obsolete
>From 73f515793a55ac6d2824ebad7069bb9fbbefec82 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Mon, 12 Feb 2018 17:33:18 -0300 >Subject: [PATCH] Bug 18403: rename Koha::Patron->can to has_permission > >I do not exactly why but there is a conflict in the name of the method > >prove t/db_dependent/api/v1/patrons.t failed with >[Mon Feb 12 17:13:16 2018] [error] Can't use string ("TO_JSON") as a >HASH ref while "strict refs" in use at >/home/vagrant/kohaclone/C4/Auth.pm line 2053. >--- > Koha/Patron.pm | 6 +++--- > t/db_dependent/api/v1/patrons.t | 2 +- > 2 files changed, 4 insertions(+), 4 deletions(-) > >diff --git a/Koha/Patron.pm b/Koha/Patron.pm >index c1951a5b3c..b017d43006 100644 >--- a/Koha/Patron.pm >+++ b/Koha/Patron.pm >@@ -736,7 +736,7 @@ sub can_see_patrons_from { > my $can = 0; > if ( $self->branchcode eq $branchcode ) { > $can = 1; >- } elsif ( $self->can( { borrowers => 'view_borrower_infos_from_any_libraries' } ) ) { >+ } elsif ( $self->has_permission( { borrowers => 'view_borrower_infos_from_any_libraries' } ) ) { > $can = 1; > } elsif ( my $library_groups = $self->library->library_groups ) { > while ( my $library_group = $library_groups->next ) { >@@ -773,7 +773,7 @@ sub libraries_where_can_see_patrons { > } > else { > unless ( >- $self->can( >+ $self->has_permission( > { borrowers => 'view_borrower_infos_from_any_libraries' } > ) > ) >@@ -798,7 +798,7 @@ sub libraries_where_can_see_patrons { > return sort (@restricted_branchcodes); > } > >-sub can { >+sub has_permission { > my ( $self, $flagsrequired ) = @_; > return unless $self->userid; > # TODO code from haspermission needs to be moved here! >diff --git a/t/db_dependent/api/v1/patrons.t b/t/db_dependent/api/v1/patrons.t >index a8579db581..2166547da3 100644 >--- a/t/db_dependent/api/v1/patrons.t >+++ b/t/db_dependent/api/v1/patrons.t >@@ -90,7 +90,7 @@ $tx = $t->ua->build_tx(GET => "/api/v1/patrons/" . ($borrower->{ borrowernumber > $tx->req->cookies({name => 'CGISESSID', value => $session->id}); > $t->request_ok($tx) > ->status_is(403) >- ->json_is('/required_permissions', {"borrowers" => "1"}); >+ ->json_is('/required_permissions', {"borrowers" => "edit_borrowers"}); > > # User without permissions, but is the owner of the object > $tx = $t->ua->build_tx(GET => "/api/v1/patrons/" . $borrower->{borrowernumber}); >-- >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