what is the best practice to modrdn for branch of objects?

"Zeus Panchenko" <[email protected]> Mon, 18 Jun 2018 14:33:59 +0300
Newsgroups gmane.comp.lang.perl.modules.ldap
Organization I.B.S. LLC
Message-ID <[email protected]>
=2D----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

hi

what is the best practice to moddn() for branch of objects?

lets say we have two objects:

=2D ---[ user A start ]-------------------------------------------
dn: uid=3Dnaf.nafus,ou=3DPeople,dc=3Dumidb
dn: [email protected],uid=3Dnaf.nafus,ou=3DPeople,dc=
=3Dumidb
dn: [email protected],[email protected],uid=
=3Dnaf.nafus,ou=3DPeople,dc=3Dumidb
dn: [email protected],uid=3Dnaf.nafus,ou=3DPeople,d=
c=3Dumidb
dn: cn=3Ddev-ap-notebook,[email protected],uid=3Dna=
f.nafus,ou=3DPeople,dc=3Dumidb
dn: [email protected],uid=3Dnaf.nafus,ou=3DPeo=
ple,dc=3Dumidb
dn: [email protected],authorizedService=3Dmail@starflee=
t.startrek.in,uid=3Dnaf.nafus,ou=3DPeople,dc=3Dumidb
dn: [email protected],uid=3Dnaf.nafus,ou=3DPeo=
ple,dc=3Dumidb
dn: [email protected],authorizedService=3Dxmpp@starfle=
et.startrek.in,uid=3Dnaf.nafus,ou=3DPeople,dc=3Dumidb
=2D ---[ user A end   ]-------------------------------------------

and

=2D ---[ user B start ]-------------------------------------------
dn: uid=3Dtaf.taffij,ou=3DPeople,dc=3Dumidb
=2D ---[ user B end   ]-------------------------------------------


now, I want to =E2=80=9Ereassign=E2=80=9C user A branch (and all of it's le=
aves) to user B
=2D ---[ user A branch to reassign start ]---------------------------------=
----------
dn: [email protected],uid=3Dnaf.nafus,ou=3DPeo=
ple,dc=3Dumidb
dn: [email protected],authorizedService=3Dxmpp@starfle=
et.startrek.in,uid=3Dnaf.nafus,ou=3DPeople,dc=3Dumidb
=2D ---[ user A branch to reassign end   ]---------------------------------=
----------


so, user B becomes
=2D ---[ =E2=80=9Enew=E2=80=9C user B start ]------------------------------=
-------------
dn: uid=3Dtaf.taffij,ou=3DPeople,dc=3Dumidb
dn: [email protected],uid=3Dtaf.taffij,ou=3DPe=
ople,dc=3Dumidb
dn: [email protected],authorizedService=3Dxmpp@starfle=
et.startrek.in,uid=3Dtaf.taffij,ou=3DPeople,dc=3Dumidb
=2D ---[ =E2=80=9Enew=E2=80=9C user B end   ]------------------------------=
-------------

to do that, I take target branch subtree and =E2=80=9Ere-write=E2=80=9C DN =
of each object to be reassigned ...
(https://github.com/z-eos/umi/blob/master/lib/LDAP_CRUD.pm#L992)


what I think of is something like this:

=2D ---[ quotation start ]-------------------------------------------
$dn =3D '[email protected],uid=3Dnaf.nafus,ou=
=3DPeople,dc=3Dumidb';
$mesg =3D $ldap->moddn( $dn,
                      newsuperior =3D> 'uid=3Dtaf.taffij,ou=3DPeople,dc=3Du=
midb',
                      recursively =3D> 1 );
=2D ---[ quotation end   ]-------------------------------------------


=2D --=20
Zeus V. Panchenko				jid:[email protected]
IT Dpt., I.B.S. LLC					  GMT+2 (EET)
=2D----BEGIN PGP SIGNATURE-----

iF0EARECAB0WIQQYIXL6FUmD7SUfqoOveOk+D/ejKgUCWyeYpwAKCRCveOk+D/ej
KrMyAJ9pkQ5HzEX1iIGBI8WNJDKpKEMiOgCg1UtQBvbNIwuPEZAMIyutWi5E690=3D
=3DS2qO
=2D----END PGP SIGNATURE-----