Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By dawehner on
Change record status:
Published (View all published change records)
Project:
Introduced in branch:
8.x
Issue links:
Description:
The access manager got a new method which allows an access check given a route name and parameters.
Instead of using the path and generating a fake request, the route name and parameters should be used instead.
In addition, a path-based check depends on having the system path, so in the event you have only the aliased path, it would need to be processed by the inbound path processor.
Before
$request = Request::create('/' . $href);
$request->attributes->set('_system_path', $href);
$request->attributes->add(Drupal::service('router.dynamic')->matchRequest($request));
return Drupal::service('access_manager')->check($route, $request);
After
Drupal::service('access_manager')->checkNamedRoute('user_admin_permission', array('role_id' => 'authenticated'));
Impacts:
Module developers