Dean G Weber wrote:
  I've been struggling for a while with the dilemma
of getting a user into a
 group. Let me supply some background on what  we've been trying to do with
 Xwiki.
 We're trying to use Xwiki for an internal collaborative site. Management
 has decided that users of the wiki must complete proper training. Without
 the training, the user cannot add to the wiki pages.
 For authentication, we've connected the wiki to our LDAP server via the
 xwik.cfg file. Authenticated users are automatically placed into the
 XWikiAllGroup by default.  In order to accommodate management
 requirements, I created a new user group... let's call it
 "TrainedUsersGroup".
 Once authenticated, users are placed into the Webhome page of the wiki.
 I've placed Velocity script on the Webhome page to check if the user is in
 the TrainedUsersGroup. If the user is not in the group, the user is
 redirected to the NoAccess.WebHome page.
 On the NoAccess.Webhome page another check is made to determine if the
 user is in the TrainedUsersGroup. If the user is not in the group,  a call
 is made to a Groovy class (on another page in the Groovy namespace). The
 groovy code executes a system call to grep on the Linux system running the
 Xwiki against a CSV file pulled from an intranet web report. The passed
 user's login (which is the same as the LDAP user id) is checked against
 this file. If the returned grep output shows that the training has been
 completed, the NoAccess.WebHome page will attempt to add the user to the
 TrainedUsersGroup. If the user is added to the TrainedUsersGroup as
 determined after another check, the user is redirected back to the
 originating WebHome page.
 This mechanism works great if the user accessing the pages is an admin.
 However, if the user is a regular user everything except the addition to
 the group works. Instead, the code to place the user in the group displays
 on the page. It does not run and put the user into the TrainedUsersGroup.
 This is no good for our needs in which we must restrict Xwiki access for
 non-trained users.
 (My original goal was to connect to our Oracle database and based upon the
 user id determine directly if the user has completed the training. I've
 had luck with a simple Groovy script  running on my desktop and on the
 Linux server. However, from within the Xwiki Groovy console or on a page,
 I get no output. Therefore, I have abandoned the Oracle query check via
 Groovy.)
 I've been researching the Xwiki user list for weeks. I've poured over
 xwiki documentation. I've peeked at wiki page source. I've done all this
 in an attempt to figure out how to get a user to place himself into a
 group. I've found a lot of confusing and contradicting information.
 Programming rights are mentioned. The only place I found the ability to
 set this right was in the xwiki administration. I can't determine if the
 problem is even related to programming rights. I've put a debug statement
 on the NoAccess.WebHome page to print whether the user visiting the page
 has programming rights. In all cases it display that they do. Yet, only
 admins can add themselves to the TrainedUsersGroup. This doesn't work for
 me. I need to automatically add the visiting user to the TrainedUsersGroup
 once the training has been validated.
 What is the problem? Why won't the user go into the group? Is there a
 better way of doing this? Any help, code snippets or suggestions would be
 appreciated.  
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().
--
Sergiu Dumitriu
http://purl.org/net/sergiu/