Softerra LDAP Administrator HelpShow AllHide All

MODDN Statement

The MODDN statement is used to move or rename LDAP entries.

Syntax

For moving or renaming one LDAP entry

MODDN entry-DN [NEWRDN new-RDN | {SET|ADD|DELETE} (attr-name=attr-value[, ...])] 
[NEWSUPERIOR new-superior-DN] [DELETEOLDRDN yes|no]

For bulk move or rename of entries matching the specific criteria.

MODDN FROM base-DN [NEWRDN new-RDN | {SET|ADD|DELETE} (attr-name=attr-value[, ...])] 
    [NEWSUPERIOR new-superior-DN] [DELETEOLDRDN yes|no] [WHERE where-clause]     
    [SCOPE search-scope] [REFERRALS true|false] [PAGESIZE size-num]

MODDN keywords

KeywordDescription
MODDN Defines DN of the entry, which will be moved or renamed.
NEWRDN Specify the new RDN for the entry.
(SET | ADD | DELETE) Defines RDN modification operation.
SET - updates RDN of the entry.
ADD - adds a new attribute to RDN of the entry.
DELETE - deletes an attribute from RDN of the entry.
NEWSUPERIOR Specify the DN of the new superior entry under which the moved or renamed entry will be relocated
DELETEOLDRDN Defines whether to keep the original entry in the directory or to delete it. Possible values are YES and NO.
FROM Defines the base-DN of the entry, starting from which the search for the entries to be moved or renamed will be run.
WHERE An optional keyword. Defines the query filter of elements to be moved or renamed. If not specified, all entries will be processed.
SCOPE An optional keyword. Defines the search scope of entries to be moved or renamed. Can be ONELEVEL, SUBTREE, and BASE. Use ONELEVEL to search only the immediate children of the base-DN entry, SUBTREE to search the base-DN entry and all of its descendants, and BASE to search only the base-DN entry. If not defined, the scope value for the statement is SUBTREE.
REFERRALS An optional keyword used to define whether to process entries in referrals. Possible values are TRUE and FALSE. If not defined, referrals are not handled.
PAGESIZE An optional keyword used to define the number of entries to be returned per one search request. For more details refer to the Paging Overview section. If this parameter is not defined, the size-num is 200.

Examples of MODDN statements

Rename user CN=John Taylor,DC=company.

MODDN "CN=John Taylor,CN=company" NEWRDN $cn='John White';

Creating multi-valued rdn for user CN=John Smith,DC=company by adding uid attribute to it's RDN.

MODDN "CN=John Smith,CN=company" ADD $uid="jsmith";

Move user CN=Rayan Clark,OU=California,DC=company to the differnt OU.

MODDN "CN=Rayan Clark,OU=HR,DC=company" NEWSUPERIOR "OU=Marketing,DC=company";

Move all users created during the last month to the new OU.

MODDN FROM "OU=HR,DC=company" NEWSUPERIOR "OU=Sales,DC=company"
WHERE $whenCreated  > CURRENT_DATE - interval '1 month'
    AND $objectClass='user' AND $objectCategory='Person'
SCOPE ONELEVEL;