protected function setUp() { parent::setUp(); TreeNodeType::add('group'); TreeType::add('group'); GroupTreeType::add(); $g1 = Group::add(tc("GroupName", "Guest"), tc("GroupDescription", "The guest group represents unregistered visitors to your site."), false, false, GUEST_GROUP_ID); $g2 = Group::add(tc("GroupName", "Registered Users"), tc("GroupDescription", "The registered users group represents all user accounts."), false, false, REGISTERED_GROUP_ID); $g3 = Group::add(tc("GroupName", "Administrators"), "", false, false, ADMIN_GROUP_ID); }
public function view() { $cnt = new SearchGroupsController(); $cnt->search(); $result = Loader::helper('json')->encode($cnt->getSearchResultObject()->getJSONObject()); $this->set('result', $result); $this->set('searchController', $cnt); $this->set('tree', GroupTree::get()); $this->requireAsset('core/groups'); }
public static function ensureGroupNodes() { $db = Loader::db(); $tree = GroupTree::get(); $rootNode = $tree->getRootTreeNodeObject(); $rows = $db->GetCol('select Groups.gID from Groups left join TreeGroupNodes on Groups.gID = TreeGroupNodes.gID where TreeGroupNodes.gID is null'); foreach ($rows as $gID) { $g = Group::getByID($gID); GroupTreeNode::add($g, $rootNode); } }
public function view() { $tree = GroupTree::get(); $this->set('tree', $tree); $this->requireAsset('core/groups'); $cnt = new SearchGroupsController(); $cnt->search(); $this->set('searchController', $cnt); $c = Page::getByPath('/dashboard/users/add_group'); $cp = new Permissions($c); $this->set('canAddGroup', $cp->canViewPage()); }
public function search() { $this->requireAsset('core/groups'); $tree = GroupTree::get(); $this->set("tree", $tree); $gName = Loader::helper('security')->sanitizeString($_REQUEST['gName']); if (!$gName) { $this->error->add(t('You must specify a search string.')); } if (!$this->error->has()) { $gl = new GroupList(); $gl->filterByKeywords($gName); $this->set('groups', $gl->getResults()); } }
public function search() { $this->requireAsset('core/groups'); $tree = GroupTree::get(); $this->set("tree", $tree); $gName = (string) $this->app->make('helper/security')->sanitizeString($this->request('gName')); if ($gName === '') { $this->error->add(t('You must specify a search string.')); } if (!$this->error->has()) { $gl = $this->app->make(GroupList::class); $gl->filterByKeywords($gName); $this->set('groups', $gl->getResults()); } }
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; }
public function view() { $tree = GroupTree::get(); $this->set('tree', $tree); $this->requireAsset('core/groups'); }
public function setPropertiesFromArray($arr) { return parent::setPropertiesFromArray($arr); }