Route permissions have trouble with context

Created on 27 April 2023, over 1 year ago
Updated 3 October 2023, 12 months ago

Problem/Motivation

There is a problem with route permissions for node/{node}/children lacking context.

Steps to reproduce

An example is that if you have moderation_sidebar installed you can see the 'Children' tab when on any node page that shows the local tasks, but it's missing from the moderation_sidebar as a secondary task.

In addition, the following should work from any location, but currently doesn't.

$route = Url::fromRoute('entity.node.entity_hierarchy_reorder', [
  'node' => 25503,
]);
$user = User::load(1);

$access = $route->access($user);
echo ($access ? 'TRUE' : 'FALSE');

Proposed resolution

I had a look at how EntityAccessCheck solves the problem, and it passes the route as context to the ->access() function. Initial testing suggests the same can be done here.

Remaining tasks

Run some tests.

πŸ› Bug report
Status

Fixed

Version

3.0

Component

Code (module)

Created by

πŸ‡¦πŸ‡ΊAustralia nterbogt

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

Comments & Activities

Production build 0.71.5 2024