<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[iRedMail — Remove mailboxes when deleting user]]></title>
		<link>http://www.iredmail.org/forum/topic2853-remove-mailboxes-when-deleting-user.html</link>
		<atom:link href="http://www.iredmail.org/forum/feed-rss-topic2853.xml" rel="self" type="application/rss+xml" />
		<description><![CDATA[The most recent posts in Remove mailboxes when deleting user.]]></description>
		<lastBuildDate>Tue, 06 Nov 2012 19:12:16 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: Remove mailboxes when deleting user]]></title>
			<link>http://www.iredmail.org/forum/post18991.html#p18991</link>
			<description><![CDATA[<div class="quotebox"><cite>maltamirano wrote:</cite><blockquote><p>Thanks for you quick reply!<br />Will folow your directions ASAP and post back results.</p><p>Regards,<br />Martin.</p></blockquote></div><p>Did you ever get this working?</p><p>I completely agree that iredadmin does not delete the user files straight away when a user gets deleted.<br />But I also see how this can become a big issue on small filesystems. So I would suggest a compromise using a daily cron job which delete user email directory if it no longer exists in the databae.<br />- For security this would save the users email directory for 30 days by:<br />1. When it first notices that the user no longer exists in the DB write a file with the current date or using a counter which gets decremented each day.<br />2. For each &quot;deleted user&quot; this date is then compared to the CURRENT_DATE and if it is more then 30 days delete the directory.</p><p>This keeps everybody happy :-)</p>]]></description>
			<author><![CDATA[null@example.com (web2works)]]></author>
			<pubDate>Tue, 06 Nov 2012 19:12:16 +0000</pubDate>
			<guid>http://www.iredmail.org/forum/post18991.html#p18991</guid>
		</item>
		<item>
			<title><![CDATA[Re: Remove mailboxes when deleting user]]></title>
			<link>http://www.iredmail.org/forum/post13376.html#p13376</link>
			<description><![CDATA[<p>Thanks for you quick reply!<br />Will folow your directions ASAP and post back results.</p><p>Regards,<br />Martin.</p>]]></description>
			<author><![CDATA[null@example.com (maltamirano)]]></author>
			<pubDate>Tue, 17 Jan 2012 16:16:12 +0000</pubDate>
			<guid>http://www.iredmail.org/forum/post13376.html#p13376</guid>
		</item>
		<item>
			<title><![CDATA[Re: Remove mailboxes when deleting user]]></title>
			<link>http://www.iredmail.org/forum/post13357.html#p13357</link>
			<description><![CDATA[<div class="quotebox"><cite>maltamirano wrote:</cite><blockquote><p>Can I modify iRedAdmin-Pro LDAP code to access filesystem and remove folders?<br />Please, point out which file/files should be modified. I&#039;m not a Python geek, but understand MVC architecture and can code...</p></blockquote></div><p>Alright, here we go:</p><p>*) WARNING: Please test your code on a testing machine first, don&#039;t do it on production server directly. Removed mailboxes CAN NOT be restored.<br />*) We&#039;re taking the latest iRedAdmin-Pro-LDAP-1.6.3 for example. If you haven&#039;t upgraded to 1.6.3, please upgrade it as soon as possible.<br />*) Open file libs/ldaplib/user.py, find function &#039;deleteSingleUser()&#039;, about line 328:<br /></p><div class="codebox"><pre><code>    # Delete single user.
    def deleteSingleUser(self, mail, deleteFromGroups=True,):
        ...

        try:
            ...
            # Delete object and its subtree.
            deltree.DelTree(self.conn, self.dnUser, ldap.SCOPE_SUBTREE)
        ...</code></pre></div><p>What you need to do are:</p><p>*) Query LDAP server to get maildir path of this mail user.<br />*) Delete the whole maildir directory. Note: It will execute command as user &#039;iredadmin&#039; and group &#039;iredadmin&#039; by default, so please make sure this user/group can access mailbox directory (/var/vmail by default).</p><p>All your code MUST be placed ABOVE line &#039;deltree.DelTree()&#039; i paste above.<br />To delete whole mailbox directory, you can use Python module &#039;os&#039;. For example:<br /></p><div class="codebox"><pre><code>import os
os.removedirs(&#039;/tmp/test_dir/&#039;)</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (ZhangHuangbin)]]></author>
			<pubDate>Tue, 17 Jan 2012 04:46:50 +0000</pubDate>
			<guid>http://www.iredmail.org/forum/post13357.html#p13357</guid>
		</item>
		<item>
			<title><![CDATA[Remove mailboxes when deleting user]]></title>
			<link>http://www.iredmail.org/forum/post13352.html#p13352</link>
			<description><![CDATA[<p>Even though this request has been posted (and answered) more than once, I will insist in getting some solution:<br />I need the filesystem mailbox folder automatically deleted while removing a user from iRedAdmin-Pro LDAP UI. Maybe this is about to be addressed in the near(?) future, but some kind of help is needed meanwhile.</p><p>Can I modify iRedAdmin-Pro LDAP code to access filesystem and remove folders?<br />Please, point out which file/files should be modified. I&#039;m not a Python geek, but understand MVC architecture and can code...</p><p>Regards, Martin.</p>]]></description>
			<author><![CDATA[null@example.com (maltamirano)]]></author>
			<pubDate>Mon, 16 Jan 2012 20:40:17 +0000</pubDate>
			<guid>http://www.iredmail.org/forum/post13352.html#p13352</guid>
		</item>
	</channel>
</rss>
