Added simple acl implementation for cms pages
authorMarcel Werk <burntime@woltlab.com>
Thu, 23 Jun 2016 19:44:07 +0000 (21:44 +0200)
committerMarcel Werk <burntime@woltlab.com>
Thu, 23 Jun 2016 19:44:07 +0000 (21:44 +0200)
wcfsetup/install/files/lib/data/menu/item/MenuItem.class.php
wcfsetup/install/files/lib/data/page/Page.class.php
wcfsetup/install/files/lib/page/CmsPage.class.php

index 17ab7bd1bfa75acdd77e27bcd19b494a1dfac224..be074a5733acef953a7438e75d1dd0eb558d7740 100644 (file)
@@ -122,7 +122,7 @@ class MenuItem extends DatabaseObject {
                        return false;
                }
                
-               if ($this->getPage() !== null && !$this->getPage()->isVisible()) {
+               if ($this->getPage() !== null && (!$this->getPage()->isVisible() || !$this->getPage()->isAccessible())) {
                        return false;
                }
                
index f450da8a4810fa192174c95bfdc67732977ccf32..4945b770a61559a930890749fecbe00a0aa49d26 100644 (file)
@@ -5,6 +5,7 @@ use wcf\data\ILinkableObject;
 use wcf\data\ITitledObject;
 use wcf\data\TDatabaseObjectOptions;
 use wcf\data\TDatabaseObjectPermissions;
+use wcf\system\acl\simple\SimpleAclResolver;
 use wcf\system\application\ApplicationHandler;
 use wcf\system\database\util\PreparedStatementConditionBuilder;
 use wcf\system\exception\SystemException;
@@ -225,8 +226,7 @@ class Page extends DatabaseObject implements ILinkableObject, ITitledObject {
         * @return      boolean
         */
        public function isAccessible() {
-               // @todo
-               return true;
+               return SimpleAclResolver::getInstance()->canAccess('com.woltlab.wcf.page', $this->pageID);
        }
        
        /**
index bde08f27cd6490f6f0cbd9394f6bb9c23bb73943..14192d4ef31d538278a60a1f66304a95e5a41814 100644 (file)
@@ -63,6 +63,10 @@ class CmsPage extends AbstractPage {
                        throw new IllegalLinkException();
                }
                
+               if (!$this->page->isAccessible()) {
+                       throw new IllegalLinkException();
+               }
+               
                $this->content = $this->page->getPageContentByLanguage($this->languageID);
                if (empty($this->content)) {
                        throw new IllegalLinkException();