Re, On Mon, Jun 15, 2009 at 5:09 PM, Sergiu Dumitriu <[email protected]> wrote:
Guillaume Lerouge wrote:
How exactly are you adding the user to that group? If you create an XWikiGroups object, add it to the group document, then save it, you should use saveWithProgrammingRights() instead of save().
THis is from the NoAccess.WebHome page.
Here is the velocity code segment I am using to try and add a user to the TrainedUsersGroup group.
01 #if($completed_training == "true" or $xwiki.hasAdminRights()) 02 ## 03 ## Add the current user to the TrainedUsersGroup group 04 ## 05 #set($MyGroupDoc = $xwiki.getDocument("XWiki.TrainedUsersGroup")) 06 #if(!$MyGroupDoc.getObject("XWiki.XWikiGroups", "member", $fullName))
07 #set($GroupObj = $MyGroupDoc.newObject("XWiki.XWikiGroups")) 08 #set($AddingUser = 1) 09 $GroupObj.set("member", $fullName) 10 $MyGroupDoc.save() 11 #end 12 #end
To do so, you can go to .../xwiki/bin/edit/XWiki/TrainedUsersGroup?editor=rights and make sure that the "Edit" checkbox is ticked in the XWikiAllGroup line. This allows all users to modify that page, thus making them able to add themselves to the group.
Once I had made the modification, my "normal" user was able to add himself to the TrainedUsersGroup simply by going to the page.
Hope this helps,
Guillaume, stop confusing.
Dean, as I said, replace the save() call with saveWithProgrammingRights().
10 $MyGroupDoc.saveWithProgramminRights()
Well... As Dean stated it in his email this didn't seem to help: "I've even changed line #10 to use saveWithProgrammingRights but it behaves the same and just displays on the screen in the case of a regular user." Guillaume
-- Sergiu Dumitriu http://purl.org/net/sergiu/ _______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
-- Guillaume Lerouge Product Manager - XWiki Skype: wikibc Twitter: glerouge http://guillaumelerouge.com/