VMware Cloud Community
goldeneyez
Contributor
Contributor

Active Directory 3.0.3 Plugin and (AD:User).id type object

I am using Active Directory Plugin version 3.0.3

and I encounter an issue with id attribute of AD_User object

Assuming that the following variable: adUserObjectIn

contain AD:User Object

When I run the following command:

System.log(adUserObjectIn.id);

Then I get the following output:

#_v2_#,#User#,#98bcdb6b-3cef-4f3f-9e6b-a0f7df2ce8ed#,#CN=Test User,OU=Users,OU=US,OU=Dept Name,OU=Company Name,DC=us,DC=contoso,DC=com#

but When I run the following command:

System.log("adUserObjectIn.id type is: " + typeof(adUserObjectIn.id));

Then I get the following output:

adUserObjectIn.id type is: object

but When I run the following command:

System.log("adUserObjectIn.id type is: " + typeof(adUserObjectIn.id()));

then I get the following error:

TypeError: Cannot call property id in object DynamicWrapper (Instance) : [AD_User]-[class ch.dunes.ad.object.User] -- VALUE : #_v2_#,#User#,#98bcdb6b-3cef-4f3f-9e6b-a0f7df2ce8ed#,#CN=Test User,OU=Users,OU=US,OU=Dept Name,OU=Company Name,DC=us,DC=contoso,DC=com#. It is not a function, it is "object".

Now.

Assuming that I define a variable from type of ANY.

let assume that the name of the variable is id

and now I execute the following command:

var id = adUserObjectIn.id;

then I get the following error:

ch.dunes.model.type.ConvertorException: Unable to serialize object of class : com.vmware.o11n.plugin.ad.util.FqId

Now , Assuming that I will define the variable id to be in type of Array of Any

and now I execute the following command:

var id = adUserObjectIn.id;

then I get the following error:

ch.dunes.model.type.ConvertorException: Not an Array

so , if I want to summarize my issue , then my issue is because I cannot determine what is the type of adUserObjectIn.id ?

I found the following:

http://www.vroapi.com/Class/AD/3.0.3/AD_User

and the following:

http://www.vroapi.com/Class/AD/3.0.3/User

if I will define the variable id to be in type of string

then if I will run the following code:

var id = adUserObjectIn.id;

System.log(id);

then I will get the following output:

#_v2_#,#User#,#98bcdb6b-3cef-4f3f-9e6b-a0f7df2ce8ed#,#CN=Test User,OU=Users,OU=US,OU=Dept Name,OU=Company Name,DC=us,DC=contoso,DC=com#

BUT , the problem is , Assume that I bind (visual binding) the variable id to another out Parameter (named: id_OutParam)

note: both of them in type of String

then eventually the value / content of variable id_OutParam is empty

Please Advice and thanks in advanced

0 Kudos
1 Reply
iiliev
VMware Employee
VMware Employee

Hi,

typeof(adUserObjectIn.id) works and typeof(adUserObjectIn.id()) does not work because the latter tries to invoke method id(), and id is not a method of the User type (it is a property).

Internally in the plug-in, the type of the id property is not a plain string but a more complex object; I think that's why you are getting these conversion errors. The simplest way to ensure that it will work is to treat it as a string and where necessary, convert it to string explicitly. For example, instead of

var id = adUserObjectIn.id;

you can use something like:

var id = adUserObjectIn.id.toString();

0 Kudos