Bugzilla – Attachment 109582 Details for
Bug 23634
Privilege escalation vulnerability for staff users with 'edit_borrowers' permission and 'OpacResetPassword' enabled
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 23634: Make is_superlibrarian return 1 or 0
Bug-23634-Make-issuperlibrarian-return-1-or-0.patch (text/plain), 1.91 KB, created by
Jonathan Druart
on 2020-09-03 08:20:49 UTC
(
hide
)
Description:
Bug 23634: Make is_superlibrarian return 1 or 0
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2020-09-03 08:20:49 UTC
Size:
1.91 KB
patch
obsolete
>From e948533ab65db38e0cca9c84ffb84cfef14c029f Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Thu, 3 Sep 2020 10:20:32 +0200 >Subject: [PATCH] Bug 23634: Make is_superlibrarian return 1 or 0 > >--- > Koha/Patron.pm | 2 +- > t/db_dependent/Koha/Patron.t | 9 ++++++--- > 2 files changed, 7 insertions(+), 4 deletions(-) > >diff --git a/Koha/Patron.pm b/Koha/Patron.pm >index 42bd0886e5..9c8de9b014 100644 >--- a/Koha/Patron.pm >+++ b/Koha/Patron.pm >@@ -1371,7 +1371,7 @@ Return true if the patron is a superlibrarian. > > sub is_superlibrarian { > my ($self) = @_; >- return $self->has_permission( { superlibrarian => 1 } ); >+ return $self->has_permission( { superlibrarian => 1 } ) ? 1 : 0; > } > > =head3 is_adult >diff --git a/t/db_dependent/Koha/Patron.t b/t/db_dependent/Koha/Patron.t >index fb078a83cb..d2aff3353c 100644 >--- a/t/db_dependent/Koha/Patron.t >+++ b/t/db_dependent/Koha/Patron.t >@@ -214,7 +214,7 @@ subtest 'login_attempts tests' => sub { > > subtest 'is_superlibrarian() tests' => sub { > >- plan tests => 2; >+ plan tests => 3; > > $schema->storage->txn_begin; > >@@ -228,10 +228,13 @@ subtest 'is_superlibrarian() tests' => sub { > } > ); > >- ok( !$patron->is_superlibrarian, 'Patron is not a superlibrarian and the method returns the correct value' ); >+ is( $patron->is_superlibrarian, 0, 'Patron is not a superlibrarian and the method returns the correct value' ); > > $patron->flags(1)->store->discard_changes; >- ok( $patron->is_superlibrarian, 'Patron is a superlibrarian and the method returns the correct value' ); >+ is( $patron->is_superlibrarian, 1, 'Patron is a superlibrarian and the method returns the correct value' ); >+ >+ $patron->flags(0)->store->discard_changes; >+ is( $patron->is_superlibrarian, 0, 'Patron is not a superlibrarian and the method returns the correct value' ); > > $schema->storage->txn_rollback; > }; >-- >2.20.1
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 23634
:
92932
|
92998
|
95563
|
95564
|
95574
|
95575
|
95576
|
95577
|
95582
|
97986
|
97987
|
97988
|
97989
|
97990
|
106159
|
106160
|
106161
|
106162
|
106163
|
106723
|
106724
|
106725
|
106726
|
106727
|
106764
|
106826
|
106837
|
106838
|
106839
|
106840
|
106841
|
106842
|
106843
|
106844
|
106979
|
106980
|
106981
|
106982
|
106983
|
106984
|
106985
|
106986
| 109582