Softerra LDAP Administrator HelpShow AllHide All

UPDATE Statement

The UPDATE statement is used to add, remove and modify values of LDAP attributes. This statement can be used to modify one or more entries meeting the specific conditions.

Syntax

UPDATE base-DN {SET|ADD|DELETE} (attr-name=attr-value[, ...]) [WHERE where-clause] 
    [SCOPE search-scope] [REFERRALS true|false] [PAGESIZE size-num]

UPDATE keywords and attributes

KeywordDescription
UPDATE Defines base-DN of the entry, starting from which the search for entries to be modified will be run.
(SET | ADD | DELETE) Defines the modification operation.
SET - replaces the value of the attribute by the new value.
ADD - adds a new value to the specified attribute.
DELETE - deletes an attribute value.
attr-name The name of the attribute to be modified.
attr-value The new value of the attribute.
WHERE An optional keyword. Defines the query filter of elements to be deleted. If not specified, all entries will be modified.
SCOPE An optional keyword used to define the scope of the modification. Can be ONELEVEL, SUBTREE, and BASE. Use ONELEVEL to modify entries within a single level of base-DN subentries, SUBTREE to modify all entries located under the base-DN and BASE to modify only the base-DN entry. The default value is SUBTREE.
REFERRALS An optional keyword used to define whether to handle referrals during the search. Possible values TRUE and FALSE. By default, 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 UPDATE statements

Modify the mail attribute of the entry CN=Alex Moris,DC=company.

UPDATE "CN=Alex Moris,DC=company" 
SET $mail="alex.moris@example.com"
SCOPE BASE

Update the accountExpires attribute of all users in the directory. The new attribute value is set to '2012-12-30'.

UPDATE "DC=company,DC=com" 
SET $accountExpires='2012-12-30' 
WHERE $objectClass='user' and $objectCategory='Person'

Modify the cn, mail and uid attributes of LDAP entry SN=Smith,DC=company.

UPDATE "SN=Smith,DC=company" 
SET $cn="J.Smith",$mail="jason.smith@example.com",$uid="jasonsmith"
SCOPE BASE;

Add a new mail attribute to all direct children of OU=Users,DC=company. The new value of the mail attribute is generated by concatinating the givenName attribute and the '@company.com' suffix.

UPDATE "OU=Users,DC=Company" 
ADD $mail= $givenName || "@company.com"  
SCOPE ONELEVEL

Delete description attribute of all entries in OU=Users,DC=company.

UPDATE "OU=Users,DC=company" 
DELETE $description