initial commit of file from CVS for e-smith-base on Thu 26 Oct 11:24:52 BST 2023
This commit is contained in:
4
root/etc/e-smith/db/accounts/migrate/00openRW
Normal file
4
root/etc/e-smith/db/accounts/migrate/00openRW
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
use esmith::AccountsDB;
|
||||
$DB = esmith::AccountsDB->open;
|
||||
}
|
10
root/etc/e-smith/db/accounts/migrate/10Primary
Normal file
10
root/etc/e-smith/db/accounts/migrate/10Primary
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
# Delete any pre-existing Primary=system record
|
||||
my $p = $DB->get('Primary');
|
||||
return unless defined $p;
|
||||
|
||||
my $type = $p->prop('type');
|
||||
return unless defined $type;
|
||||
|
||||
$p->delete if $type eq 'system';
|
||||
}
|
11
root/etc/e-smith/db/accounts/migrate/20AdminPasswordSet
Normal file
11
root/etc/e-smith/db/accounts/migrate/20AdminPasswordSet
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
use esmith::ConfigDB;
|
||||
|
||||
my $conf = esmith::ConfigDB->open_ro() or return;
|
||||
|
||||
my $pw_set = $conf->get_value("PasswordSet") || "no";
|
||||
|
||||
my $admin = $DB->get('admin') || return;
|
||||
|
||||
$admin->set_prop('PasswordSet', $pw_set);
|
||||
}
|
6
root/etc/e-smith/db/accounts/migrate/30EmailForward
Normal file
6
root/etc/e-smith/db/accounts/migrate/30EmailForward
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
foreach my $user ($DB->get_all_by_prop(EmailForward => 'procmail'))
|
||||
{
|
||||
$user->set_prop('EmailForward','local');
|
||||
}
|
||||
}
|
18
root/etc/e-smith/db/accounts/migrate/50VPNClientAccess
Normal file
18
root/etc/e-smith/db/accounts/migrate/50VPNClientAccess
Normal file
@@ -0,0 +1,18 @@
|
||||
{
|
||||
# Migrate PPTPAccess -> VPNClientAccess and ensure a default for
|
||||
# all user/admin accounts
|
||||
|
||||
foreach my $account ($DB->get_all)
|
||||
{
|
||||
next unless ( ($account->key eq 'admin') or
|
||||
($account->prop('type') eq 'user') );
|
||||
|
||||
next if (defined $account->prop('VPNClientAccess'));
|
||||
|
||||
my $access = $account->prop('PPTPAccess') || 'no';
|
||||
|
||||
$account->delete_prop('PPTPAccess');
|
||||
|
||||
$account->set_prop('VPNClientAccess', $access);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user