From: Tim Düsterhus Date: Tue, 3 May 2022 11:57:49 +0000 (+0200) Subject: Fix handling of CMS pages in sitemap X-Git-Tag: 5.5.0_Beta_1~3^2~4^2 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=340fe36d8228b76a15b947d4cf67af7a42ee9c44;p=GitHub%2FWoltLab%2FWCF.git Fix handling of CMS pages in sitemap Delegate the visibility control and access control to the appropriate methods in \wcf\data\page\Page instead of reimplementing it from scratch. Most notably the inversion of the page ACL was not implemented correctly within the sitemap. see 92fba0538afc1d88f411db1a80553af2d17c09b4 Closes #4767 Co-authored-by: mutec --- diff --git a/wcfsetup/install/files/lib/system/sitemap/object/MultilingualPageSitemapObject.class.php b/wcfsetup/install/files/lib/system/sitemap/object/MultilingualPageSitemapObject.class.php index 179a06fe46..918f9804bd 100644 --- a/wcfsetup/install/files/lib/system/sitemap/object/MultilingualPageSitemapObject.class.php +++ b/wcfsetup/install/files/lib/system/sitemap/object/MultilingualPageSitemapObject.class.php @@ -7,7 +7,6 @@ use wcf\data\page\content\PageContent; use wcf\data\page\content\PageContentList; use wcf\data\page\Page; use wcf\page\AbstractPage; -use wcf\system\acl\simple\SimpleAclResolver; use wcf\system\exception\IllegalLinkException; use wcf\system\exception\PermissionDeniedException; @@ -58,23 +57,15 @@ class MultilingualPageSitemapObject extends AbstractSitemapObjectObjectType /** @var $object PageContent */ $page = new Page($object->pageID); - if ($page->isDisabled) { - return false; - } - if ($page->requireObjectID) { return false; } - if (!$page->validateOptions()) { - return false; - } - - if (!$page->validatePermissions()) { + if (!$page->isVisible()) { return false; } - if (!SimpleAclResolver::getInstance()->canAccess('com.woltlab.wcf.page', $object->pageID)) { + if (!$page->isAccessible()) { return false; } diff --git a/wcfsetup/install/files/lib/system/sitemap/object/SimplePageSitemapObject.class.php b/wcfsetup/install/files/lib/system/sitemap/object/SimplePageSitemapObject.class.php index 20964d45e3..a852907a27 100644 --- a/wcfsetup/install/files/lib/system/sitemap/object/SimplePageSitemapObject.class.php +++ b/wcfsetup/install/files/lib/system/sitemap/object/SimplePageSitemapObject.class.php @@ -6,7 +6,6 @@ use wcf\data\DatabaseObject; use wcf\data\page\Page; use wcf\data\page\PageList; use wcf\page\AbstractPage; -use wcf\system\acl\simple\SimpleAclResolver; use wcf\system\exception\IllegalLinkException; use wcf\system\exception\PermissionDeniedException; @@ -47,24 +46,17 @@ class SimplePageSitemapObject extends AbstractSitemapObjectObjectType */ public function canView(DatabaseObject $object) { - /** @var Page $object */ - if ($object->isDisabled) { - return false; - } + \assert($object instanceof Page); if ($object->requireObjectID) { return false; } - if (!$object->validateOptions()) { - return false; - } - - if (!$object->validatePermissions()) { + if (!$object->isVisible()) { return false; } - if (!SimpleAclResolver::getInstance()->canAccess('com.woltlab.wcf.page', $object->pageID)) { + if (!$object->isAccessible()) { return false; }