Hi Thx Marius, The script works; select distinct doc.fullName, prop.value from XWikiDocument as doc, BaseObject as obj, StringProperty as prop, IntegerProperty as acti where obj.className='XWiki.XWikiUsers' and obj.name=doc.fullName and prop.id.id=obj.id and prop.name='first_name' and prop.value is not empty and prop.value in ( select prop.value from StringProperty as prop2 where prop2.id.id=obj.id and prop2.name='last_name' and prop2.value=prop.value) and acti.id.id=obj.id and acti.name='active' and acti.value <> 1 "))
This script will get all documents with object of class XWiki.XWikiUsers wher first-name = last name and Active is not true Typically these tend to be SPAM users A tip I got from Ludovic is to use it in a groovy script and put it in a scheduled task A improvement would be to add doc.created date to the query so users get enough time to validate the email sended. A improvement might also be to refine the class with some constraints scripting so spamming behaviour in user registration will get error like; this type of user information is used by Spammers also; please select other ... Anybody has done this ? Gerritjan Op 11 dec 2010, om 12:19 heeft Marius Dumitru Florea het volgende geschreven: Hi Gerritjan, On 12/10/2010 10:23 PM, Gerritjan Koekkoek wrote: > Hi, > > I'm looking to build a script that will delete all registered users from our > XWiki > that did not complete the registration by replying to the email and look like > SPAM registration (firstname = lastname) > The property of the object of XWiki.XWikiUsers -> active (of type boolean) > is false > > Now this is my first attempt to HQL and i need some help > #foreach($result in $xwiki.search(" > select distinct doc.fullName, > prop.value > from XWikiDocument as doc, > BaseObject as obj, > StringProperty as prop, > BooleanProperty as acti > where obj.className='XWiki.XWikiUsers' > and obj.name=doc.fullName > and prop.id.id=obj.id > and prop.name='first_name' > and prop.value is not empty > and prop.value in ( > select prop.value > from StringProperty as prop2 > where prop2.id.id=obj.id > and prop2.name='last_name' > and prop2.value=prop.value) > and acti.id.id=obj.id > and acti.name='active' > and acti.value=false > ")) > * $result.get(0) - $result.get(1) > #end > > BooleanProperty is a wild guess of me looking at StringProperty as a example > The query should look for users where first-name = last-name and active is > false > If possible I would like to check if the document creation date/time is more > then 8 hours old I guess you've seen http://extensions.xwiki.org/xwiki/bin/view/Extension/Delete+Spam+Users but you missed http://extensions.xwiki.org/xwiki/bin/view/Extension/List+Inactive+Users . Shouldn't be hard to combine them. Hope this helps, Marius > > Gerritjan > > _______________________________________________ > users mailing list > users@xwiki.org > http://lists.xwiki.org/mailman/listinfo/users _______________________________________________ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users _______________________________________________ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users