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.
Let's start to convert all calls to user_access() with the new AccountInterface::hasPermission() method.
Part of #2048171: [meta] Replace user_access() calls with $account->hasPermission() wherever possible.
Change records for this issue:
Comment | File | Size | Author |
---|---|---|---|
#3 | drupal-menu_replace_user_access_2062005-3.patch | 569 bytes | InternetDevels |
#1 | drupal-menu_replace_user_access_2062005.patch | 2.73 KB | InternetDevels |
Comments
Comment #1
InternetDevels CreditAttribution: InternetDevels commentedIn some cases $request does not contain information about account. I've used $request instead, but looks like this issue requires more deep investigation.
Comment #2
andypostDepends on #2048223: Add $account argument to AccessCheckInterface::access() method and use the current_user service
Use Drupal::currentUser() service https://drupal.org/node/2032447
Comment #3
InternetDevels CreditAttribution: InternetDevels commentedOnly one change left after re-rolling.
Comment #4
andypostgreat
Comment #5
catchCommitted/pushed to 8.x, thanks!