You are here

public function UserInterface::hasRole in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/user/src/UserInterface.php \Drupal\user\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.

1 method overrides UserInterface::hasRole()
User::hasRole in core/modules/user/src/Entity/User.php
Whether a user has a certain role.

File

core/modules/user/src/UserInterface.php, line 62

Class

UserInterface
Provides an interface defining a user entity.

Namespace

Drupal\user

Code

public function hasRole($rid);