mirror of
https://github.com/appwrite/appwrite
synced 2026-05-24 09:28:40 +00:00
fix: migration for oauth providers
This commit is contained in:
parent
6567b23c85
commit
53adb4e114
1 changed files with 15 additions and 0 deletions
|
|
@ -5,6 +5,7 @@ namespace Appwrite\Migration\Version;
|
||||||
use Appwrite\Auth\Auth;
|
use Appwrite\Auth\Auth;
|
||||||
use Appwrite\Migration\Migration;
|
use Appwrite\Migration\Migration;
|
||||||
use Utopia\CLI\Console;
|
use Utopia\CLI\Console;
|
||||||
|
use Utopia\Config\Config;
|
||||||
use Utopia\Database\Database;
|
use Utopia\Database\Database;
|
||||||
use Utopia\Database\Document;
|
use Utopia\Database\Document;
|
||||||
|
|
||||||
|
|
@ -119,6 +120,20 @@ class V16 extends Migration
|
||||||
$document->setAttribute('auths', array_merge($document->getAttribute('auths', []), [
|
$document->setAttribute('auths', array_merge($document->getAttribute('auths', []), [
|
||||||
'duration' => Auth::TOKEN_EXPIRATION_LOGIN_LONG
|
'duration' => Auth::TOKEN_EXPIRATION_LOGIN_LONG
|
||||||
]));
|
]));
|
||||||
|
|
||||||
|
|
||||||
|
$authProviders = $document->getAttribute('authProviders', []);
|
||||||
|
|
||||||
|
foreach (Config::getParam('providers') as $provider => $value) {
|
||||||
|
if (!$value['enabled']) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (($authProviders[$provider . 'Appid'] ?? false) && ($authProviders[$provider . 'Secret'] ?? false)) {
|
||||||
|
$authProviders[$provider . 'Enabled'] = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue