本文整理汇总了PHP中ldap_delete函数的典型用法代码示例。如果您正苦于以下问题:PHP ldap_delete函数的具体用法?PHP ldap_delete怎么用?PHP ldap_delete使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ldap_delete函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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)));
}
}
开发者ID:Ener-Getick,项目名称:symfony,代码行数:10,代码来源:EntryManager.php
示例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;
}
开发者ID:honda-kyoto,项目名称:UMS-Kyoto,代码行数:30,代码来源:guests_regist_common_mgr.class.php
示例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;
}
开发者ID:AugustinBrocquet,项目名称:Cartopli,代码行数:15,代码来源:adLDAPFolders.php
示例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;
}
开发者ID:CREASIG,项目名称:lizmap-web-client,代码行数:10,代码来源:ldap.auth.php
示例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;
}
开发者ID:CasaDosMeninos,项目名称:login-unico,代码行数:12,代码来源:User.php
示例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;
}
开发者ID:hadrienl,项目名称:jelix,代码行数:12,代码来源:ldap.auth.php
示例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;
}
开发者ID:alienpham,项目名称:helenekling,代码行数:14,代码来源:ldap.auth.php
示例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;
}
开发者ID:awasthi,项目名称:aguilas,代码行数:14,代码来源:Functions.inc.php
示例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);
}
}
开发者ID:roquebrasilia,项目名称:sgdoc-codigo,代码行数:22,代码来源:LDAP.php
示例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);
}
}
开发者ID:Evolix,项目名称:evoadmin-mail,代码行数:20,代码来源:Ldap.php
示例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);
}
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:21,代码来源:cron.endoflife.php
示例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') {
//.........这里部分代码省略.........
开发者ID:altesien,项目名称:FinalProject,代码行数:101,代码来源:ldap.php
示例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;
}
开发者ID:Samara94,项目名称:dolibarr,代码行数:28,代码来源:ldap.class.php
示例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);
开发者ID:badlamer,项目名称:hhvm,代码行数:20,代码来源:ldap_parse_reference_basic.php
示例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;
}
开发者ID:afterlogic,项目名称:aurora-core,代码行数:13,代码来源:ldap.php
示例16: delete
/**
* Deletes a given DN from the tree
*
* @param string $dn The DN of the object you want to delete
*
* @return boolean Result of operation
*
* @since 12.1
*/
public function delete($dn)
{
return @ldap_delete($this->_resource, $dn);
}
开发者ID:WineWorld,项目名称:joomlatrialcmbg,代码行数:13,代码来源:ldap.php
示例17: delete
/**
* Perform an LDAP delete.
*
* @param string $dn
*
* @return boolean result per ldap_delete
*/
public function delete($dn)
{
if (!$this->connection) {
$this->connect();
$this->bind();
}
$result = @ldap_delete($this->connection, $dn);
if (!$result) {
$error = "LDAP Server delete(%dn) in LdapServer::delete() Error Server ID = %sid, LDAP Err No: %ldap_errno LDAP Err Message: %ldap_err2str ";
$tokens = array('%dn' => $dn, '%sid' => $this->sid, '%ldap_errno' => ldap_errno($this->connection), '%ldap_err2str' => ldap_err2str(ldap_errno($this->connection)));
watchdog('ldap_server', $error, $tokens, WATCHDOG_ERROR);
}
return $result;
}
开发者ID:tierce,项目名称:ppbe,代码行数:21,代码来源:LdapServer.class.php
示例18: delete
/**
* Deletes an entry on the current LDAP directory.
*
* @param string $dn
*
* @return bool
*/
public function delete($dn)
{
if ($this->suppressErrors) {
return @ldap_delete($this->getConnection(), $dn);
}
return ldap_delete($this->getConnection(), $dn);
}
开发者ID:HarkiratGhotra,项目名称:application,代码行数:14,代码来源:Ldap.php
示例19: ldap_connect_and_bind
<?php
require "connect.inc";
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
insert_dummy_data($link, $base);
ldap_add($link, "cn=userref,$base", array(
"objectClass" => array("extensibleObject", "referral"),
"cn" => "userref",
"ref" => "cn=userA,$base",
));
ldap_set_option($link, LDAP_OPT_DEREF, LDAP_DEREF_NEVER);
$result = ldap_search($link, "$base", "(cn=*)");
var_dump($ref = ldap_first_reference($link, $result));
$refs = null;
ldap_parse_reference($link, $ref, $refs);
var_dump($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,$base");
remove_dummy_data($link, $base);
?>
开发者ID:sskblr,项目名称:hhvm,代码行数:26,代码来源:ldap_first_reference_basic.php
示例20: delete
/**
* Deletes an entry from the directory.
*
* @param string|Horde_Ldap_Entry $dn DN string or Horde_Ldap_Entry.
* @param boolean $recursive Should we delete all children
* recursivelx as well?
* @throws Horde_Ldap_Exception
*/
public function delete($dn, $recursive = false)
{
if ($dn instanceof Horde_Ldap_Entry) {
$dn = $dn->dn();
}
if (!is_string($dn)) {
throw new Horde_Ldap_Exception('Parameter is not a string nor an entry object!');
}
/* Recursive delete searches for children and calls delete for them. */
if ($recursive) {
$result = @ldap_list($this->_link, $dn, '(objectClass=*)', array(null), 0, 0);
if ($result && @ldap_count_entries($this->_link, $result)) {
for ($subentry = @ldap_first_entry($this->_link, $result); $subentry; $subentry = @ldap_next_entry($this->_link, $subentry)) {
$this->delete(@ldap_get_dn($this->_link, $subentry), true);
}
}
}
/* Continue the delete operation in a loop until we get a success, or a
* definitive failure. */
while (true) {
$link = $this->getLink();
if (!$link) {
/* We do not have a successful connection yet. The call to
* getLink() would have kept trying if we wanted one. */
throw new Horde_Ldap_Exception('Could not add entry ' . $dn . ' no valid LDAP connection could be found.');
}
$s = @ldap_delete($link, $dn);
if ($s) {
/* Entry successfully deleted. */
return;
}
/* We have a failure. What kind? We may be able to reconnect and
* try again. */
$error_code = @ldap_errno($link);
if ($this->errorName($error_code) == 'LDAP_OPERATIONS_ERROR' && $this->_config['auto_reconnect']) {
/* The server has disconnected before trying the operation. We
* should try again, possibly with a different server. */
$this->_link = false;
$this->_reconnect();
} elseif ($this->errorName($error_code) == 'LDAP_NOT_ALLOWED_ON_NONLEAF') {
/* Subentries present, server refused to delete.
* Deleting subentries is the clients responsibility, but since
* the user may not know of the subentries, we do not force
* that here but instead notify the developer so he may take
* actions himself. */
throw new Horde_Ldap_Exception('Could not delete entry ' . $dn . ' because of subentries. Use the recursive parameter to delete them.', $error_code);
} else {
/* Errors other than the above catched are just passed back to
* the user so he may react upon them. */
throw new Horde_Ldap_Exception('Could not delete entry ' . $dn . ': ' . ldap_err2str($error_code), $error_code);
}
}
}
开发者ID:jubinpatel,项目名称:horde,代码行数:61,代码来源:Ldap.php
注:本文中的ldap_delete函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论