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 |
---|---|---|---|
#18 | drupal_language_replace_user_access-2062001-18.patch | 567 bytes | InternetDevels |
#14 | drupal-language_replace_user_access-2062001-14.patch | 1.51 KB | deimos |
Comments
Comment #1
InternetDevels CreditAttribution: InternetDevels commentedPatch attached.
Comment #2
andypostNice clean-up!
Suppose this function would be droped in wscci conversion for 'language_admin_edit_form' and 'language_admin_delete_form'
Comment #3
tim.plunkettThis method has the account passed to it directly.
Comment #4
andypostShould be Drupal::currentUser() according https://drupal.org/node/2032447
Comment #5
InternetDevels CreditAttribution: InternetDevels commentedPatch attached.
Comment #6
InternetDevels CreditAttribution: InternetDevels commentedFixed typo.
Comment #7
andypostPlease do not use $account here. Drupal::currentUser()->hasPermission() works fine
This is a hack, but reasonable
Comment #8
andypostUse this to replace 2 hack
Comment #9
andypostComment #10
InternetDevels CreditAttribution: InternetDevels commentedNew one.
Comment #11
andypost$account = $this->prepareUser($account);
Comment #12
InternetDevels CreditAttribution: InternetDevels commentedFixed issue above.
Comment #13
tim.plunkettThis should be overriding checkAccess() and checkCreateAccess() instead. Then you don't need the prepareUser call.
Comment #14
deimos CreditAttribution: deimos commentedThanks, corrected patch regarding to comment above.
Comment #15
andypost#14: drupal-language_replace_user_access-2062001-14.patch queued for re-testing.
Comment #16
andypost\Drupal according #2053489: Standardize on \Drupal throughout core
Comment #17
areke CreditAttribution: areke commentedThis needs to be re-rolled because the patch no longer applies.
Comment #18
InternetDevels CreditAttribution: InternetDevels commentedComment #19
andypostGreat!
Comment #20
webchickCommitted and pushed to 8.x. Thanks!