/** * @return \Concrete\Core\Page\PageList */ public function getPageListObject() { $pl = new PageList(); $pl->setItemsPerPage($this->itemsPerFeed); $pl->sortByPublicDateDescending(); if (!$this->checkPagePermissions) { $pl->ignorePermissions(); } else { $vp = \Concrete\Core\Permission\Key\Key::getByHandle('view_page'); $guest = \Group::getByID(GUEST_GROUP_ID); $access = GroupEntity::getOrCreate($guest); // we set page permissions to be Guest group only, because // authentication won't work with RSS feeds $pl->setPermissionsChecker(function ($page) use($vp, $access) { $vp->setPermissionObject($page); $pa = $vp->getPermissionAccessObject($page); if (!is_object($pa)) { return false; } return $pa->validateAccessEntities(array($access)); }); } if ($this->cParentID) { if ($this->pfIncludeAllDescendents) { $parent = \Page::getByID($this->cParentID); if (is_object($parent) && !$parent->isError()) { $pl->filterByPath($parent->getCollectionPath()); } } else { $pl->filterByParentID($this->cParentID); } } if ($this->pfDisplayAliases) { $pl->includeAliases(); } if ($this->ptID) { $pl->filterByPageTypeID($this->ptID); } if ($this->pfDisplayFeaturedOnly) { $pl->filterByAttribute('is_featured', true); } return $pl; }
public function setPermissionsChecker(Closure $checker) { return parent::setPermissionsChecker($checker); }