Add a role to a user.
Parameters
string $rid:
The role ID to add.
Overrides UserInterface::addRole
File
- drupal/core/modules/user/lib/Drupal/user/UserBCDecorator.php, line 68
- Contains \Drupal\user\UserBCDecorator.
Class
- UserBCDecorator
- Defines the user specific entity BC decorator.
Namespace
Drupal\user
Code
public function addRole($rid) {
$this
->getBCEntity()
->addRole($rid);
}