<PraveenVenkata.Koduganty(a)cognizant.com> writes:
Hi Raff,
I have enabled LDAP authentication and it works fine. Now I would want
to add the LDAP user on first logon, don't want a bulk LDAP import. I am
groovy illiterate, so trying to modify what you have written, and
referring to java code...Also, where do I put the following script for
it to run? I am supposing you have to put it in the wiki main home page
itself..
Something like -
<%if (request.get("go") == "1")
{
username = request.getUserPrincipal()
username = context.getContext().getWiki().convertUsername(username,
context.getContext())
def created = "created"
udoc = xwiki.getDocument("XWiki." + username)
if (!udoc.isNew())
{
udoc.delete()
created = "updated"
}
xwiki.createEmptyUser(username,null,context.getContext())
print("*" + created + "*" + " ")
print (" [XWiki." + username + "]")
}
}
%>
#if(!$request.get("go") || $request.get("go") != "1")
[Import and/or
Update Users>$doc.name?go=1] #end
Thanks
Praveen
Hi,
You should add something like that in your xwiki.cfg :
xwiki.authentication.createuser=ldap
So users will be created at they don't exist in the wiki.
With this method, you will not need any script on the wiki.
Best regards,
--
Raffaello Pelagalli
XPertNet -
XWiki.com