Bugzilla – Attachment 166460 Details for
Bug 36503
Add a plugin hook to modify patrons after authentication
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 36503: (follow-up) Use the call method of Koha::Plugins
Bug-36503-follow-up-Use-the-call-method-of-KohaPlu.patch (text/plain), 3.07 KB, created by
Martin Renvoize (ashimema)
on 2024-05-09 13:57:37 UTC
(
hide
)
Description:
Bug 36503: (follow-up) Use the call method of Koha::Plugins
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2024-05-09 13:57:37 UTC
Size:
3.07 KB
patch
obsolete
>From 053862b12e48ef1c7efe1e66f3cdde1d9652b4d5 Mon Sep 17 00:00:00 2001 >From: Raphael Straub <raphael.straub@kit.edu> >Date: Thu, 2 May 2024 09:19:32 +0000 >Subject: [PATCH] Bug 36503: (follow-up) Use the call method of Koha::Plugins > >This removes the option to call multiple plugins in a prioritized order, >but this is not needed if there is only one plugin that uses this hook. > >Sponsored-by: Karlsruhe Institute of Technology (KIT) >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > Koha/Auth/Client.pm | 48 +++++++++++++++++++-------------------------- > 1 file changed, 20 insertions(+), 28 deletions(-) > >diff --git a/Koha/Auth/Client.pm b/Koha/Auth/Client.pm >index d51f400bba0..bd6a5155216 100644 >--- a/Koha/Auth/Client.pm >+++ b/Koha/Auth/Client.pm >@@ -60,38 +60,30 @@ sub get_user { > my $interface = $params->{interface}; > my $config = $params->{config}; > >- my $provider = Koha::Auth::Identity::Providers->search({ code => $provider_code })->next; >+ my $provider = Koha::Auth::Identity::Providers->search( { code => $provider_code } )->next; > >- my ( $mapped_data, $patron ) = $self->_get_data_and_patron({ provider => $provider, data => $data, config => $config }); >+ my ( $mapped_data, $patron ) = >+ $self->_get_data_and_patron( { provider => $provider, data => $data, config => $config } ); > > $mapped_data //= {}; > >- my $domain = $self->has_valid_domain_config({ provider => $provider, email => $mapped_data->{email}, interface => $interface}); >- >- # Call the plugin hook "auth_client_get_user" of all plugins in >- # ascending priority. >- if ( C4::Context->config('enable_plugins') ) { >- my @plugins = Koha::Plugins->new()->GetPlugins( >- { >- method => 'auth_client_get_user', >- } >- ); >- @plugins = sort { $a->retrieve_data('priority') <=> $b->retrieve_data('priority') } @plugins; >- my $args = { >- provider => $provider, >- data => $data, >- config => $config, >- mapped_data => $mapped_data, >- patron => $patron, >- domain => $domain, >- }; >- foreach my $plugin (@plugins) { >- $plugin->auth_client_get_user($args); >- } >- $mapped_data = $args->{'mapped_data'}; >- $patron = $args->{'patron'}; >- $domain = $args->{'domain'}; >- } >+ my $domain = $self->has_valid_domain_config( >+ { provider => $provider, email => $mapped_data->{email}, interface => $interface } ); >+ >+ my $args = { >+ provider => $provider, >+ data => $data, >+ config => $config, >+ mapped_data => $mapped_data, >+ patron => $patron, >+ domain => $domain, >+ }; >+ >+ # Call the plugin hook "auth_client_get_user" of all plugins. >+ Koha::Plugins->call( 'auth_client_get_user', $args ); >+ $mapped_data = $args->{'mapped_data'}; >+ $patron = $args->{'patron'}; >+ $domain = $args->{'domain'}; > > $patron->set($mapped_data)->store if $patron && $domain->update_on_auth; > >-- >2.45.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 36503
:
164379
|
164628
|
164893
|
164894
|
165466
|
166050
|
166111
|
166112
|
166113
|
166114
|
166115
|
166116
|
166458
|
166459
| 166460 |
166461
|
166462
|
166531
|
166532