Problem/Motivation
These were forgotten during #2428703: Add a 'user.permissions' cache context (was: "Should cache contexts be able to associate a cache tag?") and uncovered in #2417895: AccountPermissionsCacheContext/PermissionsHashGenerator must special case user 1, since permissions don't apply to it
From Wim Leers' comment at #2417895-45: AccountPermissionsCacheContext/PermissionsHashGenerator must special case user 1, since permissions don't apply to it:
I looked at all remaining
user.rolesusages:
BookNavigationBlock: wrong, is being fixed in #2483181: Make book navigation block cacheable.CommentDefaultFormatter: wrong, needed bothuser.permissionsanduser.roles, but can be updated to be more granular (useuser.roles:authenticated, and only add it a level deeper in the if-branching)CommentForm: wrong, needed bothuser.permissions(always) anduser.roles, but can be updated to be more granular (useuser.roles:authenticated, and only add it a level deeper in the if-branching)history.module: used correctlyLoginStatusCheck: used correctly\Drupal\user\Plugin\views\access\Role: used correctlyRoleAccessCheck: used correctlyOpening an issue for fixing points 2 and 3 now.
This is that issue.
Proposed resolution
Review & commit.
Remaining tasks
None.
User interface changes
None.
API changes
None.
Data model changes
None.
| Comment | File | Size | Author |
|---|---|---|---|
| #7 | 2510034-7.patch | 1.81 KB | wim leers |
Issue fork drupal-2510034
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
Comment #1
wim leersComment #2
David_Rothstein commentedI think the user.roles:authenticated context may be needed unconditionally, not just in this if() statement? There are other places in the function that call $this->currentUser->isAuthenticated() and $this->currentUser->isAnonymous().
This will result in $elements['#cache']['contexts'] having multiple copies of 'user.permissions' (since it's also added earlier in the function under different, but often overlapping, conditions). I'm not sure if anything bad happens as a result of that, but ideally it would only appear in the array once.
Comment #3
wim leersRerolled. Most of this was fixed in #2543332: Auto-placeholdering for #lazy_builder without bubbling in the mean time.
#2:
Comment #4
wim leersThe bulk of #3 was fixed in #2571909: CommentForm selects using the user formatted name. That leaves only the first hunk of #3 that still needs to be fixed.
Comment #7
wim leersComment #10
wim leersComment #12
wim leersPIFR is no longer just drunk, it's also high. Not sure on what though.
Testbot maintainer Mixologic just told me to ignore PIFR results, only look at DrupalCI. PIFR is gonna be put to rest at the end of the week for D8!
Comment #15
wim leersFixing title & retesting. This patch was ready and passing tests back in #7, more than a year ago!
Comment #17
wim leersTrivial test fail.
Comment #18
hussainwebThe patch actually does not need a reroll. The tests probably need fixing though.
Comment #21
ivan berezhnov commentedComment #30
useernamee commented#3 Issue is still present in 9.3.x I've re-rolled the patch and opened merge request.
Comment #32
smustgrave commentedMR needs to be updated to point to 10.1 and has a failure.