By dawehner on
Change record status:
Published (View all published change records)
Project:
Introduced in branch:
8.x
Issue links:
Description:
The user_access() method was directly replaced by AccountInterface::hasPermission(). Most of the time, this account is the current user session, which can be accessed via the account attribute on the current request.
If you have a user entity, you can also use the same method.
Drupal 7
user_access('name of permission');
$account = user_load('3');
user_access('name of permission', $account);
Drupal 8
\Drupal::currentUser()->hasPermission('name of permission');
$account = user_load('3');
$account->hasPermission('name of permission');
Impacts:
Module developers