cogCreates an admin user programmatically
Developed by

Vincent Massol

Rating
Rate!
0 Votes
LicenseGNU Lesser General Public License 2.1

Description

{{velocity}}
#if ($request.confirm == '1')
  #set ($allGroup = $xwiki.getDocument('XWiki.XWikiAllGroup'))
  #set ($adminGroup = $xwiki.getDocument('XWiki.XWikiAdminGroup'))
  #set ($fullName = 'XWiki.VincentMassol')
  #set ($udoc = $xwiki.getDocument($fullName))
  #set ($uobj = $udoc.getObject('XWiki.XWikiUsers', true))
  #set ($discard = $uobj.set('first_name', 'Vincent'))
  #set ($discard = $uobj.set('last_name' , 'Massol'))
  #set ($discard = $udoc.save())
  #set ($gObj = $allGroup.newObject('XWiki.XWikiGroups'))
  #set ($discard = $gObj.set('member', $udoc.fullName))
  #set ($discard = $allGroup.save())
  #set ($gObj = $adminGroup.newObject('XWiki.XWikiGroups'))
  #set ($discard = $gObj.set('member', $udoc.fullName))
  #set ($discard = $adminGroup.save())
  Created user [$fullName]!
#else
  [[Create User>>||queryString="confirm=1"]]
#end
{{/velocity}}

Prerequisites & Installation Instructions

Copy the code snippet to a page and save it.

Tags:
     

Get Connected