When creating users with values from our LDAP server with the following groovy script, the object “XWiki.LDAPProfileClass” is empty, regardless if we use “getObject” or “newObject”:
def create_ldap_user(user) {
udoc = xwiki.getDocument("XWiki."+user)
uobj = udoc.getObject("XWiki.XWikiUsers", true)
uobj.set("active", 1)
lobj = udoc.getObject("XWiki.LDAPProfileClass", true)
//lobj = udoc.newObject("XWiki.LDAPProfileClass")
lobj.set("dn" , "uid=" + user + ",ou=Users,dc=example,dc=com")
lobj.set("uid" , user)
udoc.save()
}
After creation the object inspector shows a class of type “XWiki.LDAPProfileClass” attached to the user, but it does not contain any attributes. When clicking on “New LDAPProfileClass object”, we only get the error “Failed:Not Found”.
This only happens on a newly installed instance, that is configured for LDAP login, as long as no LDAP user ever logged in.
Why does this happen and how can we avoid it? Thanks in advance!