Made usage of acl for label groups optional
authorMarcel Werk <burntime@woltlab.com>
Tue, 19 Jul 2016 18:39:03 +0000 (20:39 +0200)
committerMarcel Werk <burntime@woltlab.com>
Tue, 19 Jul 2016 18:39:03 +0000 (20:39 +0200)
wcfsetup/install/files/lib/data/label/group/ViewableLabelGroup.class.php
wcfsetup/install/files/lib/system/label/LabelHandler.class.php
wcfsetup/install/files/lib/system/label/object/AbstractLabelObjectHandler.class.php

index cd3217b213afc606522fc211587fc56dc7dc77ec..354560143d179c3f3057cca219c6ea43857034fd 100644 (file)
@@ -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']));
+       }
 }
index bef973e676327520585096d7141d5a080d1d693f..9b983608495716416970dcde57240b15268ba478 100644 (file)
@@ -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;
                                }
                        }
index 5cb0f86f1dd5d658a556ddb904f2692af632b8d1..8ff08fcdacfc2c84bec3cf196dc1fdadaa85e986 100644 (file)
@@ -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;
                        }