diff --git a/CHANGES.md b/CHANGES.md index 10034c4953..7580ccb114 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,3 +1,6 @@ +# Unreleased Version +- Renamed `providers` to `authProviders` in project collection **Breaking Change** + # Version 0.13.4 ## Features diff --git a/app/config/collections.php b/app/config/collections.php index 98f41e8833..3e3de4c7bd 100644 --- a/app/config/collections.php +++ b/app/config/collections.php @@ -512,7 +512,7 @@ $collections = [ 'filters' => ['json'], ], [ - '$id' => 'providers', + '$id' => 'authProviders', 'type' => Database::VAR_STRING, 'format' => '', 'size' => 16384, diff --git a/app/controllers/api/account.php b/app/controllers/api/account.php index f0c10dd5ea..5d77b9c68a 100644 --- a/app/controllers/api/account.php +++ b/app/controllers/api/account.php @@ -274,8 +274,8 @@ App::get('/v1/account/sessions/oauth2/:provider') $protocol = $request->getProtocol(); $callback = $protocol.'://'.$request->getHostname().'/v1/account/sessions/oauth2/callback/'.$provider.'/'.$project->getId(); - $appId = $project->getAttribute('providers', [])[$provider.'Appid'] ?? ''; - $appSecret = $project->getAttribute('providers', [])[$provider.'Secret'] ?? '{}'; + $appId = $project->getAttribute('authProviders', [])[$provider.'Appid'] ?? ''; + $appSecret = $project->getAttribute('authProviders', [])[$provider.'Secret'] ?? '{}'; if (!empty($appSecret) && isset($appSecret['version'])) { $key = App::getEnv('_APP_OPENSSL_KEY_V' . $appSecret['version']); @@ -396,8 +396,8 @@ App::get('/v1/account/sessions/oauth2/:provider/redirect') $callback = $protocol . '://' . $request->getHostname() . '/v1/account/sessions/oauth2/callback/' . $provider . '/' . $project->getId(); $defaultState = ['success' => $project->getAttribute('url', ''), 'failure' => '']; $validateURL = new URL(); - $appId = $project->getAttribute('providers', [])[$provider.'Appid'] ?? ''; - $appSecret = $project->getAttribute('providers', [])[$provider.'Secret'] ?? '{}'; + $appId = $project->getAttribute('authProviders', [])[$provider.'Appid'] ?? ''; + $appSecret = $project->getAttribute('authProviders', [])[$provider.'Secret'] ?? '{}'; if (!empty($appSecret) && isset($appSecret['version'])) { $key = App::getEnv('_APP_OPENSSL_KEY_V' . $appSecret['version']); @@ -1710,8 +1710,8 @@ App::patch('/v1/account/sessions/:sessionId') $provider = $session->getAttribute('provider'); $refreshToken = $session->getAttribute('providerRefreshToken'); - $appId = $project->getAttribute('providers', [])[$provider.'Appid'] ?? ''; - $appSecret = $project->getAttribute('providers', [])[$provider.'Secret'] ?? '{}'; + $appId = $project->getAttribute('authProviders', [])[$provider.'Appid'] ?? ''; + $appSecret = $project->getAttribute('authProviders', [])[$provider.'Secret'] ?? '{}'; $className = 'Appwrite\\Auth\\OAuth2\\'.\ucfirst($provider); diff --git a/app/controllers/api/projects.php b/app/controllers/api/projects.php index f172bc37ec..f7100a88a2 100644 --- a/app/controllers/api/projects.php +++ b/app/controllers/api/projects.php @@ -95,7 +95,7 @@ App::post('/v1/projects') 'legalTaxId' => $legalTaxId, 'services' => new stdClass(), 'platforms' => null, - 'providers' => [], + 'authProviders' => [], 'webhooks' => null, 'keys' => null, 'domains' => null, @@ -447,11 +447,11 @@ App::patch('/v1/projects/:projectId/oauth2') throw new Exception('Project not found', 404, Exception::PROJECT_NOT_FOUND); } - $providers = $project->getAttribute('providers', []); + $providers = $project->getAttribute('authProviders', []); $providers[$provider . 'Appid'] = $appId; $providers[$provider . 'Secret'] = $secret; - $project = $dbForConsole->updateDocument('projects', $project->getId(), $project->setAttribute('providers', $providers)); + $project = $dbForConsole->updateDocument('projects', $project->getId(), $project->setAttribute('authProviders', $providers)); $response->dynamic($project, Response::MODEL_PROJECT); }); diff --git a/src/Appwrite/Utopia/Response/Model/Project.php b/src/Appwrite/Utopia/Response/Model/Project.php index fb7ee01380..9071966e3b 100644 --- a/src/Appwrite/Utopia/Response/Model/Project.php +++ b/src/Appwrite/Utopia/Response/Model/Project.php @@ -236,7 +236,7 @@ class Project extends Model } $providers = Config::getParam('providers', []); - $providerValues = $document->getAttribute('providers', []); + $providerValues = $document->getAttribute('authProviders', []); foreach ($providers as $key => $provider) { if (!$provider['enabled']) {