From ee82fc523fcbed382b9d25a479050728d57bc18c Mon Sep 17 00:00:00 2001 From: Yan Nasonov Date: Wed, 6 Nov 2024 22:25:48 +0200 Subject: [PATCH] 1.9.0 (#154) **Changes** * The module is now compatible with Drupal 11 --- README.md | 1 + composer.json | 2 +- gigya/gigya.info.yml | 4 +-- gigya_ds/gigya_ds.info.yml | 4 +-- gigya_raas/gigya_raas.info.yml | 4 +-- gigya_raas/src/Form/GigyaFieldmappingForm.php | 35 ++++++++++++++----- .../gigya_user_deletion.info.yml | 4 +-- 7 files changed, 36 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index a7b5c9a..8464b6c 100644 --- a/README.md +++ b/README.md @@ -5,3 +5,4 @@ Through normal pull request process. Please target the `develop` branch. ## License GPL 2.0 or later, unless stated otherwise in the `LICENSE` file. + diff --git a/composer.json b/composer.json index 977412c..324c814 100644 --- a/composer.json +++ b/composer.json @@ -3,7 +3,7 @@ "type": "drupal-module", "description": "Gigya Drupal module", "license": "GPL-2.0-or-later", - "version": "1.8.2", + "version": "1.9.0", "authors": [ { "name": "Yuval Perelman", diff --git a/gigya/gigya.info.yml b/gigya/gigya.info.yml index 8f88809..10664a0 100644 --- a/gigya/gigya.info.yml +++ b/gigya/gigya.info.yml @@ -3,5 +3,5 @@ type: module description: 'Gigya core module' package: Gigya configure: gigya.admin.form -version: '1.8.1' -core_version_requirement: ^8 || ^9 || ^10 +version: '1.9.0' +core_version_requirement: ^8 || ^9 || ^10 || ^11 diff --git a/gigya_ds/gigya_ds.info.yml b/gigya_ds/gigya_ds.info.yml index 456991a..ffad546 100644 --- a/gigya_ds/gigya_ds.info.yml +++ b/gigya_ds/gigya_ds.info.yml @@ -5,5 +5,5 @@ package: Gigya dependencies: - gigya - gigya_raas -version: '1.8.1' -core_version_requirement: ^8 || ^9 || ^10 +version: '1.9.0' +core_version_requirement: ^8 || ^9 || ^10 || ^11 diff --git a/gigya_raas/gigya_raas.info.yml b/gigya_raas/gigya_raas.info.yml index de58511..73cc4e4 100644 --- a/gigya_raas/gigya_raas.info.yml +++ b/gigya_raas/gigya_raas.info.yml @@ -5,5 +5,5 @@ package: Gigya configure: gigya.raas.config dependencies: - gigya -version: '1.8.1' -core_version_requirement: ^8 || ^9 || ^10 +version: '1.9.0' +core_version_requirement: ^8 || ^9 || ^10 || ^11 diff --git a/gigya_raas/src/Form/GigyaFieldmappingForm.php b/gigya_raas/src/Form/GigyaFieldmappingForm.php index ba22996..ff9423e 100644 --- a/gigya_raas/src/Form/GigyaFieldmappingForm.php +++ b/gigya_raas/src/Form/GigyaFieldmappingForm.php @@ -8,19 +8,15 @@ use Drupal\gigya\Helper\GigyaHelper; use Drupal\gigya\Helper\GigyaHelperInterface; use Drupal\gigya_raas\Helper\GigyaRaasHelper; +use Drupal\Core\Config\TypedConfigManagerInterface; class GigyaFieldmappingForm extends ConfigFormBase { - private $raas_helper; + private $raas_helper= NULL; - public $api_helper = FALSE; + public $api_helper = NULL; - public function __construct(ConfigFactoryInterface $config_factory) { - parent::__construct($config_factory); - - $this->raas_helper = new GigyaRaasHelper(); - } /** * Gets the configuration names that will be editable. @@ -42,8 +38,10 @@ protected function getEditableConfigNames() { * @return array */ public function buildForm(array $form, FormStateInterface $form_state, GigyaHelperInterface $helper = NULL) { - $config = $this->config('gigya_raas.fieldmapping'); - $fieldmapping_config = json_encode($this->raas_helper->getFieldMappingConfig(), JSON_PRETTY_PRINT); + + if ($this->raas_helper == NULL) { + $this->raas_helper = new GigyaRaasHelper(); + } if ($helper == NULL) { $this->api_helper = new GigyaHelper(); @@ -52,6 +50,10 @@ public function buildForm(array $form, FormStateInterface $form_state, GigyaHelp $this->api_helper = $helper; } + $config = $this->config('gigya_raas.fieldmapping'); + $fieldmapping_config = json_encode($this->raas_helper->getFieldMappingConfig(), JSON_PRETTY_PRINT); + + if (!$this->api_helper->checkEncryptKey()) { $messenger = \Drupal::service('messenger'); $messenger->addWarning($this->t('Please go to Gigya\'s general settings to define a Gigya\'s encryption key.')); @@ -126,6 +128,17 @@ public function getFormId() { public function validateForm(array &$form, FormStateInterface $form_state) { parent::validateForm($form, $form_state); + if ($this->raas_helper == NULL) { + $this->raas_helper = new GigyaRaasHelper(); + } + + if ($helper == NULL) { + $this->api_helper = new GigyaHelper(); + } + else { + $this->api_helper = $helper; + } + /* Field mapping */ $fieldmapping_config = $form_state->getValue('gigya_fieldmapping_config'); @@ -212,6 +225,10 @@ public function submitForm(array &$form, FormStateInterface $form_state) { private function validateMappedUidFieldExists ($form_state, string $uid__field_mapping) { + if ($this->raas_helper == NULL) { + $this->raas_helper = new GigyaRaasHelper(); + } + if (!empty($uid__field_mapping) and !$this->raas_helper->doesFieldExist($uid__field_mapping)) { $form_state->setErrorByName('fieldmapping', $this->t("The UID mapping field does not exist in your database. Therefore, it is necessary to create the field before proceeding")); diff --git a/gigya_user_deletion/gigya_user_deletion.info.yml b/gigya_user_deletion/gigya_user_deletion.info.yml index 720b8cb..bf1a962 100644 --- a/gigya_user_deletion/gigya_user_deletion.info.yml +++ b/gigya_user_deletion/gigya_user_deletion.info.yml @@ -3,8 +3,8 @@ type: module description: 'Allows permanently deleting users from Gigya and Drupal databases' package: Gigya configure: gigya.cron.form -version: '1.8.1' -core_version_requirement: ^8 || ^9 || ^10 +version: '1.9.0' +core_version_requirement: ^8 || ^9 || ^10 || ^11 dependencies: - gigya - gigya_raas