Merge branch '2013.10' into 2014.11
authorPhilipp Schüle <p.schuele@metaways.de>
Mon, 13 Jul 2015 11:07:18 +0000 (13:07 +0200)
committerPhilipp Schüle <p.schuele@metaways.de>
Mon, 13 Jul 2015 11:07:18 +0000 (13:07 +0200)
Conflicts:
tine20/Calendar/Controller/Event.php

Change-Id: I3a162ebb12ebe5fa544d630f791bf0116a8f72b7

1  2 
tests/tine20/Calendar/Controller/EventTests.php
tine20/Calendar/Controller/Event.php
tine20/Calendar/Convert/Event/VCalendar/Abstract.php
tine20/Tinebase/WebDav/PrincipalBackend.php

@@@ -1525,6 -1533,23 +1526,23 @@@ class Calendar_Controller_Event extend
              $_record->rrule = NULL;
          }
      }
 -        $record->originator_tz = $record->originator_tz ? $record->originator_tz : Tinebase_Core::get(Tinebase_Core::USERTIMEZONE);
+     /**
+      * checks/sets originator timezone
+      *
+      * @param $record
+      * @throws Tinebase_Exception_Record_Validation
+      */
+     protected function _inspectOriginatorTZ($record)
+     {
++        $record->originator_tz = $record->originator_tz ? $record->originator_tz : Tinebase_Core::getUserTimezone();
+         try {
+             new DateTimeZone($record->originator_tz);
+         } catch (Exception $e) {
+             throw new Tinebase_Exception_Record_Validation('Bad Timezone: ' . $record->originator_tz);
+         }
+     }
      
      /**
       * inspects delete action
@@@ -361,38 -360,35 +360,37 @@@ class Tinebase_WebDav_PrincipalBackend 
                          }
                      }
                      
 -                    // return user only, if the containers have the sync AND read grant set
 -                    $otherUsersSync = Tinebase_Container::getInstance()->getOtherUsers($user, 'Calendar', Tinebase_Model_Grants::GRANT_SYNC);
 -                    
 -                    if ($otherUsersSync->count() > 0) {
 -                        $otherUsersRead = Tinebase_Container::getInstance()->getOtherUsers($user, 'Calendar', Tinebase_Model_Grants::GRANT_READ);
 -                        
 -                        $otherUsersIds = array_intersect($otherUsersSync->getArrayOfIds(), $otherUsersRead->getArrayOfIds());
 +                    if (Tinebase_Core::getUser()->hasRight('Calendar', Tinebase_Acl_Rights::RUN)) {
 +                        // return user only, if the containers have the sync AND read grant set
 +                        $otherUsersSync = Tinebase_Container::getInstance()->getOtherUsers($user, 'Calendar', Tinebase_Model_Grants::GRANT_SYNC);
                          
 -                        foreach ($otherUsersIds as $userId) {
 -                            if ($otherUsersSync->getById($userId)->contact_id && $otherUsersSync->getById($userId)->visibility == Tinebase_Model_User::VISIBILITY_DISPLAYED) {
 -                                $result[] = self::PREFIX_USERS . '/' . $otherUsersSync->getById($userId)->contact_id . '/calendar-proxy-write';
 +                        if ($otherUsersSync->count() > 0) {
 +                            $otherUsersRead = Tinebase_Container::getInstance()->getOtherUsers($user, 'Calendar', Tinebase_Model_Grants::GRANT_READ);
 +                            
 +                            $otherUsersIds = array_intersect($otherUsersSync->getArrayOfIds(), $otherUsersRead->getArrayOfIds());
 +                            
 +                            foreach ($otherUsersIds as $userId) {
 +                                if ($otherUsersSync->getById($userId)->contact_id && $otherUsersSync->getById($userId)->visibility == Tinebase_Model_User::VISIBILITY_DISPLAYED) {
 +                                    $result[] = self::PREFIX_USERS . '/' . $otherUsersSync->getById($userId)->contact_id . '/calendar-proxy-write';
 +                                }
                              }
                          }
 -                    }
 -                    
 -                    // return user only, if the containers have the sync AND read grant set
 -                    $sharedContainersSync = Tinebase_Container::getInstance()->getSharedContainer($user, 'Calendar', Tinebase_Model_Grants::GRANT_SYNC);
 -                    
 -                    if ($sharedContainersSync->count() > 0) {
 -                        $sharedContainersRead = Tinebase_Container::getInstance()->getSharedContainer($user, 'Calendar', Tinebase_Model_Grants::GRANT_READ);
                          
 -                        $sharedContainerIds = array_intersect($sharedContainersSync->getArrayOfIds(), $sharedContainersRead->getArrayOfIds());
 +                        // return user only, if the containers have the sync AND read grant set
 +                        $sharedContainersSync = Tinebase_Container::getInstance()->getSharedContainer($user, 'Calendar', Tinebase_Model_Grants::GRANT_SYNC);
                          
 -                        if (count($sharedContainerIds) > 0) {
 -                            $result[] = self::PREFIX_USERS . '/' . self::SHARED . '/calendar-proxy-write';
 +                        if ($sharedContainersSync->count() > 0) {
 +                            $sharedContainersRead = Tinebase_Container::getInstance()->getSharedContainer($user, 'Calendar', Tinebase_Model_Grants::GRANT_READ);
 +                            
 +                            $sharedContainerIds = array_intersect($sharedContainersSync->getArrayOfIds(), $sharedContainersRead->getArrayOfIds());
 +                            
 +                            if (count($sharedContainerIds) > 0) {
 +                                $result[] = self::PREFIX_USERS . '/' . self::SHARED . '/calendar-proxy-write';
 +                            }
                          }
                      }
-                     
                      Tinebase_Cache_PerRequest::getInstance()->save(__CLASS__, __FUNCTION__, $classCacheId, $result);
-                     $cache->save($result, $cacheId, array(), 60);
+                     $cache->save($result, $cacheId, array(), 60 * 3);
                  }
                  
                  break;