Skip to content

Commit 10e14f0

Browse files
committed
Added os2forms_maestro_webform settings
1 parent e5b6b85 commit 10e14f0

14 files changed

+157
-46
lines changed

config/sync/core.extension.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ module:
8181
os2forms_fbs_handler: 0
8282
os2forms_forloeb: 0
8383
os2forms_get_organized: 0
84+
os2forms_maestro_webform: 0
8485
os2forms_nemid: 0
8586
os2forms_nemlogin_openid_connect: 0
8687
os2forms_organisation: 0

config/sync/maestro.settings.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,5 @@ maestro_orchestrator_development_mode: 0
77
_core:
88
default_config_hash: mCGD8kihnK7wqaQPAlYskypDDPWuP2VO502z-Wwg_RM
99
langcode: da
10+
maestro_sitewide_token: task
11+
maestro_token_zero_user: 1
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
known_anonymous_roles:
2+
anonymous: anonymous
3+
virksomhed: virksomhed
4+
citizen: citizen
5+
authenticated: 0
6+
administrator: 0
7+
site_admin: 0
8+
flow_designer: 0
9+
forloeb_designer: 0
10+
sagsbehandler: 0
11+
medarbejder: 0
12+
leder: 0
13+
os2forms_rest_api_user: 0
14+
os2forms_rest_api_user_write: 0

config/sync/system.action.user_add_role_action.borger.yml

Lines changed: 0 additions & 14 deletions
This file was deleted.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
uuid: 569a7733-ae74-40a0-9e91-5756d9a6d982
2+
langcode: en
3+
status: true
4+
dependencies:
5+
config:
6+
- user.role.citizen
7+
module:
8+
- user
9+
id: user_add_role_action.citizen
10+
label: 'Add the citizen role to the selected user(s)'
11+
type: user
12+
plugin: user_add_role_action
13+
configuration:
14+
rid: citizen

config/sync/system.action.user_remove_role_action.borger.yml

Lines changed: 0 additions & 14 deletions
This file was deleted.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
uuid: cec4dd8e-b94f-40ea-bd35-4ac38ac0315d
2+
langcode: en
3+
status: true
4+
dependencies:
5+
config:
6+
- user.role.citizen
7+
module:
8+
- user
9+
id: user_remove_role_action.citizen
10+
label: 'Remove the citizen role from the selected user(s)'
11+
type: user
12+
plugin: user_remove_role_action
13+
configuration:
14+
rid: citizen

config/sync/user.role.borger.yml

Lines changed: 0 additions & 16 deletions
This file was deleted.

config/sync/user.role.citizen.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
uuid: b4026821-ce05-4a4d-9be2-ca1e2972d66e
2+
langcode: en
3+
status: true
4+
dependencies: { }
5+
id: citizen
6+
label: borger
7+
weight: 3
8+
is_admin: null
9+
permissions: { }

config/sync/user.role.forloeb_designer.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,8 @@ permissions:
7272
- 'edit webform twig'
7373
- 'revert webform revisions'
7474
- 'search content'
75-
- 'translate own webform'
7675
- 'translate any webform'
76+
- 'translate own webform'
7777
- 'use advanced search'
7878
- 'use text format full_html'
7979
- 'use udgivelse_af_forlob_og_webformularer transition create_new_draft'

web/modules/custom/os2forms_maestro_webform/os2forms_maestro_webform.info.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@ description: Stubbed-out code for OS2Forms
33
core_version_requirement: ^9.4 || ^10
44
package: OS2Forms
55
type: module
6-
scripts:
6+
7+
configure: os2forms_maestro_webform.settings
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
os2forms_maestro_webform.settings:
2+
title: OS2Forms maestro webform
3+
description: Configure the OS2Forms maestro webform module
4+
parent: system.admin_config_system
5+
route_name: os2forms_maestro_webform.settings
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
os2forms_maestro_webform.settings:
2+
path: '/admin/config/system/os2forms_maestro_webform'
3+
defaults:
4+
_form: '\Drupal\os2forms_maestro_webform\Form\SettingsForm'
5+
_title: 'OS2Forms maestro webform'
6+
requirements:
7+
_permission: 'administer site configuration'
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
<?php
2+
3+
namespace Drupal\os2forms_maestro_webform\Form;
4+
5+
use Drupal\Core\Config\ConfigFactoryInterface;
6+
use Drupal\Core\Form\ConfigFormBase;
7+
use Drupal\Core\Form\FormStateInterface;
8+
use Drupal\user\RoleInterface;
9+
use Drupal\user\RoleStorageInterface;
10+
use Symfony\Component\DependencyInjection\ContainerInterface;
11+
12+
/**
13+
* Settings for os2forms_maestro_webform.
14+
*/
15+
class SettingsForm extends ConfigFormBase {
16+
/**
17+
* Config settings.
18+
*
19+
* @var string
20+
*/
21+
const SETTINGS = 'os2forms_maestro_webform.settings';
22+
23+
/**
24+
* {@inheritdoc}
25+
*/
26+
public function __construct(
27+
ConfigFactoryInterface $configFactory,
28+
readonly private RoleStorageInterface $roleStorage
29+
) {
30+
parent::__construct($configFactory);
31+
}
32+
33+
/**
34+
* {@inheritdoc}
35+
*/
36+
public static function create(ContainerInterface $container) {
37+
return new static(
38+
$container->get('config.factory'),
39+
$container->get('entity_type.manager')->getStorage('user_role'),
40+
);
41+
}
42+
43+
/**
44+
* {@inheritdoc}
45+
*/
46+
public function getFormId() {
47+
return 'os2forms_maestro_webform_config';
48+
}
49+
50+
/**
51+
* {@inheritdoc}
52+
*/
53+
protected function getEditableConfigNames() {
54+
return [
55+
self::SETTINGS,
56+
];
57+
}
58+
59+
/**
60+
* {@inheritdoc}
61+
*/
62+
public function buildForm(array $form, FormStateInterface $form_state) {
63+
$config = $this->config(static::SETTINGS);
64+
65+
$roles = $this->roleStorage->loadMultiple();
66+
$form['known_anonymous_roles'] = [
67+
'#title' => $this->t('Known anonymous roles'),
68+
'#type' => 'checkboxes',
69+
'#options' => array_map(static fn (RoleInterface $role) => $role->label(), $roles),
70+
'#default_value' => $config->get('known_anonymous_roles') ?: [],
71+
'#description' => $this->t('Roles that can act as “known anonymous”'),
72+
];
73+
74+
return parent::buildForm($form, $form_state);
75+
}
76+
77+
/**
78+
* {@inheritdoc}
79+
*/
80+
public function submitForm(array &$form, FormStateInterface $formState) {
81+
$this->config(static::SETTINGS)
82+
->set('known_anonymous_roles', $formState->getValue('known_anonymous_roles'))
83+
->save();
84+
85+
parent::submitForm($form, $formState);
86+
}
87+
88+
}

0 commit comments

Comments
 (0)