Exemplo n.º 1
0
 public static function add()
 {
     // copy permissions from the other node.
     $rootNode = GroupTreeNode::add();
     $treeID = parent::create($rootNode);
     $tree = self::getByID($treeID);
     return $tree;
 }
Exemplo n.º 2
0
 public static function add($name)
 {
     // copy permissions from the other node.
     $rootNode = TopicCategoryTreeNode::add();
     $treeID = parent::create($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;
 }
 public static function add()
 {
     // copy permissions from the other node.
     $rootNode = ExpressEntryCategory::add();
     $treeID = parent::create($rootNode);
     $tree = self::getByID($treeID);
     $adminGroupEntity = GroupEntity::getOrCreate(ConcreteGroup::getByID(ADMIN_GROUP_ID));
     $permissions = ['view_express_entries', 'add_express_entries', 'edit_express_entries', 'delete_express_entries'];
     foreach ($permissions as $handle) {
         $pk = ExpressTreeNodeKey::getByHandle($handle);
         $pk->setPermissionObject($rootNode);
         $pa = Access::create($pk);
         $pa->addListItem($adminGroupEntity);
         $pt = $pk->getPermissionAssignmentObject();
         $pt->assignPermissionAccess($pa);
     }
     return $tree;
 }