diff --git a/uw_cfg_common.module b/uw_cfg_common.module index 2489508729a248be7d714cb5509b4468066db6a0..5551661fc7c01f44abe95a723011fbc3b5dc5081 100644 --- a/uw_cfg_common.module +++ b/uw_cfg_common.module @@ -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(). */