Add translate any entity and content translations permissions recipes for user roles when installing the Varbase Internationalization module

Created on 27 November 2023, about 1 year ago
Updated 12 December 2023, about 1 year ago

Problem/Motivation

Having permissions managed with deprecations in Drupal 9.
which was fixed in Varbase Core 10.0.x and 9.1.x
But not in Varbase Internationalization sub module on the 9.0.x branch.

The Varbase Internationalization module may not been installed while installing Varbase
Then after the install it could be installed.
In Drupal 9 that was managed with permissions with user roles, but the translations modules could be not installed yet.
In Drupal 10 this will bring a fatal error.

Steps to reproduce

  @javascript @local @development @staging @production
  Scenario: Check if site admin can translate an existing English Basic Page to an Arabic version.
    Given I am a logged in user with the "Site admin" user
    When I go to "/node/add/page"
    And wait 2s
    And I fill in "Test English Basic page" for "Title"
    And I fill in the rich text editor field "Body" with "Test English Basic page body"
    And I select "en" from "Language"
    And I select "published" from "edit-moderation-state-0-state"
    And I press the "Save" button
    And wait 2s
    Then I should see "Test English Basic page"
    And I should see "Test English Basic page body"
    When I open the moderation sidebar
    And I wait for ajax to finish
    Then I should see "Translate"
    When I click "Translate" in the "a" element with the "class" attribute set to "moderation-sidebar-link button use-ajax"
    And I wait for ajax to finish
    And wait for 2s
    Then I should see "Translate"
    And I should see "View all translations"
    When I click "Create translation"

Link with id|title|alt|text "Create translation" not found. (Behat\Mink\Exception\ElementNotFoundException)

Proposed resolution

  // Add permissions.
  ModuleInstallerFactory::addPermissions('varbase_internationalization');

user.permissions.site_admin.yml

id: site_admin
permissions:
  - 'create content translations'
  - 'delete content translations'
  - 'update content translations'
  - 'translate any entity'

user.permissions.content_admin.yml

id: content_admin
permissions:
  - 'create content translations'
  - 'delete content translations'
  - 'update content translations'
  - 'translate any entity'

user.permissions.seo_admin.yml

id: seo_admin
permissions:
  - 'create content translations'
  - 'update content translations'
  - 'translate any entity'

user.permissions.editor.yml

id: editor
permissions:
  - 'create content translations'
  - 'update content translations'
  - 'translate any entity'

user.permissions.authenticated.yml

id: authenticated
permissions: {  }

user.permissions.anonymous.yml

id: anonymous
permissions: {  }

Remaining tasks

  • ✅ File an issue about this project
  • ✅ Addition/Change/Update/Fix to this project
  • ✅ Testing to ensure no regression
  • ➖ Automated unit/functional testing coverage
  • ➖ Developer Documentation support on feature change/addition
  • ➖ User Guide Documentation support on feature change/addition
  • ➖ UX/UI designer responsibilities
  • ✅ Accessibility and Readability
  • ✅ Code review from 1 Varbase core team member
  • ✅ Full testing and approval
  • ✅ Credit contributors
  • ✅ Review with the product owner
  • ✅ Update Release Notes and Update Helper on new feature change/addition
  • ✅ Release varbase-9.0.17 , varbase_core-9.0.78

Varbase update type

  • ✅ No Update
  • ➖ Optional Update
  • ➖ Forced Update
  • ➖ Forced Update if Unchanged

User interface changes

  • N/A

API changes

  • N/A

Data model changes

  • N/A

Release notes snippet

  • Issue #3404454 : Added translate any entity and content translations permissions "recipes" for user roles when installing the Varbase Internationalization module
📌 Task
Status

Fixed

Version

9.0

Component

Code

Created by

🇯🇴Jordan Rajab Natshah Jordan

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024