Thx, this works...
A related question to groups;
allGroup seems to relate to XWikiAllGroup.
How can I refer to a self created group; in my case CdlsAuthors? to add users to that
group?
Op 13 mrt 2010, om 13:52 heeft Sergiu Dumitriu het volgende geschreven:
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
users(a)xwiki.org
http://lists.xwiki.org/mailman/listinfo/users