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.
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);