/**
  * Updates all user-data stored in the system.
  * This may be a long-running task, so execute this only explicitly
  * and not during common requests!
  *
  * @return bool
  */
 public function updateUserData()
 {
     //sync may take time -> increase the time available
     if (@ini_get("max_execution_time") < 500 && @ini_get("max_execution_time") > 0) {
         @ini_set("max_execution_time", "500");
     }
     $objLdap = class_ldap::getInstance();
     //fill all groups - loads new members
     $arrGroups = $this->getAllGroupIds();
     foreach ($arrGroups as $strSingleGroupId) {
         $objGroup = new class_usersources_group_ldap($strSingleGroupId);
         $objGroup->getUserIdsForGroup();
     }
     //parse all users
     $arrUsers = $this->getAllUserIds();
     foreach ($arrUsers as $strOneUserId) {
         $objUser = new class_module_user_user($strOneUserId);
         /** @var $objSourceUser class_usersources_user_ldap */
         $objSourceUser = $objUser->getObjSourceUser();
         $arrUserDetails = false;
         try {
             $arrUserDetails = $objLdap->getUserDetailsByDN($objSourceUser->getStrDN());
         } catch (class_exception $objEx) {
         }
         if ($arrUserDetails !== false) {
             $objSourceUser->setStrDN($arrUserDetails["identifier"]);
             $objSourceUser->setStrFamilyname($arrUserDetails["familyname"]);
             $objSourceUser->setStrGivenname($arrUserDetails["givenname"]);
             $objSourceUser->setStrEmail($arrUserDetails["mail"]);
             $objSourceUser->updateObjectToDb();
             $this->objDB->flushQueryCache();
         } else {
             //user seems to be deleted, remove from system, too
             $objUser->deleteObject();
         }
     }
     return true;
 }
 /**
  * Returns the list of group-ids the current user is assigned to
  * @return array
  */
 public function getGroupIdsForUser()
 {
     $arrReturn = array();
     $objLdap = class_ldap::getInstance($this->intCfg);
     $objLdapSource = new class_usersources_source_ldap();
     $arrLdapGroups = $objLdapSource->getAllGroupIds();
     foreach ($arrLdapGroups as $strOneGroupId) {
         $objGroup = new class_usersources_group_ldap($strOneGroupId);
         if ($objGroup->getIntCfg() == $this->intCfg && $objLdap->isUserMemberOfGroup($this->getStrDN(), $objGroup->getStrDn())) {
             $arrReturn[] = $strOneGroupId;
         }
     }
     return $arrReturn;
 }