public function UserInterface::hasRole

Whether a user has a certain role.

Parameters

string $rid: The role ID to check.

Return value

bool Returns TRUE if the user has the role, otherwise FALSE.

2 methods override UserInterface::hasRole()
User::hasRole in drupal/core/modules/user/lib/Drupal/user/Plugin/Core/Entity/User.php
Whether a user has a certain role.
UserBCDecorator::hasRole in drupal/core/modules/user/lib/Drupal/user/UserBCDecorator.php
Whether a user has a certain role.

File

drupal/core/modules/user/lib/Drupal/user/UserInterface.php, line 35
Contains \Drupal\user\UserInterface.

Class

UserInterface
Provides an interface defining a user entity.

Namespace

Drupal\user

Code

public function hasRole($rid);