Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VOTE-2247 Remove translator access to edit block content #814

Merged
merged 2 commits into from
Jul 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions config/sync/user.role.content_translator.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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'
Expand Down
10 changes: 4 additions & 6 deletions config/sync/views.view.global_blocks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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: { }
Expand Down Expand Up @@ -726,7 +724,7 @@ display:
- 'languages:language_interface'
- url
- url.query_args
- user.roles
- user.permissions
tags: { }
page_1:
id: page_1
Expand All @@ -752,5 +750,5 @@ display:
- 'languages:language_interface'
- url
- url.query_args
- user.roles
- user.permissions
tags: { }
10 changes: 4 additions & 6 deletions config/sync/views.view.site_alerts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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: { }
Expand Down Expand Up @@ -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:
Expand All @@ -712,6 +710,6 @@ display:
- 'languages:language_interface'
- url
- url.query_args
- user.roles
- user.permissions
tags:
- 'config:field.storage.block_content.field_publish'
13 changes: 13 additions & 0 deletions web/modules/custom/vote_utility/inc/form_alter.inc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}