/** * @param string $type */ static function checkParentRestrictions($item, $type, $metaUser) { $parents = ItemGroupHandler::parentGroups($item->id, $type); if (!empty($parents)) { foreach ($parents as $parent) { $g = new ItemGroup(); $g->load($parent); // Only check for permission, visibility might be overridden if (!$g->checkPermission($metaUser)) { return false; } if (!ItemGroupHandler::checkParentRestrictions($g, 'group', $metaUser)) { return false; } } } return true; }
public function getPlanList() { $auth_problem = null; $this->list = array(); if (!empty($this->usage)) { $db = JFactory::getDBO(); $query = 'SELECT `id`' . ' FROM #__acctexp_plans' . ' WHERE `id` = \'' . $this->usage . '\' AND `active` = \'1\''; $db->setQuery($query); $id = $db->loadResult(); if ($id) { $plan = new SubscriptionPlan(); $plan->load($id); $authorized = $plan->checkAuthorized($this->metaUser); if ($authorized === true) { $this->list[] = ItemGroupHandler::getItemListItem($plan); } elseif ($authorized === false) { $auth_problem = true; } else { $auth_problem = $authorized; } } else { // Plan does not exist $auth_problem = true; } } else { if (!empty($this->group)) { $gid = $this->group; } else { global $aecConfig; if (!empty($aecConfig->cfg['root_group_rw'])) { $gid = AECToolbox::rewriteEngine($aecConfig->cfg['root_group_rw'], $this->metaUser); } else { $gid = array($aecConfig->cfg['root_group']); } } if (is_array($gid)) { $gid = $gid[0]; } $g = new ItemGroup(); $g->load($gid); if ($g->checkPermission($this->metaUser)) { if (!empty($g->params['symlink_userid']) && !empty($g->params['symlink'])) { aecRedirect($g->params['symlink'], $this->metaUser->userid, "aechidden"); } elseif (!empty($g->params['symlink'])) { return $g->params['symlink']; } $this->list = ItemGroupHandler::getTotalAllowedChildItems(array($gid), $this->metaUser); if (count($this->list) == 0) { $auth_problem = true; } } else { $auth_problem = true; } if ($auth_problem && !empty($g->params['notauth_redirect'])) { $auth_problem = $g->params['notauth_redirect']; } } if (!is_null($auth_problem)) { $this->list = $auth_problem; } return true; }