Delete all users in current wiki

Last modified by Thomas Mortagne on 2021/03/18 11:28

cogDelete all users in current wiki
TypeSnippet
Category
Developed by

Thomas Mortagne

Rating
0 Votes
LicenseGNU Lesser General Public License 2.1

Table of contents

Description

{{velocity}}
  #set($users = $services.query.xwql('from doc.object(XWiki.XWikiUsers) as user').addFilter('unique').execute())
  #if (!$request.confirm)
   Will delete the following users:
  #end

  #foreach ($userName in $users)
    #if ($request.confirm)
      #set($userDocument = $xwiki.getDocument($userName))
      #set($void = $userDocument.delete())
     * Deleted user $userName
    #else
     * $userName
    #end
  #end
{{/velocity}}

[[confirm>>||queryString="confirm=true"]]

Get Connected