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.
Comments
Comment #2
nterbogt commentedAn initial implementation based on entity_hierarchy. Tested in context of nodes, but not wider than that. Also tested above pseudo code for route permissions.
Comment #3
nterbogt commentedComment #4
larowlanWe should be able to test this with the $url->access code in the issue summary in a kernel test
Comment #5
nterbogt commentedUnable to test as a Kernel test. Route wasn't registering properly.
A functional test in the meantime.
Comment #6
nterbogt commentedJust checking the patch again.
Comment #7
nterbogt commentedIt's good. Just rechecked locally.
Comment #8
larowlanIn kernel tests you need to manually rebuild routes
Comment #10
larowlanWill cut a release today