From a683fd529db2afd678271fc4f4372f051b91dc39 Mon Sep 17 00:00:00 2001 From: Kedar Khaire Date: Thu, 28 Aug 2025 20:28:14 +0530 Subject: [PATCH] Updates scopes for Credentials if present --- src/Entity/Form/AppEditForm.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Entity/Form/AppEditForm.php b/src/Entity/Form/AppEditForm.php index 50c0b9fe1..3c3bf42db 100644 --- a/src/Entity/Form/AppEditForm.php +++ b/src/Entity/Form/AppEditForm.php @@ -207,6 +207,7 @@ protected function saveAppCredentials(AppInterface $app, FormStateInterface $for foreach ($form_state->getValue('credential', []) as $credential_key => $credential_changes) { foreach ($app->getCredentials() as $credential) { if ($credential_key === $credential->getConsumerKey()) { + $credentialScopes = $credential->getScopes(); $original_api_product_ids = []; // Cast it to array to be able handle the same way the single- and // multi-select configuration. @@ -232,6 +233,10 @@ protected function saveAppCredentials(AppInterface $app, FormStateInterface $for // Do not add anything to the results if there were no change. if ($product_list_changed) { + // Updates scopes for Credentials if present. + if (count($credentialScopes) > 0) { + $app_credential_controller->overrideScopes($credential_key, $credentialScopes); + } $results[] = TRUE; } break;