public function addRole($role, $parents = NULL)
{
$this->checkRole($role, FALSE);
if (isset($this->roles[$role])) {
throw new Nette\InvalidStateException("Role '{$role}' already exists in the list.");
}
$roleParents = [];
if ($parents !== NULL) {
if (!is_array($parents)) {
$parents = [$parents];
}
foreach ($parents as $parent) {
$this->checkRole($parent);
$roleParents[$parent] = TRUE;
$this->roles[$parent]['children'][$role] = TRUE;
}
}
$this->roles[$role] = ['parents' => $roleParents, 'children' => []];
return $this;
}