Unverified Commit 9d8a9da2 authored by IKEDA Soji's avatar IKEDA Soji Committed by GitHub
Browse files

Merge pull request #540 from ikedas/invalid_default_scenarios-addition by ikedas

Invalid default scenarios: Follow up to #528
parents 685115f5 b65f9632
......@@ -585,6 +585,109 @@ our @params = (
'Minimum number of owners for each list must satisfy the owner_domain restriction. The default of zero (0) means *all* list owners must match. Setting to 1 requires only one list owner to match owner_domain; all other owners can be from any domain. This setting can be used to ensure that there is always at least one known contact point for any mailing list.',
},
{'gettext_id' => 'Default privileges for the lists'},
# List definition
{ 'name' => 'visibility',
'gettext_id' => "Visibility of the list",
'scenario' => 1,
'vhost' => 1,
'default' => 'conceal',
},
# Sending
{ 'name' => 'send',
'gettext_id' => "Who can send messages",
'scenario' => 1,
'vhost' => 1,
'default' => 'private',
},
# Privileges
{ 'name' => 'info',
'gettext_id' => "Who can view list information",
'scenario' => 1,
'vhost' => 1,
'default' => 'open',
},
{ 'name' => 'subscribe',
'gettext_id' => "Who can subscribe to the list",
'scenario' => 1,
'vhost' => 1,
'default' => 'open',
},
{ 'name' => 'add',
'gettext_id' => "Who can add subscribers",
'scenario' => 1,
'vhost' => 1,
'default' => 'owner',
},
{ 'name' => 'unsubscribe',
'gettext_id' => "Who can unsubscribe",
'scenario' => 1,
'vhost' => 1,
'default' => 'open',
},
{ 'name' => 'del',
'gettext_id' => "Who can delete subscribers",
'scenario' => 1,
'vhost' => 1,
'default' => 'owner',
},
{ 'name' => 'invite',
'gettext_id' => "Who can invite people",
'scenario' => 1,
'vhost' => 1,
'default' => 'private',
},
{ 'name' => 'remind',
'gettext_id' => "Who can start a remind process",
'scenario' => 1,
'vhost' => 1,
'default' => 'owner',
},
{ 'name' => 'review',
'gettext_id' => "Who can review subscribers",
'scenario' => 1,
'vhost' => 1,
'default' => 'owner',
},
{ 'name' => 'd_read',
'gettext_id' => "Who can view",
'scenario' => 1,
'vhost' => 1,
'default' => 'private',
},
{ 'name' => 'd_edit',
'gettext_id' => "Who can edit",
'scenario' => 1,
'vhost' => 1,
'default' => 'owner',
},
# Archives
{ 'name' => 'archive_web_access',
'gettext_id' => "access right",
'scenario' => 1,
'vhost' => 1,
'default' => 'closed',
},
{ 'name' => 'archive_mail_access',
'gettext_id' => "access right by mail commands",
'scenario' => 1,
'vhost' => 1,
'default' => 'closed',
},
# Bounces
{ 'name' => 'tracking',
'gettext_id' => "who can view message tracking",
'scenario' => 1,
'vhost' => 1,
'default' => 'owner',
},
{'gettext_id' => 'Archives'},
{ 'name' => 'process_archive',
......
......@@ -6427,10 +6427,11 @@ sub _load_include_admin_user_file {
unless (defined $hash{$k}) {
if (defined $pinfo->{$pname}{'file_format'}{$k}{'default'}
) {
$hash{$k} =
$self->_load_list_param($k,
$hash{$k} = $self->_load_list_param(
$k,
$pinfo->{$pname}{'file_format'}{$k}{'default'},
$pinfo->{$pname}{'file_format'}{$k});
$pinfo->{$pname}{'file_format'}{$k}
);
}
}
## Required fields
......@@ -8163,6 +8164,12 @@ sub _load_list_param {
return undef; #FIXME
}
# For compatibility to <= 6.2.40: Special name "default" stands for
# the default scenario.
if ($p->{'scenario'} and $value eq 'default') {
$value = $p->{'default'};
}
## Search configuration file
if ( ref $value
and $value->{'conf'}
......@@ -8436,10 +8443,11 @@ sub _load_list_config_file {
unless (defined $hash{$k}) {
if (defined $pinfo->{$pname}{'file_format'}{$k}{'default'}
) {
$hash{$k} =
$self->_load_list_param($k,
$hash{$k} = $self->_load_list_param(
$k,
$pinfo->{$pname}{'file_format'}{$k}{'default'},
$pinfo->{$pname}{'file_format'}{$k});
$pinfo->{$pname}{'file_format'}{$k}
);
}
}
......
......@@ -68,11 +68,10 @@ our %pinfo = (
'This parameter indicates whether the list should feature in the output generated in response to a LISTS command or should be shown in the list overview of the web-interface.',
'scenario' => 'visibility',
'synonym' => {
'default' => 'conceal', # Compat. <= 6.2.40
'public' => 'noconceal',
'private' => 'conceal'
},
'default' => 'conceal',
'default' => {'conf' => 'visibility'},
},
'owner' => {
......@@ -292,10 +291,7 @@ our %pinfo = (
'gettext_comment' =>
'This parameter specifies who can send messages to the list.',
'scenario' => 'send',
'synonym' => {
'default' => 'private', # Compat. <= 6.2.40
},
'default' => 'private',
'default' => {'conf' => 'send'},
},
'delivery_time' => {
......@@ -646,10 +642,7 @@ our %pinfo = (
'group' => 'command',
'gettext_id' => "Who can view list information",
'scenario' => 'info',
'synonym' => {
'default' => 'open', # Compat. <= 6.2.40
},
'default' => 'open',
'default' => {'conf' => 'info'},
},
'subscribe' => {
......@@ -659,10 +652,7 @@ our %pinfo = (
'gettext_comment' =>
'The subscribe parameter defines the rules for subscribing to the list.',
'scenario' => 'subscribe',
'synonym' => {
'default' => 'open', # Compat. <= 6.2.40
},
'default' => 'open',
'default' => {'conf' => 'subscribe'},
},
'subscription' => {'obsolete' => 'subscribe'},
......@@ -673,10 +663,7 @@ our %pinfo = (
'gettext_comment' =>
'Privilege for adding (ADD command) a subscriber to the list',
'scenario' => 'add',
'synonym' => {
'default' => 'owner', # Compat. <= 6.2.40
},
'default' => 'owner',
'default' => {'conf' => 'add'},
},
'unsubscribe' => {
......@@ -686,10 +673,7 @@ our %pinfo = (
'gettext_comment' =>
'This parameter specifies the unsubscription method for the list. Use open_notify or auth_notify to allow owner notification of each unsubscribe command.',
'scenario' => 'unsubscribe',
'synonym' => {
'default' => 'open', # Compat. <= 6.2.40
},
'default' => 'open',
'default' => {'conf' => 'unsubscribe'},
},
'unsubscription' => {'obsolete' => 'unsubscribe'},
......@@ -698,10 +682,7 @@ our %pinfo = (
'group' => 'command',
'gettext_id' => "Who can delete subscribers",
'scenario' => 'del',
'synonym' => {
'default' => 'owner', # Compat. <= 6.2.40
},
'default' => 'owner',
'default' => {'conf' => 'del'},
},
'invite' => {
......@@ -709,10 +690,7 @@ our %pinfo = (
'group' => 'command',
'gettext_id' => "Who can invite people",
'scenario' => 'invite',
'synonym' => {
'default' => 'private', # Compat. <= 6.2.40
},
'default' => 'private',
'default' => {'conf' => 'invite'},
},
'remind' => {
......@@ -722,10 +700,7 @@ our %pinfo = (
'gettext_comment' =>
'This parameter specifies who is authorized to use the remind command.',
'scenario' => 'remind',
'synonym' => {
'default' => 'owner', # Compat. <= 6.2.40
},
'default' => 'owner',
'default' => {'conf' => 'remind'},
},
'review' => {
......@@ -735,11 +710,8 @@ our %pinfo = (
'gettext_comment' =>
'This parameter specifies who can access the list of members. Since subscriber addresses can be abused by spammers, it is strongly recommended that you only authorize owners or subscribers to access the subscriber list. ',
'scenario' => 'review',
'synonym' => {
'default' => 'owner', # Compat. <= 6.2.40
'open' => 'public',
},
'default' => 'owner',
'synonym' => {'open' => 'public',},
'default' => {'conf' => 'review'},
},
'owner_domain' => {
......@@ -778,19 +750,13 @@ our %pinfo = (
'order' => 1,
'gettext_id' => "Who can view",
'scenario' => 'd_read',
'synonym' => {
'default' => 'private', # Compat. <= 6.2.40
},
'default' => 'private',
'default' => {'conf' => 'd_read'},
},
'd_edit' => {
'order' => 2,
'gettext_id' => "Who can edit",
'scenario' => 'd_edit',
'synonym' => {
'default' => 'owner', # Compat. <= 6.2.40
},
'default' => 'owner',
'default' => {'conf' => 'd_edit'},
},
'quota' => {
'order' => 3,
......@@ -822,7 +788,8 @@ our %pinfo = (
'order' => 1,
'gettext_id' => "access right",
'scenario' => 'archive_web_access',
'obsolete' => 1, # Use archive.web_access
'default' => {'conf' => 'archive_web_access'},
'obsolete' => 1, # Use archive.web_access
},
'quota' => {
'order' => 2,
......@@ -831,14 +798,14 @@ our %pinfo = (
'format' => '\d+',
'default' => {'conf' => 'default_archive_quota'},
'length' => 8,
'obsolete' => 1, # Use archive.quota
'obsolete' => 1, # Use archive.quota
},
'max_month' => {
'order' => 3,
'gettext_id' => "Maximum number of month archived",
'format' => '\d+',
'length' => 3,
'obsolete' => 1, # Use archive.max_month
'obsolete' => 1, # Use archive.max_month
}
}
},
......@@ -867,17 +834,16 @@ our %pinfo = (
'order' => 3,
'gettext_id' => "access right",
'scenario' => 'archive_web_access',
'default' => 'closed',
'default' => {'conf' => 'archive_web_access'},
},
'mail_access' => {
'order' => 4,
'gettext_id' => "access right by mail commands",
'scenario' => 'archive_mail_access',
'synonym' => {
'default' => 'closed', # Compat. <= 6.2.40
'open' => 'public', # Compat. with <=6.2b.3.
'open' => 'public', # Compat. with <=6.2b.3.
},
'default' => 'closed',
'default' => {'conf' => 'archive_mail_access'},
},
'quota' => {
'order' => 5,
......@@ -1059,10 +1025,7 @@ our %pinfo = (
'order' => 3,
'gettext_id' => "who can view message tracking",
'scenario' => 'tracking',
'synonym' => {
'default' => 'owner', # Compat. <= 6.2.40
},
'default' => 'owner',
'default' => {'conf' => 'tracking'},
},
'retention_period' => {
'order' => 4,
......
......@@ -29,6 +29,7 @@ package Sympa::Upgrade;
use strict;
use warnings;
use Cwd qw();
use Encode qw();
use English qw(-no_match_vars);
use MIME::Base64 qw();
......@@ -1900,6 +1901,67 @@ sub upgrade {
}
}
# Default list scenario names will be specified in robot.conf/sympa.conf
# instead of creating symbolic links named "*.default".
if (lower_version($previous_version, '6.2.41b.1')) {
my @scenarios = qw(visibility
send info subscribe add unsubscribe del invite remind review
d_read d_edit
archive_web_access archive_mail_access
tracking);
my @dirs = ($Conf::Conf{'etc'});
push @dirs,
map { $Conf::Conf{'etc'} . '/' . $_ } Sympa::List::get_robots();
foreach my $dir (@dirs) {
my %scenario_names;
next unless $dir eq $Conf::Conf{'etc'} or -e $dir . '/robot.conf';
next unless -d $dir . '/scenari';
foreach my $scenario (@scenarios) {
my $path = $dir . '/scenari/' . $scenario . '.default';
next unless -e $path;
my $name = '';
if (-l $path) {
$path = Cwd::abs_path($path);
next unless $path and -e $path;
if ($path =~ m{/$scenario\.([-\w]+)\z}) {
$name = $1;
}
}
$scenario_names{$scenario} = $name;
}
next unless %scenario_names;
my $ofh;
if ($dir eq $Conf::Conf{'etc'}) {
open $ofh, '>>', Conf::get_sympa_conf() or next;
} else {
open $ofh, '>>', $dir . '/robot.conf' or next;
}
print $ofh "\n\n";
print $ofh
"# Following parameters were added during upgrade to %s\n\n",
$new_version;
foreach my $scenario (@scenarios) {
unless (exists $scenario_names{$scenario}) {
next;
} elsif ($scenario_names{$scenario}) {
printf $ofh "%s %s\n", $scenario,
$scenario_names{$scenario};
} else {
printf $ofh
"#%s (Assign default manually, or distribution default will be used.)\n",
$scenario;
}
}
close $ofh;
}
}
if (lower_version($previous_version, '6.2.41b.1')) {
# The header/footer files were renamed.
# Site-level files were moved.
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment