smeserver-email/root/etc/e-smith/events/actions/pseudonym-cleanup
Jean-Philippe Pialasse 6dd24d9479 * Mon Dec 30 2024 Jean-Philippe Pialasse <jpp@koozali.org> 11.0.0-7.sme
- fix CGI::param called in list context [SME: 12789]
- update webmail settings for roundcube [SME: 12743]
- remove requires runit [SME: 12566]
- move action pseudonym-cleanup and migrate 10AdminEmail from smeserver-mini-qmail [SME: 12808]
2024-12-30 22:09:15 -05:00

23 lines
606 B
Perl

#!/usr/bin/perl -w
use strict;
use esmith::AccountsDB;
use esmith::event;
my $accounts = esmith::AccountsDB->open() or
die "Unable to open accounts db: $!";
my ($self, $account) = @ARGV;
# Find all "pseudonyms" entries in the e-smith accounts database and
# if the pseudonyms has an unexisting Account associated we change
# it to user "admin".
foreach my $pseudo ( $accounts->pseudonyms ) {
unless ( $accounts->get($pseudo->prop('Account')) ) {
$pseudo->set_prop( 'Account', 'admin' );
print "orphaned pseudonym " . $pseudo->key. " has been associated to admin account"
}
}