Bugzilla – Attachment 152685 Details for
Bug 31393
Koha::Config->read_from_file incorrectly parses elements with 1 attribute named" content" (Shibboleth config)
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 31393: Koha::Config: handle the special case for 'content' attribute
Bug-31393-KohaConfig-handle-the-special-case-for-c.patch (text/plain), 2.86 KB, created by
Julian Maurice
on 2023-06-26 13:45:21 UTC
(
hide
)
Description:
Bug 31393: Koha::Config: handle the special case for 'content' attribute
Filename:
MIME Type:
Creator:
Julian Maurice
Created:
2023-06-26 13:45:21 UTC
Size:
2.86 KB
patch
obsolete
>From 14d641fdbd14cc4d3be9e98263e13e5d7b198234 Mon Sep 17 00:00:00 2001 >From: Julian Maurice <julian.maurice@biblibre.com> >Date: Mon, 26 Jun 2023 15:25:12 +0200 >Subject: [PATCH] Bug 31393: Koha::Config: handle the special case for > 'content' attribute > ><key content="value"></key> > >was wrongly parsed as > >{ key => 'value' } > >whereas it should be > >{ key => { content => 'value' } } > >The 'content' attribute is used in shibboleth config > >Test plan: >1 Run `prove t/Koha/Config.t` >--- > Koha/Config.pm | 2 +- > t/Koha/Config.t | 9 +++++++++ > t/data/koha-conf.xml | 9 +++++++++ > 3 files changed, 19 insertions(+), 1 deletion(-) > >diff --git a/Koha/Config.pm b/Koha/Config.pm >index eb0671dc2e..f3308c76a7 100644 >--- a/Koha/Config.pm >+++ b/Koha/Config.pm >@@ -239,7 +239,7 @@ sub _read_from_dom_node { > delete $subconfig->{id}; > } else { > my @keys = keys %$subconfig; >- if (1 == scalar @keys && $keys[0] eq 'content') { >+ if (!$node->hasAttributes() && 1 == scalar @keys && $keys[0] eq 'content') { > # An element with no attributes and no child elements becomes its text content > $subconfig = $subconfig->{content}; > } elsif (0 == scalar @keys) { >diff --git a/t/Koha/Config.t b/t/Koha/Config.t >index b49579c1f7..9f21bdfc2a 100755 >--- a/t/Koha/Config.t >+++ b/t/Koha/Config.t >@@ -131,6 +131,15 @@ subtest 'read_from_file() tests' => sub { > } > }, > 'useshibboleth' => '0', >+ 'shibboleth' => { >+ 'autocreate' => '1', >+ 'matchpoint' => 'userid', >+ 'mapping' => { >+ 'userid' => { 'is' => 'uid' }, >+ 'branchcode' => { 'content' => 'MAIN', 'is' => 'MAIN' }, >+ 'categorycode' => { 'content' => 'STAFF' }, >+ }, >+ }, > 'zebra_lockdir' => '/home/koha/var/lock/zebradb', > 'lockdir' => '__LOCK_DIR__', > 'use_zebra_facets' => '1', >diff --git a/t/data/koha-conf.xml b/t/data/koha-conf.xml >index 01052920b3..d3a40b356c 100644 >--- a/t/data/koha-conf.xml >+++ b/t/data/koha-conf.xml >@@ -111,6 +111,15 @@ > </mapping> > </ldapserver> > <useshibboleth>0</useshibboleth><!-- see C4::Auth_with_shibboleth for extra configs you must do to turn this on --> >+ <shibboleth> >+ <autocreate>1</autocreate> >+ <matchpoint>userid</matchpoint> <!-- koha borrowers field to match against for authentication --> >+ <mapping> >+ <userid is="uid"></userid> <!-- mapping between koha borrowers field and shibboleth attribute name. AD FS should use eppn instead of uid. --> >+ <branchcode content="MAIN" is="MAIN"></branchcode> >+ <categorycode content="STAFF"></categorycode> >+ </mapping> >+ </shibboleth> > <zebra_lockdir>/home/koha/var/lock/zebradb</zebra_lockdir> > <lockdir>__LOCK_DIR__</lockdir> > <use_zebra_facets>1</use_zebra_facets> >-- >2.30.2
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 31393
:
152609
|
152685
|
157768
|
158060