private function checkRole($role, $need = TRUE)
{
if (!is_string($role) || $role === '') {
throw new Nette\InvalidArgumentException('Role must be a non-empty string.');
} elseif ($need && !isset($this->roles[$role])) {
throw new Nette\InvalidStateException("Role '{$role}' does not exist.");
}
}