Prevent users who can't add micronode content from accessing /node/add-microcontent

Created on 8 August 2023, over 1 year ago
Updated 22 August 2023, over 1 year ago

Problem/Motivation

The /node/add-microcontent route relies on the '_entity_create_any_access' => 'node' access check. As a result, users who have permission to create one or more regular node types, but no micronode types, are able to access the /node/add-microcontent route.

Once there, they are encouraged to create a new content type โ€” something my test user is not authorized to do (which seems like a bug in Drupal\Core\EntityEntityCreateAnyAccessCheck?).

You have not created any content types yet. Go to the content type creation page to add a new content type.

Steps to reproduce

  1. Create a user with the ability to add at least one regular node type.
  2. Ensure that user does not have permission to create any micronode types.
  3. Visit /node/add-microcontent.

Proposed resolution

  • Extend AccessInterface to implement MicronodeCreateAnyAccessCheck.
  • Update MicronodeRouteSubscriber to use new access check.
๐Ÿ› Bug report
Status

Fixed

Version

1.0

Component

Code

Created by

๐Ÿ‡บ๐Ÿ‡ธUnited States justcaldwell Austin, Texas

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

Comments & Activities

Production build 0.71.5 2024