From ef7bde008f7127d6be06398ad26d98c631df8ac9 Mon Sep 17 00:00:00 2001 From: Raphael Straub 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) --- Koha/Auth/Client.pm | 37 +++++++++++++------------------------ 1 file changed, 13 insertions(+), 24 deletions(-) diff --git a/Koha/Auth/Client.pm b/Koha/Auth/Client.pm index d51f400bba..cf6d436b0e 100644 --- a/Koha/Auth/Client.pm +++ b/Koha/Auth/Client.pm @@ -68,30 +68,19 @@ sub get_user { 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'}; - } + # Call the plugin hook "auth_client_get_user" of all plugins. + my $args = { + provider => $provider, + data => $data, + config => $config, + mapped_data => $mapped_data, + patron => $patron, + domain => $domain, + }; + 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.39.2