Bugzilla – Attachment 184916 Details for
Bug 32370
Provide a generic set of tools for JSON fields
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 32370: Adapt Koha::Auth::Identity::Provider
Bug-32370-Adapt-KohaAuthIdentityProvider.patch (text/plain), 3.04 KB, created by
Tomás Cohen Arazi (tcohen)
on 2025-07-30 19:48:35 UTC
(
hide
)
Description:
Bug 32370: Adapt Koha::Auth::Identity::Provider
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2025-07-30 19:48:35 UTC
Size:
3.04 KB
patch
obsolete
>From 7b9982eea0a5aa660786fff6091bbf38ec0dc37a Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Tue, 29 Nov 2022 15:14:23 -0300 >Subject: [PATCH] Bug 32370: Adapt Koha::Auth::Identity::Provider > >This patch adapts the Koha::Auth::Identity::Provider class to >make use of this, and also to prove the behavior is correct (expected >results, exceptions, encoding, etc). > >To test: >1. Run: > $ ktd --shell > k$ prove t/db_dependent/Koha/Auth/Identity/Provider.t \ > t/db_dependent/api/v1/idp.t >=> SUCCESS: Identity provider related tests pass! >2. Apply this patches >3. Repeat 1 >=> SUCCESS: Tests still pass! >4. Sign off :-D > >Signed-off-by: Nick Clemens <nick@bywatersolutions.com> >--- > Koha/Auth/Identity/Provider.pm | 36 +++++----------------------------- > 1 file changed, 5 insertions(+), 31 deletions(-) > >diff --git a/Koha/Auth/Identity/Provider.pm b/Koha/Auth/Identity/Provider.pm >index 0916a0173fc..382b9090f0e 100644 >--- a/Koha/Auth/Identity/Provider.pm >+++ b/Koha/Auth/Identity/Provider.pm >@@ -19,14 +19,10 @@ package Koha::Auth::Identity::Provider; > > use Modern::Perl; > >-use base qw(Koha::Object); >- >-use JSON qw( decode_json encode_json ); >-use Try::Tiny; >+use base qw(Koha::Object Koha::Object::JSONFields); > > use Koha::Auth::Identity::Provider::Domains; > use Koha::Exceptions; >-use Koha::Exceptions::Object; > > =head1 NAME > >@@ -61,11 +57,7 @@ Returns a I<hashref> containing the configuration parameters for the provider. > sub get_config { > my ($self) = @_; > >- return try { >- return decode_json( Encode::encode_utf8( $self->config ) ); >- } catch { >- Koha::Exceptions::Object::BadValue->throw("Error reading JSON data: $_"); >- }; >+ return $self->decode_json_field( { field => 'config' } ); > } > > =head3 set_config >@@ -104,14 +96,7 @@ sub set_config { > } > } > >- try { >- my $encoded_config = encode_json($config); >- $self->config($encoded_config); >- } catch { >- Koha::Exceptions::Object::BadValue->throw("Error serializing data into JSON: $_"); >- }; >- >- return $self; >+ return $self->set_encoded_json_field( { data => $config, field => 'config' } ); > } > > =head3 get_mapping >@@ -125,11 +110,7 @@ Returns a I<hashref> containing the attribute mapping for the provider. > sub get_mapping { > my ($self) = @_; > >- return try { >- return decode_json( Encode::encode_utf8( $self->mapping ) ); >- } catch { >- Koha::Exceptions::Object::BadValue->throw("Error reading JSON data: $_"); >- }; >+ return $self->decode_json_field( { field => 'mapping' } ); > } > > =head3 set_mapping >@@ -143,14 +124,7 @@ This method stores the passed mappings in JSON format. > sub set_mapping { > my ( $self, $mapping ) = @_; > >- try { >- my $encoded_mapping = encode_json($mapping); >- $self->mapping($encoded_mapping); >- } catch { >- Koha::Exceptions::Object::BadValue->throw("Error serializing data into JSON: $_"); >- }; >- >- return $self; >+ return $self->set_encoded_json_field( { data => $mapping, field => 'mapping' } ); > } > > =head3 upgrade_class >-- >2.50.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 32370
:
144329
|
144330
|
144331
|
144332
|
144333
|
144334
|
144347
|
144376
|
144377
|
144378
|
144445
|
145213
|
145214
|
145215
|
184914
|
184915
| 184916