Question
· Apr 25, 2019

%SYS.LDAP - AddExts

Hi,

Anyone know the correct way to pass the user and password of a new account using %SYS.LDAP?

Set Status=##Class(%SYS.LDAP).AddExts(LD,DN,Attributes)

Discussion (2)0
Log in or sign up to continue

Hi,

Have you tried to make the namespace a binary value and pass the user and password as a parameter?

s Attr3=$lb(128,"intersystems-Namespace",$lb("%SYS"))
 s Attr4=$lb(0,"intersystems-Routine",$lb("iscRoutine"))
 s Attr5=$lb(0,"intersystems-Roles",$lb("iscRole1","iscRole2"))
 s Attr6=$lb(0,"userPassword",$lb(password))
 s Attr7=$lb(0,"cn",$lb("test20"))
 s Attr8=$lb(0,"uidNumber",$lb(58129))
 s Attr9=$lb(0,"gidNumber",$lb(58129))
 s Attr10=$lb(0,"homeDirectory",$lb("/home/test20"))
 s Attributes=$lb(Attr1,Attr2,Attr3,Attr4,Attr5,Attr6,Attr7,Attr8,Attr9,Attr10)
 s Status=##Class(%SYS.LDAP).AddExts(LD,DN,Attributes,"","")
 i Status'=$$$LDAPSUCCESS w !,"AddExts error: "_Status_" - "_##Class(%SYS.LDAP).Err2String(Status) g LDAPError

You can see an example of that on LDAP.mac on Namespace Samples.

I hope that helped you