* 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]
This commit is contained in:
24
root/etc/e-smith/db/accounts/migrate/10AdminEmail
Normal file
24
root/etc/e-smith/db/accounts/migrate/10AdminEmail
Normal file
@@ -0,0 +1,24 @@
|
||||
{
|
||||
my $conf = esmith::ConfigDB->open;
|
||||
return unless $conf;
|
||||
|
||||
my $admin_email = $conf->get_value_and_delete('AdminEmail');
|
||||
return unless defined $admin_email;
|
||||
|
||||
my $admin = $DB->get('admin') ||
|
||||
$DB->new_record('admin', {type => 'system'});
|
||||
if ($admin_email)
|
||||
{
|
||||
$admin->merge_props(
|
||||
EmailForward => 'forward',
|
||||
ForwardAddress => $admin_email,
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
$admin->merge_props(
|
||||
EmailForward => 'local',
|
||||
ForwardAddress => '',
|
||||
);
|
||||
}
|
||||
}
|
22
root/etc/e-smith/events/actions/pseudonym-cleanup
Normal file
22
root/etc/e-smith/events/actions/pseudonym-cleanup
Normal file
@@ -0,0 +1,22 @@
|
||||
#!/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"
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user