I have developped a script XSLT that reads from a XML file.
This script generates a groovy script that migrated our userdatabase into XWIKI
The resulting groovy looked like this (I assume velocity will look alike from a structure
perspective);
vFullName = "AnjevanderLugt"
userdoc = xwiki.getDocument("XWiki."+vFullName)
userobj = userdoc.getObject("XWiki.XWikiUsers", true)
userobj.set("first_name" , "Anje")
userobj.set("last_name" , " van derLugt")
userdoc.save()
if (allGroup.getObject('XWiki.XWikiGroups', 'member',
userdoc.fullName, false) == null) {
gObj = allGroup.newObject('XWiki.XWikiGroups')
gObj.set('member',userdoc.fullName)
allGroup.save()
}
if (vAuthors.getObject('XWiki.XWikiGroups', 'member',
userdoc.fullName, false) == null) {
gObjAuthors = vAuthors.newObject('XWiki.XWikiGroups')
gObjAuthors.set('member',userdoc.fullName)
vAuthors.save()
}
What it does;
It creates a document in XWIKI space
On that document it creates a object of class XWIKI.XWIKIUSERS
I also add the user to a few specific groups
Note: these users are not yet added to XWIKIALLGROUP, there is a nice script on
xwiki.org
that does this
Hope this helps.
Gerritjan
Op 26 okt 2010, om 12:11 heeft Bauyrzhan Matyganov het volgende geschreven:
Hello dear friends and community
I need your help with registering users.
The question is:
I have a database table wich contains a list of registered users to my
website.
Now, I want to import this list of users to my XWIKI application.
But i dont know how to import it.
I can select all user name and put them in an xwiki array or set.
and then, i can write a script that will use a for loop to create users
taking username from the array and putting a defualt pathword which users
can change later.
#set($userNames=
{"A","B","C",...................................................})
#set($fields = [])
##
#foreach($userName in $userNames)
## The first name field, no checking.
#set($field = $userNames)
#set($discard = $fields.add($field))
etc....
#createUser($fields, $request, $response, $doAfterRegistration)
#end
will it work?
I am not proficient in XWiki and velocity programming, and I ask for your
help.
Any help will be appriciated.
_______________________________________________
users mailing list
users(a)xwiki.org
http://lists.xwiki.org/mailman/listinfo/users