当前位置: 首页>>代码示例>>PHP>>正文


PHP ldap_mod_del函数代码示例

本文整理汇总了PHP中ldap_mod_del函数的典型用法代码示例。如果您正苦于以下问题:PHP ldap_mod_del函数的具体用法?PHP ldap_mod_del怎么用?PHP ldap_mod_del使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了ldap_mod_del函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: update


//.........这里部分代码省略.........
     $ldap =& $this->getLDAP();
     if (!$ldap instanceof Net_LDAP2) {
         return PEAR::raiseError("The entries LDAP object is not valid");
     }
     // Get and check link
     $link = $ldap->getLink();
     if (!is_resource($link)) {
         return PEAR::raiseError("Could not update entry: internal LDAP link is invalid");
     }
     /*
      * Delete the entry
      */
     if (true === $this->_delete) {
         return $ldap->delete($this);
     }
     /*
      * New entry
      */
     if (true === $this->_new) {
         $msg = $ldap->add($this);
         if (Net_LDAP2::isError($msg)) {
             return $msg;
         }
         $this->_new = false;
         $this->_changes['add'] = array();
         $this->_changes['delete'] = array();
         $this->_changes['replace'] = array();
         $this->_original = $this->_attributes;
         $return = true;
         return $return;
     }
     /*
      * Rename/move entry
      */
     if (false == is_null($this->_newdn)) {
         if ($ldap->getLDAPVersion() !== 3) {
             return PEAR::raiseError("Renaming/Moving an entry is only supported in LDAPv3");
         }
         // make dn relative to parent (needed for ldap rename)
         $parent = Net_LDAP2_Util::ldap_explode_dn($this->_newdn, array('casefolding' => 'none', 'reverse' => false, 'onlyvalues' => false));
         if (Net_LDAP2::isError($parent)) {
             return $parent;
         }
         $child = array_shift($parent);
         // maybe the dn consist of a multivalued RDN, we must build the dn in this case
         // because the $child-RDN is an array!
         if (is_array($child)) {
             $child = Net_LDAP2_Util::canonical_dn($child);
         }
         $parent = Net_LDAP2_Util::canonical_dn($parent);
         // rename/move
         if (false == @ldap_rename($link, $this->_dn, $child, $parent, true)) {
             return PEAR::raiseError("Entry not renamed: " . @ldap_error($link), @ldap_errno($link));
         }
         // reflect changes to local copy
         $this->_dn = $this->_newdn;
         $this->_newdn = null;
     }
     /*
      * Carry out modifications to the entry
      */
     // ADD
     foreach ($this->_changes["add"] as $attr => $value) {
         // if attribute exists, add new values
         if ($this->exists($attr)) {
             if (false === @ldap_mod_add($link, $this->dn(), array($attr => $value))) {
                 return PEAR::raiseError("Could not add new values to attribute {$attr}: " . @ldap_error($link), @ldap_errno($link));
             }
         } else {
             // new attribute
             if (false === @ldap_modify($link, $this->dn(), array($attr => $value))) {
                 return PEAR::raiseError("Could not add new attribute {$attr}: " . @ldap_error($link), @ldap_errno($link));
             }
         }
         // all went well here, I guess
         unset($this->_changes["add"][$attr]);
     }
     // DELETE
     foreach ($this->_changes["delete"] as $attr => $value) {
         // In LDAPv3 you need to specify the old values for deleting
         if (is_null($value) && $ldap->getLDAPVersion() === 3) {
             $value = $this->_original[$attr];
         }
         if (false === @ldap_mod_del($link, $this->dn(), array($attr => $value))) {
             return PEAR::raiseError("Could not delete attribute {$attr}: " . @ldap_error($link), @ldap_errno($link));
         }
         unset($this->_changes["delete"][$attr]);
     }
     // REPLACE
     foreach ($this->_changes["replace"] as $attr => $value) {
         if (false === @ldap_modify($link, $this->dn(), array($attr => $value))) {
             return PEAR::raiseError("Could not replace attribute {$attr} values: " . @ldap_error($link), @ldap_errno($link));
         }
         unset($this->_changes["replace"][$attr]);
     }
     // all went well, so _original (server) becomes _attributes (local copy)
     $this->_original = $this->_attributes;
     $return = true;
     return $return;
 }
开发者ID:microcosmx,项目名称:experiments,代码行数:101,代码来源:Entry.php

示例2: removeUser

 public function removeUser($dn)
 {
     $entry = array();
     $entry['member'] = $dn;
     if (ldap_mod_del($this->ldapconn, $this->dn, $entry) === false) {
         return false;
     } else {
         return true;
     }
 }
开发者ID:tmaex,项目名称:useradmin,代码行数:10,代码来源:group.inc.php

示例3: deleteAttribute

 /**
  * 	Delete a LDAP attribute in entry
  *	Ldap object connect and bind must have been done
  *
  *	@param	string		$dn			DN entry key
  *	@param	array		$info		Attributes array
  *	@param	User		$user		Objet user that create
  *	@return	int						<0 if KO, >0 if OK
  */
 function deleteAttribute($dn, $info, $user)
 {
     global $conf;
     dol_syslog(get_class($this) . "::deleteAttribute dn=" . $dn . " info=" . join(',', $info));
     // Check parameters
     if (!$this->connection) {
         $this->error = "NotConnected";
         return -2;
     }
     if (!$this->bind) {
         $this->error = "NotConnected";
         return -3;
     }
     // Encode to LDAP page code
     $dn = $this->convFromOutputCharset($dn, $this->ldapcharset);
     foreach ($info as $key => $val) {
         if (!is_array($val)) {
             $info[$key] = $this->convFromOutputCharset($val, $this->ldapcharset);
         }
     }
     $this->dump($dn, $info);
     //print_r($info);
     $result = @ldap_mod_del($this->connection, $dn, $info);
     if ($result) {
         dol_syslog(get_class($this) . "::deleteAttribute successfull", LOG_DEBUG);
         return 1;
     } else {
         $this->error = @ldap_error($this->connection);
         dol_syslog(get_class($this) . "::deleteAttribute failed: " . $this->error, LOG_ERR);
         return -1;
     }
 }
开发者ID:Samara94,项目名称:dolibarr,代码行数:41,代码来源:ldap.class.php

示例4: removeContact

 /**
  * Remove a contact from a group
  * 
  * @param string $group The group to remove a user from
  * @param string $contactDn The DN of a contact to remove from the group
  * @return bool
  */
 public function removeContact($group, $contactDn)
 {
     // Find the parent dn
     $groupInfo = $this->info($group, array("cn"));
     if ($groupInfo[0]["dn"] === NULL) {
         return false;
     }
     $groupDn = $groupInfo[0]["dn"];
     $del = array();
     $del["member"] = $contactDn;
     $result = @ldap_mod_del($this->adldap->getLdapConnection(), $groupDn, $del);
     if ($result == false) {
         return false;
     }
     return true;
 }
开发者ID:UCCNetworkingSociety,项目名称:NetsocAdmin,代码行数:23,代码来源:adLDAPGroups.php

示例5: ldap_mod_replace

if ($oldchildcn != "" && $childcn != "" && $oldchildcn != $childcn) {
    echo "CN aendern<br>";
    # hier noch Syntaxcheck
    $entry['cn'] = $childcn;
    $result = ldap_mod_replace($ds, $childDN, $entry);
    if ($result) {
        $mesg = "AU Name erfolgreich geaendert<br><br>";
    } else {
        $mesg = "Fehler beim aendern des AU Namen<br><br>";
    }
}
if ($oldchildcn != "" && $childcn == "") {
    echo "CN loeschen<br>";
    # hier noch Syntaxcheck
    $entry['cn'] = $oldchildcn;
    $result = ldap_mod_del($ds, $childDN, $entry);
    if ($result) {
        $mesg = "AU Name erfolgreich geloescht<br><br>";
    } else {
        $mesg = "Fehler beim loeschen des AU Namen<br><br>";
    }
}
#######################################
# OU
if ($oldchildou == $childou) {
    #$mesg = "keine Aenderung<br>";
}
if ($oldchildou != "" && $childou != "" && $oldchildou != $childou) {
    echo "OU aendern<br>";
    # hier noch Syntaxcheck
    # Formulareingaben anpassen
开发者ID:BackupTheBerlios,项目名称:openslx-svn,代码行数:31,代码来源:childau_change.php

示例6: setScriptActive

 /**
  * Sets a script running on the backend.
  *
  * @param array $script  The filter script information. Passed elements:
  *                       - 'name': (string) the script name.
  *                       - 'recipes': (array) the filter recipe objects.
  *                       - 'script': (string) the filter script.
  *
  * @throws Ingo_Exception
  */
 public function setScriptActive($script)
 {
     $ldapcn = $this->_connect();
     $values = $this->_getScripts($ldapcn, $userDN);
     $found = false;
     foreach ($values as $i => $value) {
         if (strpos($value, "# Sieve Filter\n") !== false) {
             if (empty($script['script'])) {
                 unset($values[$i]);
             } else {
                 $values[$i] = $script['script'];
             }
             $found = true;
             break;
         }
     }
     if (!$found && !empty($script['script'])) {
         $values[] = $script['script'];
     }
     $replace = array(Horde_String::lower($this->_params['script_attribute']) => $values);
     $r = empty($values) ? @ldap_mod_del($ldapcn, $userDN, $replace) : @ldap_mod_replace($ldapcn, $userDN, $replace);
     if (!$r) {
         throw new Ingo_Exception(sprintf(_("Activating the script for \"%s\" failed: (%d) %s"), $userDN, ldap_errno($ldapcn), ldap_error($ldapcn)));
     }
     @ldap_close($ldapcn);
 }
开发者ID:jubinpatel,项目名称:horde,代码行数:36,代码来源:Ldap.php

示例7: delAttribute

 public function delAttribute($dn, $attrib)
 {
     $arr = array();
     $arr[$attrib] = array();
     $status = ldap_mod_del($this->conn, $dn, $arr);
     if (!$status) {
         $status = ldap_error($this->conn);
     }
     return $status;
 }
开发者ID:pauldraper,项目名称:simple-ldap-manager,代码行数:10,代码来源:lucid_ldap.php

示例8: removeValues

 function removeValues($dn, $Attributes)
 {
     ldap_mod_del($this->LC, $dn, $Attributes);
 }
开发者ID:kotkotofey,项目名称:eight,代码行数:4,代码来源:forms.php

示例9: ldap_modify

$entry["macAddress"][0] = "aa:bb:cc:dd:ee:ff";
ldap_modify($ds, $dn, $entry);
/* #### DELETE ENTRIE ### */
$dn = "cn=MyDeleter,ou=Networks,dc=example,dc=com";
echo "\nDelete " . $dn;
ldap_delete($ds, $dn);
/* #### MOD ADD ### */
$dn = "cn=groupname,cn=groups,dc=example,dc=com";
echo "\nModAdd " . $dn;
$entry['memberuid'] = "username";
ldap_mod_add($ds, $dn, $entry);
/* #### MOD DELETE ### */
$dn = "cn=groupname,cn=groups,dc=example,dc=com";
echo "\nModDel " . $dn;
$entry['memberuid'] = "username";
ldap_mod_del($ds, $dn, $entry);
/* #### MOD REPLACE ### */
$dn = "cn=groupname,cn=groups,dc=example,dc=com";
echo "\nModReplace " . $dn;
$entry['memberuid'] = "username";
ldap_mod_replace($ds, $dn, $entry);
/* ### SEARCH ### */
$dn = "o=My Company, c=USs";
echo "\nSearch " . $dn;
$filter = "(|(sn=jeantet)(givenname=jeantet*))";
$justthese = array("ou", "sn", "givenname", "mail");
$cookie = 'cookie';
ldap_control_paged_result($ds, 23, true, $cookie);
$sr = ldap_search($ds, $dn, $filter, $justthese);
$info = ldap_get_entries($ds, $sr);
echo "\n\t" . $info["count"] . " entries returned";
开发者ID:postfix,项目名称:ldapserver,代码行数:31,代码来源:full.php

示例10: modDelete

 /**
  * Delete attribute values from current attributes.
  *
  * @param string $dn
  * @param array  $entry
  *
  * @return bool
  */
 public function modDelete($dn, array $entry)
 {
     if ($this->suppressErrors) {
         return @ldap_mod_del($this->getConnection(), $dn, $entry);
     }
     return ldap_mod_del($this->getConnection(), $dn, $entry);
 }
开发者ID:HarkiratGhotra,项目名称:application,代码行数:15,代码来源:Ldap.php

示例11: ldap_mod_del

                     $del[$attrmap["{$key}"]][] = $item_vals["{$key}"][$j];
                     $add_r[$attrmap["{$key}"]][] = $val;
                 } else {
                     $add_r[$attrmap["{$key}"]][] = $val;
                 }
             }
         }
     }
     if (isset($del)) {
         if ($config[ldap_debug] == 'true') {
             print "<b>DEBUG(LDAP): ldap_mod_del(): DN='{$dn}'</b><br>\n";
             print "<b>DEBUG(LDAP): ldap_mod_del(): Data:";
             print_r($del);
             print "</b><br>\n";
         }
         @ldap_mod_del($ds, $dn, $del);
     }
     if (isset($add_r)) {
         if ($config[ldap_debug] == 'true') {
             print "<b>DEBUG(LDAP): ldap_mod_add(): DN='{$dn}'</b><br>\n";
             print "<b>DEBUG(LDAP): ldap_mod_add(): Data:";
             print_r($add_r);
             print "</b><br>\n";
         }
         @ldap_mod_add($ds, $dn, $add_r);
     }
 }
 if (@ldap_error($ds) == 'Success') {
     echo "<b>The changes were successfully commited to the directory</b><br>\n";
 } else {
     echo "<b>LDAP ERROR: " . ldap_error($ds) . "</b><br>\n";
开发者ID:greendev5,项目名称:freeradius-server-wasel,代码行数:31,代码来源:change_attrs.php

示例12: print_r

        echo "&Auml;ndern: ";
        print_r($filemod);
        echo "<br>";
        if (ldap_mod_replace($ds, $pxeDN, $filemod)) {
            $mesg = "PXE Dateiname(n) erfolgreich ge&auml;ndert<br><br>";
        } else {
            $mesg = "Fehler beim &auml;ndern des(r) PXE Dateinamens!<br><br>";
        }
        $modfi = 0;
    }
    # dann löschen
    if ($delfi == 1) {
        echo "L&ouml;schen: ";
        print_r($filedel);
        echo "<br>";
        if (ldap_mod_del($ds, $pxeDN, $filedel)) {
            $mesg = "PXE Dateiname(n) erfolgreich gel&ouml;scht<br><br>";
        } else {
            $mesg = "Fehler beim l&ouml;schen des PXE Dateinamens !<br><br>";
        }
        $delfi = 0;
    }
}
# PXE Dateiname neu anlegen
if ($newfilename == "") {
}
if ($newfilename != "") {
    echo "PXE Dateiname hinzuf&uuml;gen";
    $fileadd['filename'] = $newfilename;
    if (ldap_mod_add($ds, $pxeDN, $fileadd)) {
        $mesg = "PXE Dateiname <b>" . $newfilename . "</b> erfolgreich angelegt<br><br>";
开发者ID:BackupTheBerlios,项目名称:openslx-svn,代码行数:31,代码来源:pxe_change.php

示例13: delMemberFromGroup

 function delMemberFromGroup($object_name, $uid)
 {
     $group_cn = "cn=" . $object_name . "," . $this->getLdapGroupDn();
     $members = $this->getLdapUserDn($uid);
     $group_info['member'] = $members;
     @ldap_mod_del($this->ldapResource, $group_cn, $group_info);
     if (@ldap_error($this->ldapResource) == "Success") {
         return true;
     } else {
         return false;
     }
 }
开发者ID:blestab,项目名称:frontaccounting,代码行数:12,代码来源:Ldap.php

示例14: group_del_user

 function group_del_user($group, $user)
 {
     //find the parent dn
     $group_info = $this->group_info($group, array("cn"));
     if ($group_info[0]["dn"] == NULL) {
         return false;
     }
     $group_dn = $group_info[0]["dn"];
     //find the child dn
     $user_info = $this->user_info($user, array("cn"));
     if ($user_info[0]["dn"] == NULL) {
         return false;
     }
     $user_dn = $user_info[0]["dn"];
     $del = array();
     $del["member"] = $user_dn;
     $result = @ldap_mod_del($this->_conn, $group_dn, $del);
     if ($result == false) {
         return false;
     }
     return true;
 }
开发者ID:jcorbinredtree,项目名称:framework,代码行数:22,代码来源:ActiveDirectory.php

示例15: array

echo "<br><b>RemoteBoot Dienst:</b> <br><br>";
for ($j = 0; $j < count($rbs); $j++) {
    $rbsadd = array();
    $rbsdel = array();
    $hostexp = ldap_explode_dn($hostDN[$j], 1);
    if ($rbs[$j] != $oldrbs[$j]) {
        echo "<b>{$hostexp['0']}</b> - ";
        $exp = ldap_explode_dn($rbs[$j], 1);
        $rbscn = $exp[0];
        $oldexp = ldap_explode_dn($oldrbs[$j], 1);
        $oldrbscn = $oldexp[0];
        if ($rbs[$j] == "") {
            $rbsdel['hlprbservice'] = array();
            $rbsdel['dhcpoptnext-server'] = array();
            $rbsdel['dhcpoptfilename'] = array();
            $result = ldap_mod_del($ds, $hostDN[$j], $rbsdel);
            if ($result) {
                echo "erfolgreich ausgetragen, alter Wert: <b>{$oldrbscn}</b> <br>";
            } else {
                echo "Fehler beim austragen aus Remote Boot Dienst <b>{$oldrbscn}</b> <br>";
            }
        } else {
            $rbsdhcpdata = get_node_data($rbs[$j], array("tftpserverip", "initbootfile"));
            $rbsadd['hlprbservice'] = $rbs[$j];
            $rbsadd['dhcpoptnext-server'] = $rbsdhcpdata['tftpserverip'];
            $rbsadd['dhcpoptfilename'] = $rbsdhcpdata['initbootfile'];
            if ($oldrbs[$j] == "") {
                $result = ldap_mod_add($ds, $hostDN[$j], $rbsadd);
                if ($result) {
                    echo "erfolgreich eingetragen: <b>{$rbscn}</b> (Next-Server: ";
                    print $rbsadd['dhcpoptnext-server'] . " / Filename: " . $rbsadd['dhcpoptfilename'] . ")<br>";
开发者ID:BackupTheBerlios,项目名称:openslx-svn,代码行数:31,代码来源:ip_rechner_change.php


注:本文中的ldap_mod_del函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。