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 |
|---|---|---|---|
| #7 | replace-user_access-2061979-7.patch | 765 bytes | michaelhiiva |
| #7 | interdiff-2061979-1-7.txt | 913 bytes | michaelhiiva |
| #5 | replace-user_access-2061979-5.patch | 813 bytes | michaelhiiva |
| #5 | innerdiff-2061979-1-5.txt | 831 bytes | michaelhiiva |
| #4 | innerdiff-2061979-1-4.txt | 831 bytes | michaelhiiva |
Comments
Comment #1
internetdevels commentedHere is the patch.
Comment #3
andypostUse Drupal::currentUser() service https://drupal.org/node/2032447
Comment #4
michaelhiiva commentedComment #5
michaelhiiva commentedProvided wrong patch in #4.
Comment #6
andypostthe '\' is not needed in procedural code
Drupal::currentUser()->hasPermission() is enough
Comment #7
michaelhiiva commented@andypost Thanks for the information.
Comment #8
andypostGreat!
Comment #9
webchickCommitted and pushed to 8.x. Thanks!