[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: deleting values from multivalued attribute



On 3/25/11 4:44 PM, Hugo Monteiro wrote:
On 03/25/2011 03:00 PM, Emmanuel Lecharny wrote:
On 3/25/11 3:51 PM, Hugo Monteiro wrote:
Hello list,

is it possible to perform the deletion of only a certain number of values, from a multivalued attribute, without having to perform full deletion and then adding the ones we'd like to keep?
Of course.

http://download.oracle.com/docs/cd/E19316-01/820-2763/bcacx/index.html

(and this is just one example. See "Deleting an Attribute Value")


Hello Emmanuel, et al,

Indeed. I was using the ldapmodify man page as reference and it doesn't mention the option of providing the value we wish to delete.

I wonder if it's also possible to use the same approach but for value modification. In brief evaluation, my guess is no, since the ldif syntax doesn't provide any way to distinct between the value to be replaced and the one to replace with.

I don't understand your question. The 'modify' operation applied on an AT allows you to do whatever you want, assuming you give it the right operation to apply. 'replace' will discard all the values and replace them by the new values. Otherwise, 'delete' deletes some specific values, and 'add' adds the ones you provide.

Isn't it enough ?

In this case one would possibly have something like

uid=user,ou=users,dc=example,dc=com
changetype: modify
replace: mailAlternateAddress
mailAlternateAddress: oldmail@example.com
mailAlternateAddress: newmail@example.com
-


But like i said, it doesn't make much sense.
It does. What the ldif snippet you gave just do is to replace all 'mailAlternateAddress' values by the two values you provided. Isn't it what you wanted to do ?

Otherwise, assuming you want to replace the oldmail@ value by the newmail@ value, the correct ldif would be :
uid=user,ou=users,dc=example,dc=com
changetype: modify
delete: mailAlternateAddress
mailAlternateAddress: oldmail@example.com
-
add: mailAlternateAddress
mailAlternateAddress: newmail@example.com
-

Check the LDIF RFC (http://www.ietf.org/rfc/rfc2849.txt), you have clear samples at the end.

--
Regards,
Cordialement,
Emmanuel LÃcharny
www.iktek.com