View | Details | Raw Unified | Return to bug 36503
Collapse All | Expand All

(-)a/Koha/Auth/Client.pm (-29 / +20 lines)
Lines 60-97 sub get_user { Link Here
60
    my $interface     = $params->{interface};
60
    my $interface     = $params->{interface};
61
    my $config        = $params->{config};
61
    my $config        = $params->{config};
62
62
63
    my $provider = Koha::Auth::Identity::Providers->search({ code => $provider_code })->next;
63
    my $provider = Koha::Auth::Identity::Providers->search( { code => $provider_code } )->next;
64
64
65
    my ( $mapped_data, $patron ) = $self->_get_data_and_patron({ provider => $provider, data => $data, config => $config });
65
    my ( $mapped_data, $patron ) =
66
        $self->_get_data_and_patron( { provider => $provider, data => $data, config => $config } );
66
67
67
    $mapped_data //= {};
68
    $mapped_data //= {};
68
69
69
    my $domain = $self->has_valid_domain_config({ provider => $provider, email => $mapped_data->{email}, interface => $interface});
70
    my $domain = $self->has_valid_domain_config(
70
71
        { provider => $provider, email => $mapped_data->{email}, interface => $interface } );
71
    # Call the plugin hook "auth_client_get_user" of all plugins in
72
72
    # ascending priority.
73
    my $args = {
73
    if ( C4::Context->config('enable_plugins') ) {
74
        provider    => $provider,
74
        my @plugins = Koha::Plugins->new()->GetPlugins(
75
        data        => $data,
75
            {
76
        config      => $config,
76
                method => 'auth_client_get_user',
77
        mapped_data => $mapped_data,
77
            }
78
        patron      => $patron,
78
        );
79
        domain      => $domain,
79
        @plugins = sort { $a->retrieve_data('priority') <=> $b->retrieve_data('priority') } @plugins;
80
    };
80
        my $args = {
81
81
            provider    => $provider,
82
    # Call the plugin hook "auth_client_get_user" of all plugins.
82
            data        => $data,
83
    Koha::Plugins->call( 'auth_client_get_user', $args );
83
            config      => $config,
84
    $mapped_data = $args->{'mapped_data'};
84
            mapped_data => $mapped_data,
85
    $patron      = $args->{'patron'};
85
            patron      => $patron,
86
    $domain      = $args->{'domain'};
86
            domain      => $domain,
87
        };
88
        foreach my $plugin (@plugins) {
89
            $plugin->auth_client_get_user($args);
90
        }
91
        $mapped_data = $args->{'mapped_data'};
92
        $patron      = $args->{'patron'};
93
        $domain      = $args->{'domain'};
94
    }
95
87
96
    $patron->set($mapped_data)->store if $patron && $domain->update_on_auth;
88
    $patron->set($mapped_data)->store if $patron && $domain->update_on_auth;
97
89
98
- 

Return to bug 36503