public function deleteProvisionedLdapEntries($account) {
    // determine server that is associated with user

    $boolean_result = FALSE;
    $language = ($account->language) ? $account->language : 'und';
    if (isset($account->ldap_user_prov_entries[$language][0])) {
      foreach ($account->ldap_user_prov_entries[$language] as $i => $field_instance) {
        $parts = explode('|', $field_instance['value']);
        if (count($parts) == 2) {

          list($sid, $dn) = $parts;
          $ldap_server = ldap_servers_get_servers($sid, NULL, TRUE);
          if (is_object($ldap_server) && $dn) {
            $boolean_result = $ldap_server->delete($dn);
            $tokens = array('%sid' => $sid, '%dn' => $dn, '%username' => $account->name, '%uid' => $account->uid);
            if ($boolean_result) {
              watchdog('ldap_user', 'LDAP entry on server %sid deleted dn=%dn. username=%username, uid=%uid', $tokens, WATCHDOG_INFO);
            }
            else {
              watchdog('ldap_user', 'LDAP entry on server %sid not deleted because error. username=%username, uid=%uid', $tokens, WATCHDOG_ERROR);
            }
          }
          else {
            $boolean_result = FALSE;
          }
        }
      }
    }
    return $boolean_result;

  }
public function deleteProvisionedLdapEntries($account) {
    // determine server that is associated with user

    $boolean_result = FALSE;
    $language = ($account->language) ? $account->language : 'und';
    if (isset($account->ldap_user_prov_entries[$language][0])) {
      foreach ($account->ldap_user_prov_entries[$language] as $i => $field_instance) {
        $parts = explode('|', $field_instance['value']);
        if (count($parts) == 2) {

          list($sid, $dn) = $parts;
          $ldap_server = ldap_servers_get_servers($sid, NULL, TRUE);
          if (is_object($ldap_server) && $dn) {
            $boolean_result = $ldap_server->delete($dn);
            $tokens = array('%sid' => $sid, '%dn' => $dn, '%username' => $account->name, '%uid' => $account->uid);
            if ($boolean_result) {
              watchdog('ldap_user', 'LDAP entry on server %sid deleted dn=%dn. username=%username, uid=%uid', $tokens, WATCHDOG_INFO);
            }
            else {
              watchdog('ldap_user', 'LDAP entry on server %sid not deleted because error. username=%username, uid=%uid', $tokens, WATCHDOG_ERROR);
            }
          }
          else {
            $boolean_result = FALSE;
          }
        }
      }
    }
    return $boolean_result;

  }
public function deleteProvisionedLdapEntries ( $ account ) { // determine server that is associated with user $ boolean_result = FALSE ; $ language = ( $ account -> language ) ? $ account -> language : 'und' ; if ( isset ( $ account -> ldap_user_prov_entries [ $ language ] [ 0 ] ) ) { foreach ( $ account -> ldap_user_prov_entries [ $ language ] as $ i => $ field_instance ) { $ parts = explode ( '|' , $ field_instance [ 'value' ] ) ; if ( count ( $ parts ) == 2 ) { list ( $ sid , $ dn ) = $ parts ; $ ldap_server = ldap_servers_get_servers ( $ sid , NULL , TRUE ) ; if ( is_object ( $ ldap_server ) && $ dn ) { $ boolean_result = $ ldap_server -> delete ( $ dn ) ; $ tokens = array ( '%sid' => $ sid , '%dn' => $ dn , '%username' => $ account -> name , '%uid' => $ account -> uid ) ; if ( $ boolean_result ) { watchdog ( 'ldap_user' , 'LDAP entry on server %sid deleted dn=%dn. username=%username, uid=%uid' , $ tokens , WATCHDOG_INFO ) ; } else { watchdog ( 'ldap_user' , 'LDAP entry on server %sid not deleted because error. username=%username, uid=%uid' , $ tokens , WATCHDOG_ERROR ) ; } } else { $ boolean_result = FALSE ; } } } } return $ boolean_result ; }
given a drupal account, delete ldap entry that was provisioned based on it
normally this will be 0 or 1 entry, but the ldap_user_provisioned_ldap_entries
field attached to the user entity track each ldap entry provisioned

@param object $account drupal account
@return TRUE or FALSE.  FALSE indicates failed or action not enabled in ldap user configuration
given a drupal account delete ldap entry that was provisioned based on it normally this will be 0 or 1 entry but the ldap_user_provisioned_ldap_entries field attached to the user entity track each ldap entry provisioned