Allowed Languages overwrites Drupal permissions

Created on 16 August 2021, over 3 years ago
Updated 19 April 2023, almost 2 years ago

Problem/Motivation

This module doesn't work with Drupal permissions system based on the content types and roles.

Steps to reproduce

Try to create 2 content types and 2 roles. "Manager" role can edit both content types, "Editor" role only one of them. This is defined with the "Content type: Edit any content" permission.
Without this module on the Content overview page I can see Edit action correctly - Editor role can edit only content type with permission "Content type: Edit any content" permission".
Now I will enable allowed_languages module, and enable for Editor user permissions to edit all existing languages.
Now, again on the Content overview page, and I can see Edit action for both content types, and I can really edit such nodes.

Proposed resolution

allowed_languages should consider other permissions settings.

Maybe is solution simple - in allowed_languages_entity_access() make this change

  if (\Drupal::service('allowed_languages.allowed_languages_manager')->hasPermissionForLanguage($language, $user)) {
    // return AccessResult::allowed()->cachePerUser()->addCacheableDependency($user);
    return AccessResult::neutral();
  }
πŸ› Bug report
Status

Fixed

Version

2.0

Component

Code

Created by

πŸ‡¨πŸ‡ΏCzech Republic Bohus Ulrych Pilsen (Czechia)

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024