Problem/Motivation

Getting error while adding node/taxonomy in Drupal 10.
Entity queries must explicitly set whether the query should be access checked or not.

Steps to reproduce

  • install and configure the module
  • add allow only field in content type/taxonomy
  • Try to create a node/term

Proposed resolution

use access check in query.

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

omkar_yewale created an issue. See original summary.

omkar_yewale’s picture

Assigned: omkar_yewale » Unassigned
Status: Needs work » Needs review

!2 MR Created, Please Review.

tsquared212’s picture

StatusFileSize
new769 bytes

Submitting simple patch that fixes reliance on deprecated default access check. Might be useful for those who need the changes before the @omkar_yewale PR is merged.

swirt’s picture

Status: Needs review » Needs work

I think we want to intentionally set the access check to FALSE. This module is intentionally looking for things that have duplicated a unique pattern. It would be a problem if it did not find a duplicate, simply because the user did not have access to that content.

bharath-kondeti made their first commit to this issue’s fork.

bharath-kondeti’s picture

Status: Needs work » Needs review
swirt’s picture

Thankyou @bharath for this change. I will test this out soon.

edmund.dunn’s picture

StatusFileSize
new809 bytes

Posting the static patch because using the MR doesn't allow pinning to a specific commit, so anyone can submit pretty much anything and inject it into our codebase IIRC. This also fixed our issue.

  • swirt committed 974af86b on 1.0.x authored by omkar_yewale
    Issue #3358123: Entity queries must explicitly set whether the query...
swirt’s picture

Status: Needs review » Fixed
swirt’s picture

Thank you all for your contributions on this. It is going out with 1.0.2
https://www.drupal.org/project/allow_only_one/releases/1.0.2

swirt’s picture

swirt’s picture

swirt’s picture

Status: Fixed » Closed (fixed)