RemoveUsers


import org.slf4j.LoggerFactory; def LOGGER = LoggerFactory.getLogger("deleteSpamUsers"); if(xwiki.hasAdminRights()){ def users = xwiki.getXWiki().search("select doc.fullName from XWikiDocument doc, BaseObject obj where obj.name = doc.fullName and obj.className = 'XWiki.XWikiUsers' and doc.fullName <>'XWiki.Admin' ", 500, 0, xcontext)

for(u in users){ def firstName = xwiki.getDocument(u).getObject('XWiki.XWikiUsers').getProperty('first_name').getValue(); def lastName = xwiki.getDocument(u).getObject('XWiki.XWikiUsers').getProperty('last_name').getValue(); if (lastName == firstName){ xwiki.getDocument(u).delete(); LOGGER.warn(u + ": deleting " + firstName + " " + lastName); } else LOGGER.warn(u + ": " + firstName +" " + lastName + " " + "OK"); } }


This wiki is licensed under a Creative Commons 2.0 license
XWiki Enterprise 6.4.4 - Documentation
Powered by XWiki Hosted by Xsalto Free PageRank Checker Creative Commons 2.0 license Legal Notice