Append the context value to allow individual contexts to have specific access control and be cached separately

Created on 13 March 2019, about 6 years ago
Updated 14 August 2024, 8 months ago

Page accesses are cached. If the page has contexts and check access of pages with different context values, the check will be incorrect.

Case:
path: /node/{node}/edit/simple
node #1: access TRUE
node #2: access FALSE

$url = Url::fromRoute('page_manager.page_view_simple_node_edit_simple_node_edit-block_display-0', [
  'node' => 1,
]);
$result = $url->access(); // == TRUE

$url = Url::fromRoute('page_manager.page_view_simple_node_edit_simple_node_edit-block_display-0', [
  'node' => 2,
]);
$result = $url->access(); // == TRUE

For node #2, the result should be FALSE, but it is TRUE.

🐛 Bug report
Status

Active

Version

4.0

Component

Code

Created by

🇷🇺Russia m.lebedev

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇩🇪Germany geek-merlin Freiburg, Germany

    Imho the access results need to have that cacheability in the first place, so this approach is not needed.

    What are the conditions? Maybe one of them is custom and missing its cacheability?

  • Status changed to Active about 1 year ago
  • 🇩🇪Germany geek-merlin Freiburg, Germany

    It looks like the patch copied code from entity access handler to page access, which is an entity too, but needs different logic.

  • 🇩🇪Germany Anybody Porta Westfalica

    @m.lebedev could you please turn this into a MR for the future?

Production build 0.71.5 2024