lot new stuff

This commit is contained in:
Robert Nasarek 2023-10-23 09:51:43 +02:00
parent e0db22915b
commit 2178db78f5
17 changed files with 72 additions and 18 deletions

0
src/Controller/WisskiCloudAccountManagerController.php Normal file → Executable file
View file

4
src/Form/WisskiCloudAccountManagerCreateForm.php Normal file → Executable file
View file

@ -8,6 +8,7 @@ use Drupal\Core\Form\FormBase;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Messenger\MessengerInterface;
use Drupal\wisski_cloud_account_manager\WisskiCloudAccountManagerDaemonApiActions;
use mysql_xdevapi\Exception;
use Symfony\Component\DependencyInjection\ContainerInterface;
/**
@ -230,6 +231,9 @@ class WisskiCloudAccountManagerCreateForm extends FormBase {
$account["subdomain"] = $field['subdomain'];
$accountResponse = $this->wisskiCloudAccountManagerDaemonApiActions->addAccount($account);
if (!$accountResponse['success']) {
throw new Exception('Get no valid response from api daemon. Can not send validiation email.');
};
$this->wisskiCloudAccountManagerDaemonApiActions->sendValidationEmail($accountResponse['data']['email'], $accountResponse['data']['validationCode']);
$this->messenger()

15
src/Form/WisskiCloudAccountManagerSettingsForm.php Normal file → Executable file
View file

@ -36,35 +36,35 @@ class WisskiCloudAccountManagerSettingsForm extends ConfigFormBase {
$config = $this->config('wisski_cloud_account_manager.settings');
$form['daemonUrl'] = [
'#type' => 'url',
'#type' => 'textfield',
'#title' => $this->t('The WissKI Cloud API Daemon URL'),
'#description' => $this->t('Provide the complete base URL with protocol, domain (resp. service name in docker), ports and API path, i. e. "http://wisski_cloud_api_daemon:3000/wisski-cloud-daemon/api/v1"'),
'#default_value' => $config->get('daemonUrl'),
];
$form['allAccounts'] = [
'#type' => 'url',
'#type' => 'textfield',
'#title' => $this->t('All accounts URL path'),
'#description' => $this->t('Provide the endpoint to the GET endpoint for all accounts, i. e. "http://wisski_cloud_api_daemon:3000/wisski-cloud-daemon/api/v1/account/all"'),
'#description' => $this->t('Provide the endpoint to the GET endpoint for all accounts, i. e. "/account/all"'),
'#default_value' => $config->get('allAccounts'),
];
$form['accountPostUrlPath'] = [
'#type' => 'url',
'#type' => 'textfield',
'#title' => $this->t('POST URL path'),
'#description' => $this->t('Provide the path to the POST endpoint, i. e. "/account"'),
'#default_value' => $config->get('accountPostUrlPath'),
];
$form['accountFilterByData'] = [
'#type' => 'url',
'#type' => 'textfield',
'#title' => $this->t('Filter by Data URL path'),
'#description' => $this->t('Provide the path to the Get account by data endpoint, i. e. "/account/by_data"'),
'#default_value' => $config->get('accountFilterByData'),
];
$form['accountValidation'] = [
'#type' => 'url',
'#type' => 'textfield',
'#title' => $this->t('User Validation URL path'),
'#description' => $this->t('Provide the path to the account validation PUT endpoint, i. e. "/account/validation"'),
'#default_value' => $config->get('accountValidation'),
@ -121,8 +121,9 @@ class WisskiCloudAccountManagerSettingsForm extends ConfigFormBase {
public function submitForm(array &$form, FormStateInterface $form_state) {
$config = $this->config('wisski_cloud_account_manager.settings');
$config->set('daemonURL', $form_state->getValue('daemonURL'))
$config->set('daemonUrl', $form_state->getValue('daemonUrl'))
->set('accountPostUrlPath', $form_state->getValue('accountPostUrlPath'))
->set('allAccounts', $form_state->getValue('allAccounts'))
->set('accountFilterByData', $form_state->getValue('accountFilterByData'))
->set('accountProvisionAndValidationCheck', $form_state->getValue('accountProvisionAndValidationCheck'))
->set('accountValidation', $form_state->getValue('accountValidation'))

0
src/WisskiCloudAccountManagerDaemonApiActions.php Normal file → Executable file
View file