scripted delete mailbox for cyradm

Craig White craigwhite at azapple.com
Thu Feb 10 15:18:21 EST 2005


On Thu, 2005-02-10 at 13:18 -0600, Aleksandar Milivojevic wrote:

> There's a comment in man page for Cyrus::IMAP::Admin that you'll
> probably need to use setacl method before deleting mailbox (if doing it
> as cyrus user).  In Cyrus, administrator doesn't have the right to
> delete folders by default.  This is kind of failsafe to prevent you
> accidentally deleting users.  Hmmm...  I always wondered if "dm user"
> would do what I think it would (delete all the users).
----
got it - this is a foreign beast to me...

#! /usr/bin/perl -w

use Cyrus::IMAP::Admin;

$imap = Cyrus::IMAP::Admin->new("localhost")
    or die "Failed to connect";
$imap->authenticate("-user" => "cyrus",
                     "-password" => "PASSWD",
                     "-mechanism" => "LOGIN")
       or die "Failed to authenticate";
$imap->setacl("user.public","cyrus","+c") or die "Failed to set
permissions for cyrus";
$imap->delete("user.public") or die "Failed to delete mailbox";

give me an error - failed to delete on line 12 but it does indeed
delete. I'll have to debug later and investigate method of grabbing
error and standard out that you pointed me to. I can see that this is
trying to suck me into perl and I have avowed not to dirty my hands.

Thanks

Craig

---
Cyrus Home Page: http://asg.web.cmu.edu/cyrus
Cyrus Wiki/FAQ: http://cyruswiki.andrew.cmu.edu
List Archives/Info: http://asg.web.cmu.edu/cyrus/mailing-list.html




More information about the Info-cyrus mailing list