Problem/Motivation

Currently, we check the access on the target URL but not in the source translations.
When it loads a node and its translations, the entity mesh do not review if the source translation is accessible or not.

Steps to reproduce

Create a node with multiple translations.
The main one will be published and the other will remain unpublished.
Index them on entity mesh.
The translation will appear on entity mesh.

Proposed resolution

Exclude unpublished translations from entity mesh.

\Drupal\entity_mesh\Entity::processTranslatableEntity

  protected function processTranslatableEntity(TranslatableInterface $entity) {

    $translations = $entity->getTranslationLanguages();
    $langcodes = array_keys($translations);
    foreach ($langcodes as $langcode) {
       // Check if the translation is accessible.
      $translation = $entity->getTranslation($langcode);
      if ($translation instanceof EntityInterface) {
        $this->processEntityItem($translation);
      }
    }
  }
Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

eduardo morales alberti’s picture

Issue summary: View changes

gedur’s picture

I suggest to check only the access, there could be websites where unpublished content is accessible for anonymous. Additionally, in the near future we can support other roles scan (e.g., for intranets with authenticated users), that way the code will be compatible.

eduardo morales alberti’s picture

Assigned: eduardo morales alberti » lpeidro
Status: Active » Needs review

Ready to review

lpeidro’s picture

I have review the code and it looks great. I added a suggestion in the code.
Thanks your, Edu.

eduardo morales alberti’s picture

Status: Needs review » Fixed

Merged!
Fixed!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.