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

Re: Add-if-not-present



On May 26, 2010, at 11:10 PM, Howard Chu wrote:

> Ludovic Poitou wrote:
>> Are you really trying to achieve a MOD_ADD_IF_NOT_PRESENT or don't fail
> adding an attribute or value if the value is already present ?
>> 
>> MS AD has a PERMISSIVE MODIFY CONTROL that remove the ADD/DELETE
>> constraints
> on the attributes and values, so that adding an attribute that exist will
> succeed but do nothing and similarly deleting an attribute or value that is
> not present succeed.
> 
> Funny you should mention that. We support this control as well.

I've just added support for this control in OpenDS as well.


> I didn't get the impression that that was the goal here. It sounded to me like "add this value unless *any* value is present" not "add this value if *this value* is not present"...

Ok, I haven't paid too much attention at the full thread. But, personally I would be reluctant to extend the protocol (modification types) to cover use cases that are very close to existing solutions.
But hey, OpenLDAP is not my product / project ;-)

Regards,

Ludo

> 
>> My 2 cents.
>> 
>> Ludovic.
>> 
>> 
>> 
>> 
>> On May 26, 2010, at 3:53 PM, masarati@aero.polimi.it wrote:
>> 
>>>>> I need to implement a modify operation whose semantics is "add if not
>>>>> present", an add that only takes place if that attribute is not yet
>>>>> present in the entry.
>>>>> 
>>>>> I need it as an internal operation, so right now I wouldn't bother
>>>>> formalizing it as an extension of the semantics of the modify operation.
>>>>> Something like the SLAP_MOD_SOFTADD, which in turn consists in adding an
>>>>> attribute value only if that value is not already present.
>>>>> 
>>>>> I'd introduce a SLAP_MOD_ADD_IF_NOT_PRESENT flag and add code to support
>>>>> it in all (well, most) backends/overlays that need to muck with modify
>>>>> operation type.
>>>>> 
>>>>> Comments?  Objections?  p.
>>>> 
>>>> It might be a good idea to have a SOFTDEL as well; both are useful for
>>>> declarative modifications of data.  Think of them in terms of:
>>>> 
>>>> Soft Add: The attribute shall contain at least these values, but might
>>>> have others
>>>> Soft Del: The attribute shall contain none of these values, but might have
>>>> others
>>>> 
>>>> Ideally as modify sub-operations.
>>> 
>>> I'm not sure I understand how SOFTDEL differs from LDAP_MOD_DELETE.  Do
>>> you mean that values listed in SOFTDEL will be deleted if they exist, or
>>> otherwise ignored?
>>> 
>>> p.
>>> 
>> 
>> ---
>> Ludovic Poitou                                    Sun Microsystems Inc.
>> OpenDS Community Manager            Directory Services
>> http://blogs.sun.com/Ludo/         Grenoble Engineering Center - France
>> 
>> OpenDS, the Java LDAP Directory Server
>> http://www.opends.org
>> 
>> 
>> 
>> 
> 
> 
> -- 
>  -- Howard Chu
>  CTO, Symas Corp.           http://www.symas.com
>  Director, Highland Sun     http://highlandsun.com/hyc/
>  Chief Architect, OpenLDAP  http://www.openldap.org/project/

---
Ludovic Poitou                                    Sun Microsystems Inc.
OpenDS Community Manager            Directory Services          
http://blogs.sun.com/Ludo/         Grenoble Engineering Center - France

OpenDS, the Java LDAP Directory Server
http://www.opends.org