Skip to content
Snippets Groups Projects
Commit 8460840b authored by Liam Morland's avatar Liam Morland
Browse files

ISTWCMS-2508: Hide access control that should not be available

parent f16d00b8
No related branches found
No related tags found
No related merge requests found
......@@ -20,6 +20,42 @@ function uw_cfg_common_form_layout_builder_configure_section_alter(array &$form,
$form['layout_builder_style']['#default_value'] = $form['layout_builder_style']['#default_value'] ?: 'uw-contained-width';
}
/**
* Implements hook_form_FORM_ID_alter().
*/
function uw_cfg_common_form_webform_settings_access_form_alter(array &$form, FormStateInterface $form_state, string $form_id): void {
// Remove sections for access control that should not be available.
$sections_to_remove = [
'update_any',
'update_own',
'delete_own',
'administer',
'configuration',
];
foreach ($sections_to_remove as $section) {
unset($form['access'][$section]);
}
// Remove all but user-based access for submissions and test.
$permissions_to_edit = [
'create',
'view_any',
'delete_any',
'purge_any',
'view_own',
'test',
];
$access_types_to_remove = [
'roles',
'permissions',
];
foreach ($permissions_to_edit as $permission) {
foreach ($access_types_to_remove as $type) {
unset($form['access'][$permission][$type]);
}
}
}
/**
* Implements hook_form_FORM_ID_alter().
*/
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment