groupFixes the XWikiAllGroup by synchronizing it with real users in the wiki
Developed by

Jerome

Rating
Rate!
0 Votes
LicenseGNU Lesser General Public License 2.1

Description

Recreates the XWiki.XWikiAllGroup page with all existing users added to it. This can be useful for the case when you accidentally delete or overwrite XWikiAllGroup (such as when you do a XAR import and overwrite it by mistake).

Add the following in a document in the XWiki Syntax 2.1:

{{velocity}}
#set ($allGroupDoc = $xwiki.getDocument('XWiki.XWikiAllGroup'))
#foreach ($userDocName in $xwiki.searchDocuments(', BaseObject as obj where obj.className=''XWiki.XWikiUsers'' and obj.name=doc.fullName'))
  #if (!$allGroupDoc.getObject('XWiki.XWikiGroups', 'member', $userDocName))
    #set ($member = $allGroupDoc.newObject('XWiki.XWikiGroups'))
    $!member.set('member', $userDocName)
    * Restoring user [[$userDocName]] in XWikiAllGroup
  #end
#end
#if ("$!{request.confirm}" == '1')
  $allGroupDoc.save()
#else
 [[Confirm these changes?>>$doc||queryString="confirm=1"]]
#end
{{/velocity}}

Prerequisites & Installation Instructions

Copy the code snippet to a page and save it.

Created by JeromeVelociter on 2009/02/13 12:32
     

Get Connected