PHP.mk документација

ldap_rename

Почист и полокален преглед на PHP референцата, со задржана структура од PHP.net и подобра читливост за примери, секции и белешки.

function.ldap-rename.php PHP.net прокси Преводот се освежува
Оригинал на PHP.net
Патека function.ldap-rename.php Локална патека за оваа страница.
Извор php.net/manual/en Оригиналниот HTML се реупотребува и локално се стилизира.
Режим Прокси + превод во позадина Кодовите, табелите и белешките остануваат читливи во истиот тек.
ldap_rename

Референца за `function.ldap-rename.php` со подобрена типографија и навигација.

function.ldap-rename.php

ldap_rename

(PHP 4 >= 4.0.5, PHP 5, PHP 7, PHP 8)

ldap_rename(PHP 4 >= 4.0.5, PHP 5, PHP 7, PHP 8)

= NULL

ldap_rename(
         LDAP\Connection $ldap,
         string $dn,
         string $new_rdn,
         string $new_parent,
         bool $delete_old_rdn,
         ?array $controls = null
): bool

Измени го името на записот dn Записот определен од

Параметри

ldap

Еден LDAP\Connection инстанца, вратена од ldap_connect().

dn

. Може исто така да додава или отстранува атрибути.

new_rdn

се преименува/преместува.

new_parent

Новиот RDN.

delete_old_rdn

Враќа true Новиот родител/супериорен запис.

controls

Низа од LDAP контроли сега е nullable; претходно, стандардно беше

Вратени вредности

Патеката до PHP скриптата што треба да се провери. true на успех или false при неуспех.

Дневник на промени

Верзија = NULL
8.1.0 На ldap параметарот очекува LDAP\Connection инстанца сега; претходно, валидна ldap link resource се очекуваше.
8.0.0 controls Пример #1 LDAP пребарување [].
7.3.0 Поддршка за controls added

Белешки

Забелешка:

старата вредност на RDN се отстранува, инаку старата вредност на RDN се задржува како не-дистинктивна вредност на записот. ldap_set_option() Оваа функција моментално работи само со LDAPv3. Можеби ќе треба да користите

Види Исто така

  • ldap_rename_ext() пред поврзувањето за да користите LDAPv3. Оваа функција е достапна само кога користите OpenLDAP 2.x.x ИЛИ Netscape Directory SDK x.x.
  • ldap_modify() - Измени го името на записот

Белешки од корисници 9 белешки

- Псевдоним на ldap_mod_replace
пред 22 години
ldap_rename can only move leaf nodes of the directory tree. If your ldap entry has any child entries, then ldap_rename is not the tool that you need. We needed to change usernames, but that alters the dn. ldap_rename wouldn't work because each of our user ldap entries has a couple associated child entries. We had to write a function to recursively copy the subtree to the new location, and then delete the original version. Here is the basic algorithm:

function recursive_move($old_username, $new_username)
    ldap_search on the old username to get the correct entry
    ldap_get_attributes to get an array of values from the ldap entry
    foreach attribute in array, replace occurences of $old_username with $new_username
    ldap_add the attribute array into the new location
    ldap_modify any additional attributes
    ldap_list each child entry
    call function recursive_move on each child
    ldap_delete current entry
    return
Richard Esplin
21 години пред
Since this function isn't documented to well I thought I'd help out those trying to get this to work.

<?php
// $dn is the full DN of the entry you wish to move
$dn = 'cn=user1,ou=group1,dc=mydomain';
/*
    note that $newRdn IS NOT a full DN, it is only the start
    I've NOT gotten it to change attributes for the RDN
    but that could just be my schema
*/
$newRdn = 'cn=user2';
// $newparent IS the full DN to the NEW parent DN that you want to move/rename to
$newParent = 'ou=group2,dc=mydomain';
ldap_rename($link, $dn, $newRdn, $newParent, true);
?>

Like I said above I haven't been able to get it to rename to a DIFFERENT attribute so deleteoldrdn has no affect on it.
Viper_SB at NOSPAMyahoo dot com
пред 17 години
Here's some clarification about the parameters when renaming a container in Novell eDirectory:
- $new_rdn is in format "ou=new container name"
- newparent parameter is NULL - because we're renaming and not moving
- deleteoldrdn parameter if TRUE then old value of OU attribute is stored as a secondary/further value of LDAP OU attribute. Novell ConsoleOne shows it as 'Other Name' attribute.

$full_old_dn= "ou=Cuckoo,ou=London,ou=UK,ou=Europe,o=Happy";
$new_rdn= "ou=Cuckoo Group";
    
ldap_rename( $conn, $full_old_dn, $new_rdn, NULL, TRUE);
Peter Kehl
20 години пред
Contrary to Richard Esplin's statement, this *is* the correct function to use for renaming subtrees and moving entries from one place in the tree to another. Just that most LDAP server implementations don't support moving non-leaf entries.

E.g. In OpenLDAP, moving a non-leaf entry is only supported when using the back-hdb database backend. SunOne only has one database backend, and it apparently doesn't handle this type of operation.
hyc at openldap dot org
пред 18 години
Though clearly mentioned, the following had me in spin for a good 10 minutes.

Ensure: 

if (!ldap_set_option($conn, LDAP_OPT_PROTOCOL_VERSION, 3)) {
   // do something horrible
}

has been set _before_ you actually bind :)
backports at gmail dot com
21 години пред
If you are using Sun Directory Server 5.2, please note that you can't use ldap_rename to move an entry. According to Sun's own documentation: "[...] At this point in time, Directory Server does not support the ability to use the modify DN operation to move an entry from one location in the directory tree to another location." (http://docs.sun.com/source/817-6707/resultcodes.html)
The problem is that php does not return any error and the operation seems to complete succesfully, except for the fact that nothing really happens. If you check the server logs, there will be an "error 53" entry (server is unwilling to perform). 
hope this saves someone's couple of hours nasty searching...
unroar на gmail dot com
пред 23 години
Works also with eDirectory 8 (NW6).

If you are moving a user, remember that you also change the uid!
Анонимен
пред 23 години
To get this function working make sure that the value for $newrdn is relative.
venakis at ccf dot auth dot gr
пред 11 години
A thing to remember when using ldap_rename or any other method that is not doing just renaming but creating a new parent and moving children is that you'll loose your original entryUUID!
We wanted to do a local DB mapping for LDAP->DB user groups thinking that it would be the most stable resource identifier only to find out we were absolutely wrong.
На оваа страница

Автоматски outline од активната документација.

Насловите ќе се појават тука по вчитување.

Попрегледно читање

Примерите, changelog табелите и user notes се визуелно издвоени за да не се губат во долгата содржина.

Брз совет Користи го outline-от Скокни директно на главните секции од активната страница.
Извор Оригиналниот линк останува достапен Кога ти треба целосен upstream context, отвори го PHP.net во нов tab.