Fixed validation of permissions for label groups in articles
authorMarcel Werk <burntime@woltlab.com>
Fri, 7 Dec 2018 10:56:33 +0000 (11:56 +0100)
committerMarcel Werk <burntime@woltlab.com>
Fri, 7 Dec 2018 10:56:33 +0000 (11:56 +0100)
wcfsetup/install/files/lib/data/article/category/ArticleCategory.class.php
wcfsetup/install/files/lib/page/ArticleListPage.class.php

index aafb964e03e895d0ca837e46ef70315a629e60f3..3bdb56124a9e0457d05266497ac03fcc2396987e 100644 (file)
@@ -125,9 +125,10 @@ class ArticleCategory extends AbstractDecoratedCategory implements IAccessibleOb
        /**
         * Returns the label groups for all accessible categories.
         *
+        * @param       string          $permission
         * @return      ViewableLabelGroup[]
         */
-       public static function getAccessibleLabelGroups() {
+       public static function getAccessibleLabelGroups($permission = 'canSetLabel') {
                $labelGroupsToCategories = ArticleCategoryLabelCacheBuilder::getInstance()->getData();
                $accessibleCategoryIDs = self::getAccessibleCategoryIDs();
                
@@ -139,6 +140,6 @@ class ArticleCategory extends AbstractDecoratedCategory implements IAccessibleOb
                }
                if (empty($groupIDs)) return [];
                
-               return LabelHandler::getInstance()->getLabelGroups(array_unique($groupIDs));
+               return LabelHandler::getInstance()->getLabelGroups(array_unique($groupIDs), true, $permission);
        }
 }
index e23c8ea254c175d54fad780ea850299a468feab0..2e78b19bdc9a4442ebf3b0c192b4723c785928aa 100644 (file)
@@ -75,7 +75,7 @@ class ArticleListPage extends MultipleLinkPage {
                parent::readParameters();
                
                // read available label groups
-               $this->labelGroups = ArticleCategory::getAccessibleLabelGroups();
+               $this->labelGroups = ArticleCategory::getAccessibleLabelGroups('canViewLabel');
                if (!empty($this->labelGroups) && isset($_REQUEST['labelIDs']) && is_array($_REQUEST['labelIDs'])) {
                        $this->labelIDs = $_REQUEST['labelIDs'];