use onlyCurrentUserOrganizer param in update, too
authorPhilipp Schüle <p.schuele@metaways.de>
Mon, 18 Aug 2014 14:41:41 +0000 (16:41 +0200)
committerPhilipp Schüle <p.schuele@metaways.de>
Thu, 4 Sep 2014 09:26:42 +0000 (11:26 +0200)
Change-Id: I56642c102484093390cc8e99e1e155e9194fd02b
Reviewed-on: http://gerrit.tine20.com/customers/1013
Tested-by: Jenkins CI (http://ci.tine20.com/)
Reviewed-by: Philipp Schüle <p.schuele@metaways.de>
tine20/Calendar/Frontend/Cli.php
tine20/Calendar/Import/CalDav/Client.php

index 24f6a1d..5c896f0 100644 (file)
@@ -231,7 +231,7 @@ class Calendar_Frontend_Cli extends Tinebase_Frontend_Cli_Abstract
         . ' --method Calendar.' . $mode . 'CalDavDataForUser'
                 . ' url=' .  $args['url'] . ' caldavuserfile=' . $args['caldavuserfile'];
         
-        $numberOfRuns = ($mode === 'import') ? 2 : 1;
+        $numberOfRuns = 2;
         for ($run = 1; $run <= $numberOfRuns; ++$run)
         {
             $this->_runMultiProcessImportUpdate($numProc, $cliParams, $users, $run);
@@ -374,7 +374,7 @@ class Calendar_Frontend_Cli extends Tinebase_Frontend_Cli_Abstract
      */
     public function updateCalDavDataForUser(Zend_Console_Getopt $_opts)
     {
-        $args = $this->_parseArgs($_opts, array('url', 'caldavuserfile', 'line'));
+        $args = $this->_parseArgs($_opts, array('url', 'caldavuserfile', 'line', 'run'));
         
         $writer = new Zend_Log_Writer_Stream('php://output');
         $writer->addFilter(new Zend_Log_Filter_Priority(4));
@@ -392,9 +392,9 @@ class Calendar_Frontend_Cli extends Tinebase_Frontend_Cli_Abstract
                 ), 'MacOSX');
         $client->setVerifyPeer(false);
         
-        $client->updateAllCalendarData();
+        $client->updateAllCalendarData($args['run']==1 ? true : false);
     }
-    
+   
     /**
      * update calendar/events from a CalDav source using etags
      * 
index f937db5..dc0c3b7 100644 (file)
@@ -404,7 +404,17 @@ class Calendar_Import_CalDav_Client extends Tinebase_Import_CalDav_Client
                         try {
                             if ($update && in_array($id, $this->existingRecordIds[$calUri])) {
                                 $event = new Calendar_Frontend_WebDAV_Event($container, $id);
-                                $event->put($data);
+                                if ($onlyCurrentUserOrganizer) {
+                                    // assert current user is organizer
+                                    if ($event->getRecord()->organizer && $event->getRecord()->organizer == Tinebase_Core::getUser()->contact_id) {
+                                        $event->put($data);
+                                    } else {
+                                        continue;
+                                    }
+                                } else {
+                                    $event->put($data);
+                                }
+                                
                             } else {
                                 $event = Calendar_Frontend_WebDAV_Event::create(
                                     $container,