Drupal Version

9.3.9

Domain module version

8.x-1.0-beta6

Expected Behavior

When performing a view operation for a domain entity - the result should depend on user permissions with proper caching.

Actual Behavior

When performing a view operation for a domain entity - returning result is a result from the first view operation.

Steps to reproduce

I've reproduced it using JSON:API module and executing GET requests to jsonapi/domain/domain end-point:

1. Make sure that anonymous users have no "view domain list" permission and authenticated users do.
2. Make sure you have cleared the cache.
3. Go to /jsonapi/domain/domain end-point as an anonymous user. You will get the correct result (no info about domains).
4. Got to /jsonapi/domain/domain end-point as an authenticated user. You still get no info about domains because the result is cached from the first operation.

You can perform 3 and 4 points in reverse order and in this case - an anonymous user will get all info about domain entities without having an appropriate permission set.

Proposed solution

Cache DomainAccessControlHandler and DomainAccessCheck results per permissions.

CommentFileSizeAuthor
#6 3279230-caching-of-domains.patch2.81 KB_tarik_

Issue fork domain-3279230

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

quadrexdev created an issue. See original summary.

quadrexdev’s picture

I've prepared a merge request that fixes this issue. Tried it in my project and seems to work fine.

It would be great if someone else can test it.

quadrexdev’s picture

Status: Active » Needs review
agentrickard’s picture

Status: Needs review » Needs work

Interesting.

Any idea how we can test this?

_tarik_’s picture

StatusFileSize
new2.81 KB

I created a patch for the new version of the module (8.x-1.0-beta8)

mably’s picture

Could we have this rebased on 2.0.x please?

mably’s picture

Version: 8.x-1.0-beta6 » 2.0.x-dev
Priority: Normal » Major
mably’s picture

Status: Needs work » Needs review

Rebase done.

mably’s picture

Status: Needs review » Postponed (maintainer needs more info)

Added a few comments in the MR.

mably’s picture

Status: Postponed (maintainer needs more info) » Needs work

  • mably committed f77abc0b on 2.0.x authored by quadrexdev
    Issue #3279230 by mably, quadrexdev: Caching of domains in...
mably’s picture

Status: Needs work » Fixed

Status: Fixed » Closed (fixed)

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