ACL values were not deleted when deleting categories
authorMarcel Werk <burntime@woltlab.com>
Fri, 30 Jul 2021 12:38:05 +0000 (14:38 +0200)
committerMarcel Werk <burntime@woltlab.com>
Fri, 30 Jul 2021 12:38:05 +0000 (14:38 +0200)
wcfsetup/install/files/lib/data/category/CategoryAction.class.php

index 3717284062c439c62adb8bee3d077f3ac9945b47..0ec98701deebac14397a72af4bd9762aa805e60b 100644 (file)
@@ -8,6 +8,7 @@ use wcf\data\IToggleAction;
 use wcf\data\IToggleContainerAction;
 use wcf\data\language\item\LanguageItemAction;
 use wcf\data\TDatabaseObjectToggle;
+use wcf\system\acl\ACLHandler;
 use wcf\system\category\CategoryHandler;
 use wcf\system\database\util\PreparedStatementConditionBuilder;
 use wcf\system\exception\PermissionDeniedException;
@@ -58,6 +59,17 @@ class CategoryAction extends AbstractDatabaseObjectAction implements
 
         $returnValue = parent::delete();
 
+        // delete acl
+        foreach ($this->getObjects() as $categoryEditor) {
+            $aclObjectTypeName = $categoryEditor->getObjectType()->getProcessor()->getObjectTypeName('com.woltlab.wcf.acl');
+            if ($aclObjectTypeName) {
+                ACLHandler::getInstance()->removeValues(
+                    ACLHandler::getInstance()->getObjectTypeID($aclObjectTypeName),
+                    [$categoryEditor->categoryID]
+                );
+            }
+        }
+
         // delete language items
         if (!empty($this->objects)) {
             // identify i18n labels