From ace56add0716bb9e98fcdba5381fdf1e72b4bb73 Mon Sep 17 00:00:00 2001 From: Marcel Werk Date: Tue, 19 Jul 2016 20:39:03 +0200 Subject: [PATCH] Made usage of acl for label groups optional --- .../lib/data/label/group/ViewableLabelGroup.class.php | 9 +++++++++ .../files/lib/system/label/LabelHandler.class.php | 4 ++-- .../label/object/AbstractLabelObjectHandler.class.php | 2 +- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/wcfsetup/install/files/lib/data/label/group/ViewableLabelGroup.class.php b/wcfsetup/install/files/lib/data/label/group/ViewableLabelGroup.class.php index cd3217b213..354560143d 100644 --- a/wcfsetup/install/files/lib/data/label/group/ViewableLabelGroup.class.php +++ b/wcfsetup/install/files/lib/data/label/group/ViewableLabelGroup.class.php @@ -230,4 +230,13 @@ class ViewableLabelGroup extends DatabaseObjectDecorator implements \Countable, return null; } } + + /** + * Returns false if this label group has no permissions at all. + * + * @return boolean + */ + public function hasPermissions() { + return (empty($this->permissions['group']) && empty($this->permissions['user'])); + } } diff --git a/wcfsetup/install/files/lib/system/label/LabelHandler.class.php b/wcfsetup/install/files/lib/system/label/LabelHandler.class.php index bef973e676..9b98360849 100644 --- a/wcfsetup/install/files/lib/system/label/LabelHandler.class.php +++ b/wcfsetup/install/files/lib/system/label/LabelHandler.class.php @@ -140,7 +140,7 @@ class LabelHandler extends SingletonFactory { continue; } - if ($group->getPermission($optionID)) { + if (!$group->hasPermissions() || $group->getPermission($optionID)) { $isValid = true; } } @@ -289,7 +289,7 @@ class LabelHandler extends SingletonFactory { // validate permissions if ($validatePermissions) { - if (!$this->labelGroups['groups'][$groupID]->getPermission($optionID)) { + if ($this->labelGroups['groups'][$groupID]->hasPermissions() && !$this->labelGroups['groups'][$groupID]->getPermission($optionID)) { continue; } } diff --git a/wcfsetup/install/files/lib/system/label/object/AbstractLabelObjectHandler.class.php b/wcfsetup/install/files/lib/system/label/object/AbstractLabelObjectHandler.class.php index 5cb0f86f1d..8ff08fcdac 100644 --- a/wcfsetup/install/files/lib/system/label/object/AbstractLabelObjectHandler.class.php +++ b/wcfsetup/install/files/lib/system/label/object/AbstractLabelObjectHandler.class.php @@ -104,7 +104,7 @@ abstract class AbstractLabelObjectHandler extends SingletonFactory implements IL } // check permission - if ($optionID && !$this->labelGroups[$groupID]->getPermission($optionID)) { + if ($optionID && ($this->labelGroups[$groupID]->hasPermissions() && !$this->labelGroups[$groupID]->getPermission($optionID))) { $validationErrors[0] = 'invalid'; continue; } -- 2.20.1