Filemanager - copy/move node - handle invisible destination exists
authorPaul Mehrer <p.mehrer@metaways.de>
Wed, 12 Jul 2017 14:14:36 +0000 (16:14 +0200)
committerPaul Mehrer <p.mehrer@metaways.de>
Thu, 13 Jul 2017 09:21:18 +0000 (11:21 +0200)
in case the user doesn't have the right to see the destination before
an unhandled exception was thrown. Now a check will test for this and
throw a SystemGeneric exception

Change-Id: I20ceeb5d737a86b2fe9695326bdaddad5e061907
Reviewed-on: http://gerrit.tine20.com/customers/5126
Tested-by: Jenkins CI (http://ci.tine20.com/)
Reviewed-by: Paul Mehrer <p.mehrer@metaways.de>
Tested-by: Paul Mehrer <p.mehrer@metaways.de>
tine20/Filemanager/Controller/Node.php

index 396676b..50b0651 100644 (file)
@@ -1053,6 +1053,11 @@ class Filemanager_Controller_Node extends Tinebase_Controller_Record_Abstract
         
         try {
             $this->_checkIfExists($_destination);
+            // check if there is a node our user can't see
+            if (null !== $this->_backend->_getTreeNodeBackend()->getChild($_destination->getParent()->getNode(),
+                    $_destination->name, false, false)) {
+                throw new Tinebase_Exception_SystemGeneric('The destination already exists, but you don\'t have the right to see it.');
+            }
         } catch (Filemanager_Exception_NodeExists $fene) {
             if ($_forceOverwrite && $_source->statpath !== $_destination->statpath) {
                 // delete old node
@@ -1167,6 +1172,11 @@ class Filemanager_Controller_Node extends Tinebase_Controller_Record_Abstract
         //if ($source->getParent()->flatpath != $destinationParentPathRecord->flatpath) {
             try {
                 $this->_checkIfExists($destination);
+                // check if there is a node our user can't see
+                if (null !== $this->_backend->_getTreeNodeBackend()->getChild($destinationParentPathRecord->getNode(),
+                        $destination->name, false, false)) {
+                    throw new Tinebase_Exception_SystemGeneric('The destination already exists, but you don\'t have the right to see it.');
+                }
             } catch (Filemanager_Exception_NodeExists $fene) {
                 if ($_forceOverwrite && $source->statpath !== $destination->statpath) {
                     if (Tinebase_Core::isLogLevel(Zend_Log::INFO)) Tinebase_Core::getLogger()->info(__METHOD__ . '::' . __LINE__