Ejemplo n.º 1
0
 /**
  * delete an user
  *
  * @param int $_accountId
  */
 public function deleteUser($_accountId)
 {
     $metaData = $this->_getMetaData($_accountId);
     if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
         Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . '  $dn: ' . $metaData['dn']);
     }
     $this->_backend->delete($metaData['dn']);
 }
Ejemplo n.º 2
0
 /**
  * remove groups
  *
  * @param mixed $_groupId
  * 
  */
 public function deleteGroups($_groupId)
 {
     $groupIds = array();
     if (is_array($_groupId) or $_groupId instanceof Tinebase_Record_RecordSet) {
         foreach ($_groupId as $groupId) {
             $groupIds[] = Tinebase_Model_Group::convertGroupIdToInt($groupId);
         }
     } else {
         $groupIds[] = Tinebase_Model_Group::convertGroupIdToInt($_groupId);
     }
     foreach ($groupIds as $groupId) {
         $dn = $this->_getDn($groupId);
         $this->_ldap->delete($dn);
     }
 }
Ejemplo n.º 3
0
 /**
  * delete an user in ldap backend
  *
  * @param int $_userId
  */
 public function deleteUserInSyncBackend($_userId)
 {
     if ($this->_isReadOnlyBackend) {
         return;
     }
     try {
         $metaData = $this->_getMetaData($_userId);
         // user does not exist in ldap anymore
         if (!empty($metaData['dn'])) {
             $this->_ldap->delete($metaData['dn']);
         }
     } catch (Tinebase_Exception_NotFound $tenf) {
         if (Tinebase_Core::isLogLevel(Zend_Log::CRIT)) {
             Tinebase_Core::getLogger()->crit(__METHOD__ . '::' . __LINE__ . ' user not found in sync backend: ' . $_userId);
         }
     }
 }
 /**
  * delete an user in ldap backend
  *
  * @param int $_userId
  */
 public function deleteUserInSyncBackend($_userId)
 {
     if ($this->_isReadOnlyBackend) {
         return;
     }
     try {
         $metaData = $this->_getMetaData($_userId);
         if (!empty($metaData['dn'])) {
             if (Tinebase_Core::isLogLevel(Zend_Log::INFO)) {
                 Tinebase_Core::getLogger()->info(__METHOD__ . '::' . __LINE__ . ' delete user ' . $metaData['dn'] . ' from sync backend (LDAP)');
             }
             $this->_ldap->delete($metaData['dn']);
         }
     } catch (Tinebase_Exception_NotFound $tenf) {
         if (Tinebase_Core::isLogLevel(Zend_Log::CRIT)) {
             Tinebase_Core::getLogger()->crit(__METHOD__ . '::' . __LINE__ . ' user not found in sync backend: ' . $_userId);
         }
     }
 }
 /**
  * (non-PHPdoc)
  */
 protected function _saveOrUpdateSpecialResultToLdap()
 {
     foreach ($this->_ldapRawData as $dn) {
         if (isset($dn['simplemail_readonly'])) {
             continue;
         }
         // check for any values of worth to be saved (compared to minimal entry)
         $skeleton = array_change_key_case($this->_simpleMailConfig['skeleton']);
         $skeleton['dn'] = true;
         $skeleton = array_merge($skeleton, Zend_Ldap_Dn::fromString($this->_simpleMailConfig['storage_rdn'])->getRdn());
         try {
             if (count(array_diff_key($dn, $skeleton)) > 1) {
                 $this->_ldap->save(Zend_Ldap_Dn::fromString($dn['dn']), $dn);
             } else {
                 $this->_ldap->delete(Zend_Ldap_Dn::fromString($dn['dn']), false);
             }
         } catch (Zend_Ldap_Exception $ldapException) {
             if (Tinebase_Core::isLogLevel(Zend_Log::WARN)) {
                 Tinebase_Core::getLogger()->warn(__METHOD__ . '::' . __LINE__ . ' simpleMail - cannot modify ldap entry (' . $dn['dn'] . '): ' . $ldapException->getMessage());
             }
         }
     }
 }
 /**
  * (non-PHPdoc)
  */
 protected function _saveOrUpdateSpecialResultToLdap()
 {
     foreach ($this->_ldapRawData as $dn) {
         if (isset($dn['simplemail_readonly'])) {
             continue;
         }
         $keepEntryThreshold = 0;
         foreach ($this->_propertyMapping as $property => $ldapName) {
             if (substr($ldapName, -8) == ':boolean') {
                 $ldapName = substr($ldapName, 0, -8);
             }
             if (!isset($dn[$ldapName])) {
                 $dn[$ldapName] = null;
                 $keepEntryThreshold++;
             } elseif ($dn[$ldapName] === null) {
                 $keepEntryThreshold++;
             }
         }
         // check for any values of worth to be saved (compared to minimal entry)
         $dn = array_change_key_case($dn);
         $skeleton = array_change_key_case($this->_simpleMailConfig['skeleton']);
         $skeleton = array_merge($skeleton, Zend_Ldap_Dn::fromString($this->_simpleMailConfig['storage_rdn'])->getRdn());
         $skeleton['dn'] = true;
         // Zend_Ldap_Dn always carries the DN
         try {
             if (count(array_diff_key($dn, $skeleton)) > $keepEntryThreshold) {
                 $this->_ldap->save(Zend_Ldap_Dn::fromString($dn['dn']), $dn);
             } else {
                 $this->_ldap->delete(Zend_Ldap_Dn::fromString($dn['dn']), false);
             }
         } catch (Zend_Ldap_Exception $ldapException) {
             if (Tinebase_Core::isLogLevel(Zend_Log::WARN)) {
                 Tinebase_Core::getLogger()->warn(__METHOD__ . '::' . __LINE__ . ' simpleMail - cannot modify ldap entry (' . $dn['dn'] . '): ' . $ldapException->getMessage());
             }
         }
     }
 }