How to dynamically set objectclass to LDAP resource?

Hi, I've a situation that when creating new user in LDAP, we need to dynamically assign custom LDAP objectclass and respective mandatory attributes for that class, based on certain value from the other attribute.

I've no problem in setting value to attributes in the workflow, however when it comes to set the value for "objectclass", the LDAP resource adapter doesn't pick it up. It only set those objectclasses that were defined when creating the LDAP resource.

As a result, it returns schema violation because of the mandatory attribute I've set for that custom objectclass :(

My code looks like this:

<set name='user.accounts[My Ldap Server].objectClass'>

<list>

<s>top</s>

<s>person</s>

<s>organizationalPerson</s>

<s>inetorgperson</s>

<s>myCustomObjectClass</s>

</list>

</set>

Any ideas or solutions are much appreciated!!

PS: My LDAP is Sun Directory Server 5.2.

[1080 byte] By [Merlin88a] at [2007-11-26 21:40:33]
# 1

Having been doing a little Java coding against LDAP I've found that this has had to be done in two steps.

1. Modify the object by adding the auxiliary objectclass.

2. Modify the object by adding the new auxiliary attribute (with it's value).

I don't know how the LDAP adapter implements this. It should split this into two operations to make this work. Do you have any trace on what the adapter is actually trying to write to the directory?

Greijusa at 2007-7-10 3:25:15 > top of Java-index,Web & Directory Servers,Directory Servers...
# 2
Hi Greijus, thanks for the reply. Then the question is, how can I add an auxiliary objectclass to a LDAP user object within workflow?
Merlin88a at 2007-7-10 3:25:15 > top of Java-index,Web & Directory Servers,Directory Servers...
# 3
Just to make sure that your class definition is Ok: Are you able to make such a modification to the user using a LDIF-file? Can you do the same thing with any kind of LDAP admin tool?
Greijusa at 2007-7-10 3:25:15 > top of Java-index,Web & Directory Servers,Directory Servers...
# 4

Thanks for your reply Greijus. Everything are ok from the LDAP perspective. It is that in the workflow, I tried to set the 'user.accounts[My Ldap Server].objectClass

' plus set the required attribute of that class, it returns schema violation.

I looked at the tracing, it seems to me that the adapter receives the objectclass attribute from the resource form, where you define the objectclass when you go through the wizard.

If you look at the LDAPResourceAdapterBase.java

from the /REF directory, it gets the objectclass from RA_OBJECT_CLASS

. The value of it comes from the resource definition form statically :(

Merlin88a at 2007-7-10 3:25:15 > top of Java-index,Web & Directory Servers,Directory Servers...