public functionaddRole($rid) {
if (in_array($rid, [
RoleInterface::AUTHENTICATED_ID,
RoleInterface::ANONYMOUS_ID,
])) {
thrownew\InvalidArgumentException('Anonymous or authenticated role ID must not be assigned manually.');
}
$roles = $this->getRoles(TRUE);
$roles[] = $rid;
$this->set('roles', array_unique($roles));
return$this;
}