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

Re: deleting values from multivalued attribute



On 03/25/2011 04:00 PM, Emmanuel Lecharny wrote:
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 ?


Aye, i understand it can be done through delete/add. My wondering was about the possibility to perform the change using a single operation.


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
-


Yes, that's what was intended.

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


Thanks for the pointer. I have visited the rfc before but didn't go through the end of the document.

Best Regards,

Hugo Monteiro.

--
fct.unl.pt:~# cat .signature

Hugo Monteiro
Email	 : hugo.monteiro@fct.unl.pt
Telefone : +351 212948300 Ext.15307
Web      : http://hmonteiro.net

DivisÃo de InformÃtica
Faculdade de CiÃncias e Tecnologia da
		   Universidade Nova de Lisboa
Quinta da Torre   2829-516 Caparica   Portugal
Telefone: +351 212948596   Fax: +351 212948548
www.fct.unl.pt                apoio@fct.unl.pt

fct.unl.pt:~# _