Route permissions have trouble with context
>>> [!note] Migrated issue
<!-- Drupal.org comment -->
<!-- Migrated from issue #3356967. -->
Reported by: [nterbogt](https://www.drupal.org/user/102218)
>>>
<h3 id="summary-problem-motivation">Problem/Motivation</h3>
<p>There is a problem with route permissions for <code>node/{node}/children</code> lacking context.</p>
<h4 id="summary-steps-reproduce">Steps to reproduce</h4>
<p>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.</p>
<p>In addition, the following should work from any location, but currently doesn't.</p>
<div class="codeblock">
<pre><span style="color: #000000"><span style="color: #0000BB"><?php<br>$route </span><span style="color: #007700">= </span><span style="color: #0000BB">Url</span><span style="color: #007700">::</span><span style="color: #0000BB">fromRoute</span><span style="color: #007700">(</span><span style="color: #DD0000">'entity.node.entity_hierarchy_reorder'</span><span style="color: #007700">, [<br> </span><span style="color: #DD0000">'node' </span><span style="color: #007700">=> </span><span style="color: #0000BB">25503</span><span style="color: #007700">,<br>]);<br></span><span style="color: #0000BB">$user </span><span style="color: #007700">= </span><span style="color: #0000BB">User</span><span style="color: #007700">::</span><span style="color: #0000BB">load</span><span style="color: #007700">(</span><span style="color: #0000BB">1</span><span style="color: #007700">);<br><br></span><span style="color: #0000BB">$access </span><span style="color: #007700">= </span><span style="color: #0000BB">$route</span><span style="color: #007700">-></span><span style="color: #0000BB">access</span><span style="color: #007700">(</span><span style="color: #0000BB">$user</span><span style="color: #007700">);<br>echo (</span><span style="color: #0000BB">$access </span><span style="color: #007700">? </span><span style="color: #DD0000">'TRUE' </span><span style="color: #007700">: </span><span style="color: #DD0000">'FALSE'</span><span style="color: #007700">);<br></span><span style="color: #0000BB">?></span></span></pre></div>
<h3 id="summary-proposed-resolution">Proposed resolution</h3>
<p>I had a look at how EntityAccessCheck solves the problem, and it passes the route as context to the <code>->access()</code> function. Initial testing suggests the same can be done here.</p>
<h3 id="summary-remaining-tasks">Remaining tasks</h3>
<p>Run some tests.</p>
issue