42 lines
967 B
Plaintext
42 lines
967 B
Plaintext
|
#!/usr/bin/perl -w
|
||
|
|
||
|
package esmith;
|
||
|
|
||
|
use strict;
|
||
|
use Errno;
|
||
|
use esmith::DomainsDB;
|
||
|
use esmith::ConfigDB;
|
||
|
|
||
|
my $event = $ARGV [0];
|
||
|
my $userName = $ARGV [1];
|
||
|
|
||
|
my $cdb = esmith::ConfigDB->open_ro || die("Could not open config db\n");
|
||
|
my $horderemove = $cdb->get('horde');
|
||
|
my $status = $horderemove->prop('RemoveUsers') || "disabled";
|
||
|
unless ($status eq "enabled" )
|
||
|
{
|
||
|
warn "Removal of webmail database settings is disabled, to enable\n";
|
||
|
warn "config setprop horde RemoveUsers enabled ; signal-event email-update\n";
|
||
|
exit(0);
|
||
|
}
|
||
|
|
||
|
die "Username argument missing" unless defined ($userName);
|
||
|
|
||
|
my $db = esmith::DomainsDB->open_ro || die("Could not open domains db\n");
|
||
|
|
||
|
my $DomainName = "";
|
||
|
|
||
|
my @domains = ($DomainName,
|
||
|
map { $_->key }
|
||
|
$db->get_all());
|
||
|
|
||
|
foreach my $domain (@domains)
|
||
|
{
|
||
|
unless ($domain eq "")
|
||
|
{
|
||
|
system("php /usr/bin/horde-remove-user-data -f $userName@" . "$domain" . "> /dev/null");
|
||
|
}
|
||
|
}
|
||
|
|
||
|
exit (0)
|