Bug 31378: (follow-up) catch startup error when missing Oauth provider table

In theory, this shouldn't come up with a package install, but
it could happen with other installations, so best to let it get to
the web installer.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
David Cook 2022-11-03 09:32:03 -03:00 committed by Tomas Cohen Arazi
parent 9e2cf4d358
commit 2cf2fba315
No known key found for this signature in database
GPG Key ID: 0A272EA1B2F3C15F
1 changed files with 10 additions and 5 deletions

View File

@ -140,12 +140,17 @@ sub startup {
};
my $oauth_configuration = {};
my $search_options = { protocol => [ "OIDC", "OAuth" ] };
my $providers = Koha::Auth::Identity::Providers->search( $search_options );
try {
my $search_options = { protocol => [ "OIDC", "OAuth" ] };
while(my $provider = $providers->next) {
$oauth_configuration->{$provider->code} = decode_json($provider->config);
}
my $providers = Koha::Auth::Identity::Providers->search($search_options);
while ( my $provider = $providers->next ) {
$oauth_configuration->{ $provider->code } = decode_json( $provider->config );
}
} catch {
my $logger = Koha::Logger->get( { interface => 'api' } );
$logger->warn( "Warning: Failed to fetch oauth configuration: " . $_ );
};
$self->plugin( 'Koha::REST::Plugin::Pagination' );
$self->plugin( 'Koha::REST::Plugin::Query' );