From f441249112115d06aef0aa63198288a27cbf9da1 Mon Sep 17 00:00:00 2001 From: Ray Estrada Date: Tue, 2 Jul 2024 15:15:41 -0700 Subject: [PATCH 1/2] VOTE-2247 Remove translator access to edit block content --- config/sync/user.role.content_translator.yml | 4 ---- config/sync/views.view.global_blocks.yml | 10 ++++------ config/sync/views.view.site_alerts.yml | 10 ++++------ 3 files changed, 8 insertions(+), 16 deletions(-) diff --git a/config/sync/user.role.content_translator.yml b/config/sync/user.role.content_translator.yml index 70ce69a03..e8643aaae 100644 --- a/config/sync/user.role.content_translator.yml +++ b/config/sync/user.role.content_translator.yml @@ -8,10 +8,8 @@ dependencies: - node.type.landing - node.type.page - node.type.voter_guide - - taxonomy.vocabulary.basics_modules - workflows.workflow.publishing_content module: - - block_content - ckeditor5_embedded_content - content_moderation - content_translation @@ -31,8 +29,6 @@ permissions: - 'edit own landing content' - 'edit own page content' - 'edit own voter_guide content' - - 'translate basics_modules taxonomy_term' - - 'translate block_content' - 'translate landing node' - 'translate page node' - 'translate paragraph' diff --git a/config/sync/views.view.global_blocks.yml b/config/sync/views.view.global_blocks.yml index 6d1aa91dd..c7141f67c 100644 --- a/config/sync/views.view.global_blocks.yml +++ b/config/sync/views.view.global_blocks.yml @@ -7,7 +7,6 @@ dependencies: - block_content.type.government_banner - block_content.type.registration_form_selector - block_content.type.search - - user.role.authenticated module: - block_content - user @@ -370,10 +369,9 @@ display: sort_asc_label: Asc sort_desc_label: Desc access: - type: role + type: perm options: - role: - authenticated: authenticated + perm: 'access block library' cache: type: tag options: { } @@ -726,7 +724,7 @@ display: - 'languages:language_interface' - url - url.query_args - - user.roles + - user.permissions tags: { } page_1: id: page_1 @@ -752,5 +750,5 @@ display: - 'languages:language_interface' - url - url.query_args - - user.roles + - user.permissions tags: { } diff --git a/config/sync/views.view.site_alerts.yml b/config/sync/views.view.site_alerts.yml index a9cabe150..fe318af3d 100644 --- a/config/sync/views.view.site_alerts.yml +++ b/config/sync/views.view.site_alerts.yml @@ -6,7 +6,6 @@ dependencies: - block_content.type.inline_alert - block_content.type.sitewide_alert - field.storage.block_content.field_publish - - user.role.authenticated module: - block_content - user @@ -377,10 +376,9 @@ display: sort_asc_label: Asc sort_desc_label: Desc access: - type: role + type: perm options: - role: - authenticated: authenticated + perm: 'access block library' cache: type: tag options: { } @@ -685,7 +683,7 @@ display: - 'languages:language_interface' - url - url.query_args - - user.roles + - user.permissions tags: - 'config:field.storage.block_content.field_publish' page_1: @@ -712,6 +710,6 @@ display: - 'languages:language_interface' - url - url.query_args - - user.roles + - user.permissions tags: - 'config:field.storage.block_content.field_publish' From 281c948367c8d60458bc3fe958cb4ef43af6ad07 Mon Sep 17 00:00:00 2001 From: Ray Estrada Date: Tue, 2 Jul 2024 15:47:08 -0700 Subject: [PATCH 2/2] VOTE-2243 Disable user profile settings for content_translator role --- web/modules/custom/vote_utility/inc/form_alter.inc | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/web/modules/custom/vote_utility/inc/form_alter.inc b/web/modules/custom/vote_utility/inc/form_alter.inc index ee376de4a..0a8e248dc 100644 --- a/web/modules/custom/vote_utility/inc/form_alter.inc +++ b/web/modules/custom/vote_utility/inc/form_alter.inc @@ -21,3 +21,16 @@ function vote_utility_form_node_state_territory_edit_form_alter(&$form, FormStat $form['field_override_registration_link']['#access'] = FALSE; } } + +/** + * Implements hook_form_FORM_ID_alter(). + */ +function vote_utility_form_user_form_alter(&$form, FormStateInterface $form_state, $form_id) { + // Check if the user has the "content_translator" role. + if (\Drupal::currentUser()->hasRole('content_translator')) { + // Disable access to alter user profile settings. + $form['language']['#disabled'] = TRUE; + $form['account']['#disabled'] = TRUE; + $form['actions']['#access'] = FALSE; + } +}