You should be able to delete container + content with ignore acl
authorsstamer <s.stamer@metaways.de>
Tue, 21 Apr 2015 13:22:59 +0000 (15:22 +0200)
committerPhilipp Schüle <p.schuele@metaways.de>
Mon, 27 Apr 2015 07:11:24 +0000 (09:11 +0200)
Change-Id: I42c6c8bcf762561dcd25fe073c29dcaa09d14f2f
Reviewed-on: http://gerrit.tine20.com/customers/1859
Tested-by: Jenkins CI (http://ci.tine20.com/)
Reviewed-by: Philipp Schüle <p.schuele@metaways.de>
tine20/Tinebase/Container.php

index 9d3de7e..7968440 100644 (file)
@@ -1033,7 +1033,7 @@ class Tinebase_Container extends Tinebase_Backend_Sql_Abstract
                     throw new Tinebase_Exception_InvalidArgument('Can delete personal or shared containers only.');
                 }
             }
-            $this->deleteContainerContents($container);
+            $this->deleteContainerContents($container, $_ignoreAcl);
             $deletedContainer = $this->_setRecordMetaDataAndUpdate($container, 'delete');
             
         } catch (Exception $e) {
@@ -1072,13 +1072,16 @@ class Tinebase_Container extends Tinebase_Backend_Sql_Abstract
      * 
      * @param Tinebase_Model_Container $container
      */
-    public function deleteContainerContents($container)
+    public function deleteContainerContents($container, $_ignoreAcl = FALSE)
     {
         // set records belonging to this container to deleted
         $model = $container->model;
         if ($model) {
             $controller = Tinebase_Core::getApplicationInstance($model);
             $filterName = $model . 'Filter';
+            if($_ignoreAcl === TRUE && method_exists($controller, 'doContainerACLChecks')) {
+                $acl = $controller->doContainerACLChecks(FALSE);
+            }
             if ($controller && class_exists($filterName)) {
                 $filter = new $filterName(array(
                     array(
@@ -1094,6 +1097,9 @@ class Tinebase_Container extends Tinebase_Backend_Sql_Abstract
                     'AND');
                 $controller::getInstance()->deleteByFilter($filter);
             }
+            if ($_ignoreAcl === TRUE && method_exists($controller, 'doContainerACLChecks')) {
+                $controller->doContainerACLChecks($acl);
+            }
         }
     }