On 03/13/2010 01:03 PM, Gerritjan Koekkoek wrote:
> Hi,
> This code from
> http://code.xwiki.org/xwiki/bin/view/Snippets/Create200DummyUsersSnippet
> for(user in users){
> fullName = user.get(0) + user.get(1)
> udoc = xwiki.getDocument("XWiki."+fullName)
> uobj = udoc.getObject("XWiki.XWikiUsers", true)
> uobj.set("first_name", user.get(0))
> uobj.set("last_name" , user.get(1))
> print("* Registering *" + udoc.fullName + "*\n")
> udoc.save()
if (allGroup.getObject('XWiki.XWikiGroups', 'member', udoc.fullName,
false) == null) {
> gObj = allGroup.newObject('XWiki.XWikiGroups')
> gObj.set('member',udoc.fullName)
}
> }
> How to test if membership of group Xwiki.XWikiAllgroup already exists
> If I run the script twice I get two records in the group for the same person
>
> I would rather have the same behaviour as with getDocument; if not exists it
> creates a new one, otherwise a new version?
--
Sergiu Dumitriu
http://purl.org/net/sergiu/
_______________________________________________
users mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/users