0010630: LDAP user sync needs to set creation and lasr modified time
authorPhilipp Schüle <p.schuele@metaways.de>
Mon, 5 Jan 2015 10:58:15 +0000 (11:58 +0100)
committerLars Kneschke <l.kneschke@metaways.de>
Tue, 6 Jan 2015 01:21:34 +0000 (02:21 +0100)
* takes care of user and group modlog

https://forge.tine20.org/view.php?id=10630

Change-Id: Id0836ed090434d77fdada97aa750066b9f5f90fd
Reviewed-on: http://gerrit.tine20.com/customers/1502
Tested-by: Jenkins CI (http://ci.tine20.com/)
Reviewed-by: Lars Kneschke <l.kneschke@metaways.de>
tine20/Tinebase/Group.php
tine20/Tinebase/User.php

index 2ec52a7..e1ae677 100644 (file)
@@ -171,6 +171,7 @@ class Tinebase_Group
                 $groupBackend->getGroupById($groupId);
             } catch (Tinebase_Exception_Record_NotDefined $tern) {
                 $group = $groupBackend->getGroupByIdFromSyncBackend($groupId);
+                Tinebase_Timemachine_ModificationLog::setRecordMetaData($group, 'create');
                 $groupBackend->addGroupInSqlBackend($group);
             }
         }
@@ -228,7 +229,7 @@ class Tinebase_Group
                 // list id changed / is new -> update group and make group visible
                 $group->list_id = $list->getId();
                 $group->visibility = Tinebase_Model_Group::VISIBILITY_DISPLAYED;
-                
+                Tinebase_Timemachine_ModificationLog::setRecordMetaData($group, 'update');
                 Tinebase_Group::getInstance()->updateGroup($group);
             }
             
@@ -274,6 +275,7 @@ class Tinebase_Group
                 if (Tinebase_Core::isLogLevel(Zend_Log::INFO)) Tinebase_Core::getLogger()->info(__METHOD__ . '::' . __LINE__ .
                     ' Merge missing properties and update group.');
                 $groupBackend->mergeMissingProperties($group, $sqlGroup);
+                Tinebase_Timemachine_ModificationLog::setRecordMetaData($group, 'update');
                 $groupBackend->updateGroupInSqlBackend($group);
                 
             } catch (Tinebase_Exception_Record_NotDefined $tern) {
@@ -290,6 +292,7 @@ class Tinebase_Group
                     if (Tinebase_Core::isLogLevel(Zend_Log::INFO)) Tinebase_Core::getLogger()->info(__METHOD__ . '::' . __LINE__ .
                         ' Group not found by ID and name, adding new group.');
                 }
+                Tinebase_Timemachine_ModificationLog::setRecordMetaData($group, 'create');
                 $groupBackend->addGroupInSqlBackend($group);
             }
         }
@@ -309,6 +312,7 @@ class Tinebase_Group
             'name'          => $defaultAdminGroupName,
             'description'   => 'Group of administrative accounts'
         ));
+        Tinebase_Timemachine_ModificationLog::setRecordMetaData($adminGroup, 'create');
         Tinebase_Group::getInstance()->addGroup($adminGroup);
 
         $defaultUserGroupName = (Tinebase_User::getBackendConfiguration(Tinebase_User::DEFAULT_USER_GROUP_NAME_KEY))
@@ -318,6 +322,7 @@ class Tinebase_Group
             'name'          => $defaultUserGroupName,
             'description'   => 'Group of user accounts'
         ));
+        Tinebase_Timemachine_ModificationLog::setRecordMetaData($userGroup, 'create');
         Tinebase_Group::getInstance()->addGroup($userGroup);
     }
 }
index a2c2d04..dfbaca1 100644 (file)
@@ -483,7 +483,8 @@ class Tinebase_User
                     self::createContactForSyncedUser($currentUser);
                 }
             }
-        
+            
+            Tinebase_Timemachine_ModificationLog::setRecordMetaData($currentUser, 'update');
             $syncedUser = $userBackend->updateUserInSqlBackend($currentUser);
             if (! empty($user->container_id)) {
                 $syncedUser->container_id = $user->container_id;
@@ -503,6 +504,7 @@ class Tinebase_User
             if ($user->visibility !== Tinebase_Model_FullUser::VISIBILITY_HIDDEN) {
                 self::createContactForSyncedUser($user);
             }
+            Tinebase_Timemachine_ModificationLog::setRecordMetaData($user, 'create');
             $syncedUser = $userBackend->addUserInSqlBackend($user);
             $userBackend->addPluginUser($syncedUser, $user);
         }