本文整理汇总了PHP中ldap_delete函数的典型用法代码示例。如果您正苦于以下问题:PHP ldap_delete函数的具体用法?PHP ldap_delete怎么用?PHP ldap_delete使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ldap_delete函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: remove
/**
* {@inheritdoc}
*/
public function remove(Entry $entry)
{
$con = $this->connection->getResource();
if (!@ldap_delete($con, $entry->getDn())) {
throw new LdapException(sprintf('Could not remove entry "%s": %s', $entry->getDn(), ldap_error($con)));
}
}
示例2: deleteAd
function deleteAd($wireless_id)
{
if (!defined("LDAP_HOST_1")) {
return true;
}
//接続開始
$ldap_conn = ldap_connect(LDAP_HOST_1, LDAP_PORT);
if (!$ldap_conn) {
$ldap_conn = ldap_connect(LDAP_HOST_2, LDAP_PORT);
}
if (!$ldap_conn) {
Debug_Trace("接続失敗", 9);
return false;
}
// バインド
$ldap_bind = ldap_bind($ldap_conn, LDAP_DN, LDAP_PASS);
if (!$ldap_bind) {
Debug_Trace("バインド失敗", 9);
return false;
}
// 削除
$userDn = "CN=" . $wireless_id . "," . WLESS_ID_DN;
if (ldap_delete($ldap_conn, $userDn)) {
Debug_Trace("削除は成功しました", 952);
} else {
Debug_Trace("削除は失敗しました", 952);
return false;
}
return true;
}
示例3: delete
/**
* Delete a distinguished name from Active Directory
* You should never need to call this yourself, just use the wrapper functions user_delete and contact_delete
*
* @param string $dn The distinguished name to delete
* @return bool
*/
public function delete($dn)
{
$result = ldap_delete($this->adldap->getLdapConnection(), $dn);
if ($result != true) {
return false;
}
return true;
}
示例4: removeUser
public function removeUser($login)
{
$connect = $this->_bindLdapUser();
if ($connect === false) {
return false;
}
$result = ldap_delete($connect, $this->_buildUserDn($login));
ldap_close($connect);
return $result;
}
示例5: deleta
public static function deleta($email)
{
$ldap = app('ldap');
$base_dn = env('LDAP_BASE_DN');
$dn = "uid={$email},ou=People,{$base_dn}";
$success = ldap_delete($ldap, $dn);
ldap_close($ldap);
if (!$success) {
throw new Exception('Erro ao deletar usuario');
}
return $success;
}
示例6: removeUser
public function removeUser($login)
{
$connect = $this->_getLinkId();
$result = false;
if ($connect) {
if (ldap_bind($connect, $this->_params['ldapUser'], $this->_params['ldapPassword'])) {
$result = ldap_delete($connect, $this->_buildUserDn($user->login));
}
ldap_close($connect);
}
return $result;
}
示例7: removeUser
public function removeUser($login)
{
$connect = ldap_connect($this->_params['hostname'], $this->_params['port']);
$result = false;
if ($connect) {
ldap_set_option($connect, LDAP_OPT_PROTOCOL_VERSION, 3);
ldap_set_option($connect, LDAP_OPT_REFERRALS, 0);
if (ldap_bind($connect, $this->_params['ldapUser'], $this->_params['ldapPassword'])) {
$result = ldap_delete($connect, 'cn=' . $user->login . ',' . $this->_params['searchBaseDN']);
}
ldap_close($connect);
}
return $result;
}
示例8: AssistedLDAPDelete
function AssistedLDAPDelete($ldapc, $dn)
{
// Use these variables that are outside the function
global $app_theme;
// Delete the entry
$r_del = ldap_delete($ldapc, $dn);
// Let's see if you could make it
if (!$r_del) {
echo '<div class="error">' . _("An error has ocurred trying to delete entries on the LDAP database: ") . ldap_error($ldapc) . '.<br /><br /><a href="javascript:history.back(1);">' . _("Back") . '</a></div>';
include "../themes/{$app_theme}/footer.php";
die;
}
return $r_del;
}
示例9: deleteRecord
/**
* @return boolean
* @param ResourceBundle $connection
* @param string $connection
* @param boolean $recursive
*/
public function deleteRecord($connection, $dn, $recursive = false)
{
if ($recursive == false) {
return ldap_delete($connection, $dn);
} else {
$sr = ldap_list($connection, $dn, "ObjectClass=*", array(""));
$info = ldap_get_entries($connection, $sr);
for ($i = 0; $i < $info['count']; $i++) {
$result = myldap_delete($connection, $info[$i]['dn'], $recursive);
if (!$result) {
return $result;
}
}
return ldap_delete($connection, $dn);
}
}
示例10: lda_del
/**
* suppression d'entrees OpenLDAP
* recursivite possible
*/
function lda_del($ldapconn, $dn, $recursive = FALSE)
{
if ($recursive == FALSE) {
return ldap_delete($ldapconn, $dn);
} else {
$sr = ldap_list($ldapconn, $dn, "ObjectClass=*");
$info = ldap_get_entries($ldapconn, $sr);
for ($i = 0; $i < $info['count']; $i++) {
$result = lda_del($ldapconn, $info[$i]['dn'], $recursive);
if (!$result) {
return $result;
}
}
return ldap_delete($ldapconn, $dn);
}
}
示例11: delete_ldap
function delete_ldap($dn, $connect, $recursive = false)
{
if ($recursive == false) {
if (!@ldap_delete($connect, $dn)) {
echo "Deleting {$dn}...\n";
echo "ERROR: ldap_delete \"{$dn}\"" . ldap_err2str(ldap_errno($connect)) . "\n";
return false;
}
}
$sr = @ldap_list($connect, $dn, "ObjectClass=*");
if ($sr) {
$info = @ldap_get_entries($connect, $sr);
for ($i = 0; $i < $info['count']; $i++) {
$result = delete_ldap($info[$i]['dn'], $connect, $recursive);
if (!$result) {
return $result;
}
}
return delete_ldap($dn, $connect, false);
}
}
示例12: simpleQuery
/**
* Performs a request against the LDAP server
*
* The type of request (and the corresponding PHP ldap function called)
* depend on two additional parameters, added in respect to the
* DB_common interface.
*
* @param string $filter text of the request to send to the LDAP server
* @param string $action type of request to perform, defaults to search (ldap_search())
* @param array $params array of additional parameters to pass to the PHP ldap function requested
* @return result from ldap function or DB Error object if no result
*/
function simpleQuery($filter, $action = null, $params = null)
{
if ($action === null) {
$action = !empty($this->q_action) ? $this->q_action : $this->action;
}
if ($params === null) {
$params = count($this->q_params) > 0 ? $this->q_params : array();
}
if (!$this->isManip($action)) {
$base = $this->q_base ? $this->q_base : $this->base;
$attributes = array();
$attrsonly = 0;
$sizelimit = 0;
$timelimit = 0;
$deref = LDAP_DEREF_NEVER;
$sorting = '';
$sorting_method = '';
reset($params);
while (list($k, $v) = each($params)) {
if (isset(${$k})) {
${$k} = $v;
}
}
$this->sorting = $sorting;
$this->sorting_method = $sorting_method;
$this->attributes = $attributes;
# double escape char for filter: '(o=Przedsi\C4\99biorstwo)' => '(o=Przedsi\\C4\\99biorstwo)'
$filter = str_replace('\\', '\\\\', $filter);
$this->last_query = $filter;
if ($action == 'search') {
$result = @ldap_search($this->connection, $base, $filter, $attributes, $attrsonly, $sizelimit, $timelimit, $deref);
} else {
if ($action == 'list') {
$result = @ldap_list($this->connection, $base, $filter, $attributes, $attrsonly, $sizelimit, $timelimit, $deref);
} else {
if ($action == 'read') {
$result = @ldap_read($this->connection, $base, $filter, $attributes, $attrsonly, $sizelimit, $timelimit, $deref);
} else {
return $this->ldapRaiseError(DB_ERROR_UNKNOWN_LDAP_ACTION);
}
}
}
if (!$result) {
return $this->ldapRaiseError();
}
} else {
# If first argument is an array, it contains the entry with DN.
if (is_array($filter)) {
$entry = $filter;
$filter = $entry["dn"];
} else {
$entry = array();
}
unset($entry["dn"]);
$attribute = '';
$value = '';
$newrdn = '';
$newparent = '';
$deleteoldrdn = false;
reset($params);
while (list($k, $v) = each($params)) {
if (isset(${$k})) {
${$k} = $v;
}
}
$this->last_query = $filter;
if ($action == 'add') {
$result = @ldap_add($this->connection, $filter, $entry);
} else {
if ($action == 'compare') {
$result = @ldap_add($this->connection, $filter, $attribute, $value);
} else {
if ($action == 'delete') {
$result = @ldap_delete($this->connection, $filter);
} else {
if ($action == 'modify') {
$result = @ldap_modify($this->connection, $filter, $entry);
} else {
if ($action == 'mod_add') {
$result = @ldap_mod_add($this->connection, $filter, $entry);
} else {
if ($action == 'mod_del') {
$result = @ldap_mod_del($this->connection, $filter, $entry);
} else {
if ($action == 'mod_replace') {
$result = @ldap_mod_replace($this->connection, $filter, $entry);
} else {
if ($action == 'rename') {
//.........这里部分代码省略.........
示例13: delete
/**
* Delete a LDAP entry
* Ldap object connect and bind must have been done
*
* @param string $dn DN entry key
* @return int <0 if KO, >0 if OK
*/
function delete($dn)
{
global $conf;
dol_syslog(get_class($this) . "::delete Delete LDAP entry dn=" . $dn);
// 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);
$result = @ldap_delete($this->connection, $dn);
if ($result) {
return 1;
}
return -1;
}
示例14: ldap_connect_and_bind
<?php
require "connect.inc";
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
insert_dummy_data($link);
ldap_add($link, "cn=userref,dc=my-domain,dc=com", array("objectClass" => array("extensibleObject", "referral"), "cn" => "userref", "ref" => "cn=userA,dc=my-domain,dc=com"));
ldap_set_option($link, LDAP_OPT_DEREF, LDAP_DEREF_NEVER);
$result = ldap_search($link, "dc=my-domain,dc=com", "(cn=*)");
$ref = ldap_first_reference($link, $result);
$refs = null;
var_dump(ldap_parse_reference($link, $ref, $refs), $refs);
?>
===DONE===
<?php
include "connect.inc";
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
// Referral can only be removed with Manage DSA IT Control
ldap_set_option($link, LDAP_OPT_SERVER_CONTROLS, array(array("oid" => "2.16.840.1.113730.3.4.2")));
ldap_delete($link, "cn=userref,dc=my-domain,dc=com");
remove_dummy_data($link);
示例15: Delete
/**
* @return bool
*/
public function Delete($sDeleteDn)
{
$bResult = false;
if (!empty($sDeleteDn)) {
CApi::Log('ldap_delete = ' . ($sDeleteDn . ',' . $this->sSearchDN));
$bResult = !!@ldap_delete($this->rLink, $sDeleteDn . ',' . $this->sSearchDN);
$this->validateLdapErrorOnFalse($bResult);
}
return $bResult;
}