Bugzilla – Attachment 83414 Details for
Bug 22031
C4::Auth->haspermission should allow checking for more than one subpermission
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 22031: Unit tests
Bug-22031-Unit-tests.patch (text/plain), 2.14 KB, created by
Nick Clemens (kidclamp)
on 2018-12-20 13:43:24 UTC
(
hide
)
Description:
Bug 22031: Unit tests
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2018-12-20 13:43:24 UTC
Size:
2.14 KB
patch
obsolete
>From 31123854cfe3ba17008e9a3a8d85e1e301bc7f82 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Thu, 20 Dec 2018 13:41:05 +0000 >Subject: [PATCH] Bug 22031: Unit tests > >To test: >1 - Apply this patch only >2 - prove -v t/db_dependent/Auth/haspermission.t >3 - It will fail >--- > t/db_dependent/Auth/haspermission.t | 29 ++++++++++++++++++----------- > 1 file changed, 18 insertions(+), 11 deletions(-) > >diff --git a/t/db_dependent/Auth/haspermission.t b/t/db_dependent/Auth/haspermission.t >index bf0290d6be..886d774223 100644 >--- a/t/db_dependent/Auth/haspermission.t >+++ b/t/db_dependent/Auth/haspermission.t >@@ -20,7 +20,7 @@ > # along with Koha; if not, see <http://www.gnu.org/licenses>. > > use Modern::Perl; >-use Test::More tests => 13; >+use Test::More tests => 14; > > use Koha::Database; > use t::lib::TestBuilder; >@@ -53,14 +53,6 @@ $builder->build({ > code => 'upload_local_cover_images', > }, > }); >-$builder->build({ >- source => 'UserPermission', >- value => { >- borrowernumber => $borr2->{borrowernumber}, >- module_bit => 13, # tools >- code => 'batch_upload_patron_images', >- }, >-}); > > # Check top level permission for superlibrarian > my $r = haspermission( $borr1->{userid}, >@@ -99,10 +91,25 @@ $r = haspermission( $borr2->{userid}, > { acquisition => 'budget_manage', tools => 'edit_news' } ); > is( $r, 0, 'Borrower2/two granular should fail' ); > $r = haspermission( $borr2->{userid}, { >- tools => 'upload_local_cover_images', >- tools => 'batch_upload_patron_images', >+ tools => ['upload_local_cover_images','batch_upload_patron_images'], >+}); >+ >+is( $r, 0, 'Borrower2/tools granular two upload subperms if only has one should fail' ); >+ >+$builder->build({ >+ source => 'UserPermission', >+ value => { >+ borrowernumber => $borr2->{borrowernumber}, >+ module_bit => 13, # tools >+ code => 'batch_upload_patron_images', >+ }, >+}); >+ >+$r = haspermission( $borr2->{userid}, { >+ tools => ['upload_local_cover_images','batch_upload_patron_images'], > }); > is( ref($r), 'HASH', 'Borrower2/tools granular two upload subperms' ); > >+ > # End > $schema->storage->txn_rollback; >-- >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 22031
:
83414
|
83415
|
83474
|
86197
|
86204