fix: update OauthSettingSeeder to handle new provider definitions and ensure authentik is recreated if missing

This commit is contained in:
Andras Bacsai
2024-12-13 09:13:23 +01:00
parent 8a195c8cfb
commit a80d17e097

View File

@@ -22,9 +22,13 @@ class OauthSettingSeeder extends Seeder
]);
$isOauthSeeded = OauthSetting::count() > 0;
$isOauthWithZeroId = OauthSetting::where('id', 0)->exists();
// We changed how providers are defined in the database, so we authentik does not exists, we need to recreate all of the auth providers
// Before authentik was a provider, providers started with 0 id
$isOauthAuthentik = OauthSetting::where('provider', 'authentik')->exists();
if ($isOauthSeeded) {
if ($isOauthWithZeroId) {
if (! $isOauthAuthentik) {
$allProviders = OauthSetting::all();
$notFoundProviders = $providers->diff($allProviders->pluck('provider'));