Translation permissions do not add correct dependencies to user roles and are not cleaned

Created on 8 January 2025, 13 days ago

Problem/Motivation

The content translation module adds permissions to user roles via the \Drupal\content_translation\ContentTranslationPermissions class. Whether the permission exists depends on the content translation status which is defined by a config file but this is not added correctly to the dependencies. And even if it was the permissions is not removed because when translation is disabled a status value is set in the language.content_settings.* config entity - if the entity was deleted it would work once the dependency is added.

Steps to reproduce

  1. Install Drupal standard profile.
  2. Enable content_translation.
  3. Enable translation of terms for the Tags vocabulary.
  4. Go to permisions form and add translate tags taxonomy_term to at least one role
  5. Go back to the vocabulary and disable translation of terms in the Tags vocabulary.
  6. Go back to the permissions form and try to save it without changes.

Once πŸ’¬ RuntimeException: Adding non-existent permissions to a role is not allowed Active lands the next step will be to go to the log page and see the error.

Proposed resolution

  • Add missing dependency to ContentTranslationPermissions
  • Add hook on content entity save for language.content_settings.* to clean up permissions

Remaining tasks

User interface changes

None

Introduced terminology

None

API changes

None

Data model changes

Release notes snippet

πŸ› Bug report
Status

Active

Version

11.0 πŸ”₯

Component

content_translation.module

Created by

πŸ‡¬πŸ‡§United Kingdom alexpott πŸ‡ͺπŸ‡ΊπŸŒ

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024