mirror of
https://github.com/php/doc-ru.git
synced 2025-08-03 19:20:31 +00:00
302 lines
9.2 KiB
XML
302 lines
9.2 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
||
<!-- EN-Revision: b7cbd468cb4c46d55d43a44cade0eb4590d25dea Maintainer: rjhdby Status: ready -->
|
||
<!-- Reviewed: no -->
|
||
<refentry xml:id="function.ldap-modify-batch" xmlns="http://docbook.org/ns/docbook">
|
||
<refnamediv>
|
||
<refname>ldap_modify_batch</refname>
|
||
<refpurpose>Формирует и запускает пакетное изменение записи LDAP</refpurpose>
|
||
</refnamediv>
|
||
|
||
<refsect1 role="description">
|
||
&reftitle.description;
|
||
<methodsynopsis>
|
||
<type>bool</type><methodname>ldap_modify_batch</methodname>
|
||
<methodparam><type>LDAP\Connection</type><parameter>ldap</parameter></methodparam>
|
||
<methodparam><type>string</type><parameter>dn</parameter></methodparam>
|
||
<methodparam><type>array</type><parameter>modifications_info</parameter></methodparam>
|
||
<methodparam choice="opt"><type class="union"><type>array</type><type>null</type></type><parameter>controls</parameter><initializer>&null;</initializer></methodparam>
|
||
</methodsynopsis>
|
||
<para>
|
||
Функция модифицирует существующую запись в каталоге LDAP.
|
||
Функция даёт детально описать изменения.
|
||
</para>
|
||
</refsect1>
|
||
|
||
<refsect1 role="parameters">
|
||
&reftitle.parameters;
|
||
<para>
|
||
<variablelist>
|
||
<varlistentry>
|
||
<term><parameter>ldap</parameter></term>
|
||
<listitem>
|
||
<para>
|
||
&ldap.parameter.ldap;
|
||
</para>
|
||
</listitem>
|
||
</varlistentry>
|
||
<varlistentry>
|
||
<term><parameter>dn</parameter></term>
|
||
<listitem>
|
||
<para>
|
||
Уникальное имя объекта LDAP.
|
||
</para>
|
||
</listitem>
|
||
</varlistentry>
|
||
<varlistentry>
|
||
<term><parameter>modifications_info</parameter></term>
|
||
<listitem>
|
||
<para>
|
||
Массив, который описывает необходимую модификацию. Каждая запись этого
|
||
массива — ассоциативный массив с двумя или тремя ключами:
|
||
<literal>attrib</literal> задаёт имя атрибута для изменения,
|
||
<literal>modtype</literal> задаёт тип модификации
|
||
и (в зависимости от типа модификации) <literal>values</literal>
|
||
задаёт массив значений атрибутов, который соответствует этой модификации.
|
||
</para>
|
||
<para>
|
||
Допустимые значения для <literal>modtype</literal>:
|
||
<variablelist>
|
||
<varlistentry>
|
||
<term><constant>LDAP_MODIFY_BATCH_ADD</constant></term>
|
||
<listitem>
|
||
<para>
|
||
Каждое значение, которое задали в элементе <literal>values</literal>
|
||
будет добавлено (как дополнительное значение) к атрибуту <literal>attrib</literal>.
|
||
</para>
|
||
</listitem>
|
||
</varlistentry>
|
||
<varlistentry>
|
||
<term><constant>LDAP_MODIFY_BATCH_REMOVE</constant></term>
|
||
<listitem>
|
||
<para>
|
||
Каждое значение, которое задали в элементе <literal>values</literal>
|
||
будет удалено из атрибута, который задали в элементе <literal>attrib</literal>.
|
||
Ни одно значение, которое не указали в элементе <literal>values</literal>,
|
||
не будет затронуто.
|
||
</para>
|
||
</listitem>
|
||
</varlistentry>
|
||
<varlistentry>
|
||
<term><constant>LDAP_MODIFY_BATCH_REMOVE_ALL</constant></term>
|
||
<listitem>
|
||
<para>
|
||
Все значения будут удалены у атрибута <literal>attrib</literal>.
|
||
Параметр <literal>values</literal> не нужен.
|
||
</para>
|
||
</listitem>
|
||
</varlistentry>
|
||
<varlistentry>
|
||
<term><constant>LDAP_MODIFY_BATCH_REPLACE</constant></term>
|
||
<listitem>
|
||
<para>
|
||
Все существующие значения атрибута <literal>attrib</literal> будут заменены
|
||
значениями указанными в <literal>values</literal>.
|
||
</para>
|
||
</listitem>
|
||
</varlistentry>
|
||
</variablelist>
|
||
</para>
|
||
<para>
|
||
Обратите внимание, что все значения <literal>attrib</literal> должны быть строками,
|
||
все значения <literal>values</literal> должны быть массивами строк и
|
||
любые значения <literal>modtype</literal> должны быть одной из констант
|
||
LDAP_MODIFY_BATCH_*, перечисленных выше.
|
||
</para>
|
||
</listitem>
|
||
</varlistentry>
|
||
<varlistentry>
|
||
<term><parameter>controls</parameter></term>
|
||
<listitem>
|
||
<para>
|
||
Массив <link linkend="ldap.controls">управляющих объектов протокола LDAP</link> для отправки в запросе.
|
||
</para>
|
||
</listitem>
|
||
</varlistentry>
|
||
</variablelist>
|
||
</para>
|
||
</refsect1>
|
||
|
||
<refsect1 role="returnvalues">
|
||
&reftitle.returnvalues;
|
||
<para>
|
||
&return.success;
|
||
</para>
|
||
</refsect1>
|
||
|
||
<refsect1 role="changelog">
|
||
&reftitle.changelog;
|
||
<para>
|
||
<informaltable>
|
||
<tgroup cols="2">
|
||
<thead>
|
||
<row>
|
||
<entry>&Version;</entry>
|
||
<entry>&Description;</entry>
|
||
</row>
|
||
</thead>
|
||
<tbody>
|
||
&ldap.changelog.ldap-object;
|
||
&ldap.changelog.controls-nullable;
|
||
<row>
|
||
<entry>7.3.0</entry>
|
||
<entry>
|
||
Добавлена поддержка параметра <parameter>controls</parameter>.
|
||
</entry>
|
||
</row>
|
||
</tbody>
|
||
</tgroup>
|
||
</informaltable>
|
||
</para>
|
||
</refsect1>
|
||
|
||
<refsect1 role="examples">
|
||
&reftitle.examples;
|
||
<para>
|
||
<example>
|
||
<title>Добавление контакту телефонного номера</title>
|
||
<programlisting role="php">
|
||
<![CDATA[
|
||
<?php
|
||
|
||
$dn = "cn=John Smith,ou=Wizards,dc=example,dc=com";
|
||
$modifs = [
|
||
[
|
||
"attrib" => "telephoneNumber",
|
||
"modtype" => LDAP_MODIFY_BATCH_ADD,
|
||
"values" => ["+1 555 555 1717"],
|
||
],
|
||
];
|
||
ldap_modify_batch($connection, $dn, $modifs);
|
||
|
||
?>
|
||
]]>
|
||
</programlisting>
|
||
</example>
|
||
<example>
|
||
<title>Переименование пользователя</title>
|
||
<programlisting role="php">
|
||
<![CDATA[
|
||
<?php
|
||
|
||
$dn = "cn=John Smith,ou=Wizards,dc=example,dc=com";
|
||
$modifs = [
|
||
[
|
||
"attrib" => "sn",
|
||
"modtype" => LDAP_MODIFY_BATCH_REPLACE,
|
||
"values" => ["Smith-Jones"],
|
||
],
|
||
[
|
||
"attrib" => "givenName",
|
||
"modtype" => LDAP_MODIFY_BATCH_REPLACE,
|
||
"values" => ["Jack"],
|
||
],
|
||
];
|
||
ldap_modify_batch($connection, $dn, $modifs);
|
||
ldap_rename($connection, $dn, "cn=Jack Smith-Jones", NULL, TRUE);
|
||
|
||
?>
|
||
]]>
|
||
</programlisting>
|
||
</example>
|
||
<example>
|
||
<title>Добавление пользователю двух e-mail адресов</title>
|
||
<programlisting role="php">
|
||
<![CDATA[
|
||
<?php
|
||
|
||
$dn = "cn=Jack Smith-Jones,ou=Wizards,dc=example,dc=com";
|
||
$modifs = [
|
||
[
|
||
"attrib" => "mail",
|
||
"modtype" => LDAP_MODIFY_BATCH_ADD,
|
||
"values" => [
|
||
"jack.smith@example.com",
|
||
"jack.smith-jones@example.com",
|
||
],
|
||
],
|
||
];
|
||
ldap_modify_batch($connection, $dn, $modifs);
|
||
|
||
?>
|
||
]]>
|
||
</programlisting>
|
||
</example>
|
||
<example>
|
||
<title>Изменение пароля пользователя</title>
|
||
<programlisting role="php">
|
||
<![CDATA[
|
||
<?php
|
||
|
||
$dn = "cn=Jack Smith-Jones,ou=Wizards,dc=example,dc=com";
|
||
$modifs = [
|
||
[
|
||
"attrib" => "userPassword",
|
||
"modtype" => LDAP_MODIFY_BATCH_REMOVE,
|
||
"values" => ["Tr0ub4dor&3"],
|
||
],
|
||
[
|
||
"attrib" => "userPassword",
|
||
"modtype" => LDAP_MODIFY_BATCH_ADD,
|
||
"values" => ["correct horse battery staple"],
|
||
],
|
||
];
|
||
ldap_modify_batch($connection, $dn, $modifs);
|
||
|
||
?>
|
||
]]>
|
||
</programlisting>
|
||
</example>
|
||
<example>
|
||
<title>Изменение пароля пользователя (Active Directory)</title>
|
||
<programlisting role="php">
|
||
<![CDATA[
|
||
<?php
|
||
|
||
function adifyPw($pw)
|
||
{
|
||
return iconv("UTF-8", "UTF-16LE", '"' . $pw . '"');
|
||
}
|
||
|
||
$dn = "cn=Jack Smith-Jones,ou=Wizards,dc=ad,dc=example,dc=com";
|
||
$modifs = [
|
||
[
|
||
"attrib" => "unicodePwd",
|
||
"modtype" => LDAP_MODIFY_BATCH_REMOVE,
|
||
"values" => [adifyPw("Tr0ub4dor&3")],
|
||
],
|
||
[
|
||
"attrib" => "unicodePwd",
|
||
"modtype" => LDAP_MODIFY_BATCH_ADD,
|
||
"values" => [adifyPw("correct horse battery staple")],
|
||
],
|
||
];
|
||
ldap_modify_batch($connection, $dn, $modifs);
|
||
|
||
?>
|
||
]]>
|
||
</programlisting>
|
||
</example>
|
||
</para>
|
||
</refsect1>
|
||
</refentry>
|
||
<!-- Keep this comment at the end of the file
|
||
Local variables:
|
||
mode: sgml
|
||
sgml-omittag:t
|
||
sgml-shorttag:t
|
||
sgml-minimize-attributes:nil
|
||
sgml-always-quote-attributes:t
|
||
sgml-indent-step:1
|
||
sgml-indent-data:t
|
||
indent-tabs-mode:nil
|
||
sgml-parent-document:nil
|
||
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
|
||
sgml-exposed-tags:nil
|
||
sgml-local-catalogs:nil
|
||
sgml-local-ecat-files:nil
|
||
End:
|
||
vim600: syn=xml fen fdm=syntax fdl=2 si
|
||
vim: et tw=78 syn=sgml
|
||
vi: ts=1 sw=1
|
||
-->
|