public static function add() { // copy permissions from the other node. $rootNode = GroupTreeNode::add(); $treeID = parent::add($rootNode); $tree = self::getByID($treeID); return $tree; }
public static function add($name) { // copy permissions from the other node. $rootNode = TopicCategoryTreeNode::add(); $treeID = parent::add($rootNode); $tree = self::getByID($treeID); $tree->setTopicTreeName($name); // by default, topic trees are viewable by all $guestGroupEntity = GroupPermissionAccessEntity::getOrCreate(UserGroup::getByID(GUEST_GROUP_ID)); $pk = TopicCategoryTreeNodePermissionKey::getByHandle('view_topic_category_tree_node'); $pk->setPermissionObject($rootNode); $pa = PermissionAccess::create($pk); $pa->addListItem($guestGroupEntity); $pt = $pk->getPermissionAssignmentObject(); $pt->assignPermissionAccess($pa); return $tree; }