public function confirm() { $this->move(); if (!$this->error->has()) { $selectedGroups = $this->get('selectedGroups'); $gParentNode = $this->get('gParentNode'); foreach ($selectedGroups as $g) { $node = GroupTreeNode::getTreeNodeByGroupID($g->getGroupID()); if (is_object($node)) { $node->move($gParentNode); } } } $this->redirect('/dashboard/users/groups', 'bulk_update_complete'); }
public function move() { $this->search(); $gParentNodeID = $this->app->make('helper/security')->sanitizeInt($this->request('gParentNodeID')); $gParentNode = $gParentNodeID ? TreeNode::getByID($gParentNodeID) : null; if (!$gParentNode instanceof GroupTreeNode) { $gParentNode = null; $this->error->add(t("Invalid target parent group.")); } $selectedGroups = []; if (is_array($this->post('gID'))) { foreach ($this->post('gID') as $gID) { $group = Group::getByID($gID); if ($group !== null) { $groupNode = GroupTreeNode::getTreeNodeByGroupID($group->getGroupID()); if ($groupNode !== null) { if ($gParentNode !== null) { $error = $groupNode->checkMove($gParentNode); if ($error !== null) { $this->error->add($error); } } $selectedGroups[] = $group; } } } } if (empty($selectedGroups)) { $this->error->add(t("You must select at least one group to move")); } if (!$this->error->has()) { $gParent = $gParentNode->getTreeNodeGroupObject(); $this->set('selectedGroups', $selectedGroups); $this->set('gParent', $gParent); $this->set('gParentNode', $gParentNode); } }
protected function getTreeGroupNodePermissions() { $group = $this->getPermissionObject(); $node = GroupTreeNode::getTreeNodeByGroupID($group->getGroupID()); return new Permissions($node); }