-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added os2forms_maestro_webform settings
- Loading branch information
Showing
14 changed files
with
157 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
known_anonymous_roles: | ||
anonymous: anonymous | ||
virksomhed: virksomhed | ||
citizen: citizen | ||
authenticated: 0 | ||
administrator: 0 | ||
site_admin: 0 | ||
flow_designer: 0 | ||
forloeb_designer: 0 | ||
sagsbehandler: 0 | ||
medarbejder: 0 | ||
leder: 0 | ||
os2forms_rest_api_user: 0 | ||
os2forms_rest_api_user_write: 0 |
This file was deleted.
Oops, something went wrong.
14 changes: 14 additions & 0 deletions
14
config/sync/system.action.user_add_role_action.citizen.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
uuid: 569a7733-ae74-40a0-9e91-5756d9a6d982 | ||
langcode: en | ||
status: true | ||
dependencies: | ||
config: | ||
- user.role.citizen | ||
module: | ||
- user | ||
id: user_add_role_action.citizen | ||
label: 'Add the citizen role to the selected user(s)' | ||
type: user | ||
plugin: user_add_role_action | ||
configuration: | ||
rid: citizen |
14 changes: 0 additions & 14 deletions
14
config/sync/system.action.user_remove_role_action.borger.yml
This file was deleted.
Oops, something went wrong.
14 changes: 14 additions & 0 deletions
14
config/sync/system.action.user_remove_role_action.citizen.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
uuid: cec4dd8e-b94f-40ea-bd35-4ac38ac0315d | ||
langcode: en | ||
status: true | ||
dependencies: | ||
config: | ||
- user.role.citizen | ||
module: | ||
- user | ||
id: user_remove_role_action.citizen | ||
label: 'Remove the citizen role from the selected user(s)' | ||
type: user | ||
plugin: user_remove_role_action | ||
configuration: | ||
rid: citizen |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
uuid: b4026821-ce05-4a4d-9be2-ca1e2972d66e | ||
langcode: en | ||
status: true | ||
dependencies: { } | ||
id: citizen | ||
label: borger | ||
weight: 3 | ||
is_admin: null | ||
permissions: { } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
web/modules/custom/os2forms_maestro_webform/os2forms_maestro_webform.links.menu.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
os2forms_maestro_webform.settings: | ||
title: OS2Forms maestro webform | ||
description: Configure the OS2Forms maestro webform module | ||
parent: system.admin_config_system | ||
route_name: os2forms_maestro_webform.settings |
7 changes: 7 additions & 0 deletions
7
web/modules/custom/os2forms_maestro_webform/os2forms_maestro_webform.routing.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
os2forms_maestro_webform.settings: | ||
path: '/admin/config/system/os2forms_maestro_webform' | ||
defaults: | ||
_form: '\Drupal\os2forms_maestro_webform\Form\SettingsForm' | ||
_title: 'OS2Forms maestro webform' | ||
requirements: | ||
_permission: 'administer site configuration' |
88 changes: 88 additions & 0 deletions
88
web/modules/custom/os2forms_maestro_webform/src/Form/SettingsForm.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
<?php | ||
|
||
namespace Drupal\os2forms_maestro_webform\Form; | ||
|
||
use Drupal\Core\Config\ConfigFactoryInterface; | ||
use Drupal\Core\Form\ConfigFormBase; | ||
use Drupal\Core\Form\FormStateInterface; | ||
use Drupal\user\RoleInterface; | ||
use Drupal\user\RoleStorageInterface; | ||
use Symfony\Component\DependencyInjection\ContainerInterface; | ||
|
||
/** | ||
* Settings for os2forms_maestro_webform. | ||
*/ | ||
class SettingsForm extends ConfigFormBase { | ||
/** | ||
* Config settings. | ||
* | ||
* @var string | ||
*/ | ||
const SETTINGS = 'os2forms_maestro_webform.settings'; | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function __construct( | ||
ConfigFactoryInterface $configFactory, | ||
readonly private RoleStorageInterface $roleStorage | ||
) { | ||
parent::__construct($configFactory); | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public static function create(ContainerInterface $container) { | ||
return new static( | ||
$container->get('config.factory'), | ||
$container->get('entity_type.manager')->getStorage('user_role'), | ||
); | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function getFormId() { | ||
return 'os2forms_maestro_webform_config'; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
protected function getEditableConfigNames() { | ||
return [ | ||
self::SETTINGS, | ||
]; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function buildForm(array $form, FormStateInterface $form_state) { | ||
$config = $this->config(static::SETTINGS); | ||
|
||
$roles = $this->roleStorage->loadMultiple(); | ||
$form['known_anonymous_roles'] = [ | ||
'#title' => $this->t('Known anonymous roles'), | ||
'#type' => 'checkboxes', | ||
'#options' => array_map(static fn (RoleInterface $role) => $role->label(), $roles), | ||
'#default_value' => $config->get('known_anonymous_roles') ?: [], | ||
'#description' => $this->t('Roles that can act as “known anonymous”'), | ||
]; | ||
|
||
return parent::buildForm($form, $form_state); | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function submitForm(array &$form, FormStateInterface $formState) { | ||
$this->config(static::SETTINGS) | ||
->set('known_anonymous_roles', $formState->getValue('known_anonymous_roles')) | ||
->save(); | ||
|
||
parent::submitForm($form, $formState); | ||
} | ||
|
||
} |