コード例 #1
0
ファイル: GroupTest.php プロジェクト: ceko/concrete5-1
 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);
 }
コード例 #2
0
ファイル: search.php プロジェクト: masteramuk/concrete5
 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');
 }
コード例 #3
0
 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);
     }
 }
コード例 #4
0
ファイル: groups.php プロジェクト: yakamoz-fang/concrete
 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());
 }
コード例 #5
0
ファイル: bulkupdate.php プロジェクト: yakamoz-fang/concrete
 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());
     }
 }
コード例 #6
0
 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());
     }
 }
コード例 #7
0
 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;
 }
コード例 #8
0
 public function view()
 {
     $tree = GroupTree::get();
     $this->set('tree', $tree);
     $this->requireAsset('core/groups');
 }
コード例 #9
0
 public function setPropertiesFromArray($arr)
 {
     return parent::setPropertiesFromArray($arr);
 }