Commit 1d68a10c authored by sikeda's avatar sikeda
Browse files

[*change] Changes of list config parameters on archiving.

* New parameter "process_archive" controls archiving.
The default is "off": To enable archiving, it must be set to "on" explicitly.  OTOH even if archiving is disabled by setting it "off", past archives will be kept and accessible according to access settings.

* Renamed parameters.
web_archive.access to archive.web_access;
archive.access to archive.mail_access;
web_archive.quota to archive.quota;
web_archive,max_month to archive.max_month.

Though config files of exisiting lists will be updated during upgrading process, listmasters are highly recommended to check new configuration.
Customized scenarios, list creation templeates and edit_list.conf will never be upgraded automatically.  They should be modified manually, if neccessary.



git-svn-id: https://subversion.renater.fr/sympa/branches/sympa-6.2-branch@11789 05aa8bb8-cd2b-0410-b1d7-8918dfa770ce
parent 6257c217
......@@ -12,12 +12,11 @@ send confidential
reject_mail_from_automates_feature on
web_archive
access private
process_archive on
archive
period month
access owner
web_access private
mail_access owner
clean_delay_queuemod 15
......
......@@ -36,12 +36,11 @@ send privateoreditorkey
topics [% topics %]
[% END -%]
web_archive
access public
process_archive on
archive
access owner
period week
web_access public
mail_access owner
digest 1,4 13:26
......@@ -54,8 +53,8 @@ d_read public
pictures_feature on
creation
date_epoch [% creation.date_epoch %]
date [% creation.date %]
date_epoch [% creation.date_epoch %]
date [% creation.date %]
[% IF creation_email -%]
email [% creation_email %]
email [% creation_email %]
[% END -%]
......@@ -12,12 +12,11 @@ send public
reject_mail_from_automates_feature off
web_archive
access private
process_archive on
archive
period month
access owner
web_access private
mail_access owner
clean_delay_queuemod 15
......
......@@ -16,12 +16,11 @@ reception mail,nomail,txt,html
default_user_options
reception html
web_archive
access public
process_archive on
archive
period year
access owner
web_access public
mail_access owner
clean_delay_queuemod 15
......
......@@ -10,12 +10,11 @@ visibility noconceal
send privateorpublickey
web_archive
access intranet
process_archive on
archive
period month
access owner
web_access intranet
mail_access owner
clean_delay_queuemod 15
......
......@@ -10,12 +10,11 @@ visibility noconceal
send editorkeyonly
web_archive
access public
process_archive on
archive
period year
access owner
web_access public
mail_access owner
clean_delay_queuemod 15
......
......@@ -12,12 +12,11 @@ send privateoreditorkey
reject_mail_from_automates_feature off
web_archive
access private
process_archive on
archive
period month
access owner
web_access private
mail_access owner
clean_delay_queuemod 15
......
......@@ -10,12 +10,11 @@ visibility noconceal
send privateoreditorkey
web_archive
access public
process_archive on
archive
period month
access owner
web_access public
mail_access owner
clean_delay_queuemod 15
......
......@@ -44,7 +44,11 @@ ttl owner,privileged_owner hidden
shared_doc owner,privileged_owner write
shared_doc.quota owner,privileged_owner read
web_archive.quota owner,privileged_owner read
process_archive owner,privileged_owner read
archive.web_access owner,privileged_owner write
archive.quota owner,privileged_owner read
archive.max_month owner,privileged_owner write
archive owner,privileged_owner read
review owner read
review privileged_owner write
......@@ -71,8 +75,6 @@ clean_delay_queuemod owner,privileged_owner hidden
bounce owner,privileged_owner read
archive owner,privileged_owner read
host owner,privileged_owner read
account owner,privileged_owner hidden
......
......@@ -1784,8 +1784,8 @@ while ($query = new_loop()) {
and $list->is_list_member($param->{'user'}{'email'});
 
return 0
if $permission eq 'web_archive.access'
and not defined $list->{'admin'}{'web_archive'};
if $permission eq 'archive.web_access'
and not defined $list->{'admin'}{'archive'};
 
return 1;
};
......@@ -3573,13 +3573,13 @@ sub check_param_out {
# SJS END
 
## Archives Access control
if (defined $list->{'admin'}{'web_archive'}) {
if (defined $list->{'admin'}{'archive'}) {
$param->{'is_archived'} = 1;
 
## Check if the current user may access web archives
my $result = Sympa::Scenario::request_action(
$list,
'web_archive.access',
'archive.web_access',
$param->{'auth_method'},
{ 'sender' => $param->{'user'}{'email'},
'remote_host' => $param->{'remote_host'},
......@@ -3598,7 +3598,7 @@ sub check_param_out {
## Check if web archive is publically accessible (useful
## information for RSS)
$result = Sympa::Scenario::request_action(
$list, 'web_archive.access',
$list, 'archive.web_access',
$param->{'auth_method'},
{'sender' => 'nobody'}
);
......@@ -9871,7 +9871,7 @@ sub do_arc {
}
 
## Access control
unless (defined check_authz('do_arc', 'web_archive.access')) {
unless (defined check_authz('do_arc', 'archive.web_access')) {
$param->{'previous_action'} = 'arc';
$param->{'previous_list'} = $list->{'name'};
return undef;
......@@ -10063,7 +10063,7 @@ sub do_latest_arc {
 
## Access control
return undef
unless (defined check_authz('do_latest_arc', 'web_archive.access'));
unless (defined check_authz('do_latest_arc', 'archive.web_access'));
 
## parameters of the query
my $today = time;
......@@ -10508,7 +10508,7 @@ sub do_view_source {
$in{'list'}, $in{'yyyy'}, $in{'month'}, $in{'msgid'});
 
## Access control
unless (defined check_authz('do_arc', 'web_archive.access')) {
unless (defined check_authz('do_arc', 'archive.web_access')) {
$param->{'previous_action'} = 'arc';
$param->{'previous_list'} = $list->{'name'};
return undef;
......@@ -10668,7 +10668,7 @@ sub do_arcsearch_form {
## Access control
return undef
unless (
defined check_authz('do_arcsearch_form', 'web_archive.access'));
defined check_authz('do_arcsearch_form', 'archive.web_access'));
 
my $search_base =
Conf::get_robot_conf($robot, 'arc_path') . '/' . $list->get_list_id();
......@@ -10692,7 +10692,7 @@ sub do_arcsearch {
 
## Access control
return undef
unless (defined check_authz('do_arcsearch', 'web_archive.access'));
unless (defined check_authz('do_arcsearch', 'archive.web_access'));
 
my $search = Sympa::Marc::Search->new;
$search->search_base(Conf::get_robot_conf($robot, 'arc_path') . '/'
......@@ -10838,7 +10838,7 @@ sub do_arcsearch_id {
 
## Access control
return undef
unless (defined check_authz('do_arcsearch_id', 'web_archive.access'));
unless (defined check_authz('do_arcsearch_id', 'archive.web_access'));
 
my $search = Sympa::Marc::Search->new;
$search->search_base(Conf::get_robot_conf($robot, 'arc_path') . '/'
......@@ -12090,7 +12090,7 @@ sub do_rebuildallarc {
 
my $all_lists = Sympa::List::get_lists($robot);
foreach my $list (@$all_lists) {
next unless (defined $list->{'admin'}{'web_archive'});
next unless defined $list->{'admin'}{'archive'};
my $file =
$Conf::Conf{'queueoutgoing'}
. '/.rebuild.'
......@@ -22786,7 +22786,7 @@ sub do_attach {
 
## Access control
return undef
unless (defined check_authz('do_attach', 'web_archive.access'));
unless (defined check_authz('do_attach', 'archive.web_access'));
 
# parameters for the template file
# view a file
......@@ -23548,7 +23548,7 @@ sub do_arc_manage {
wwslog('info', '(%s)', $in{'list'});
 
## Access control
unless (defined check_authz('do_arc', 'web_archive.access')) {
unless (defined check_authz('do_arc', 'archive.web_access')) {
return undef;
}
 
......@@ -23571,7 +23571,7 @@ sub do_arc_download {
wwslog('info', '(%s)', $in{'list'});
 
## Access control
unless (defined check_authz('do_arc', 'web_archive.access')) {
unless (defined check_authz('do_arc', 'archive.web_access')) {
return undef;
}
 
......@@ -23832,7 +23832,7 @@ sub do_arc_delete {
wwslog('info', '(%s)', $in{'list'});
 
## Access control
unless (defined check_authz('do_arc', 'web_archive.access')) {
unless (defined check_authz('do_arc', 'archive.web_access')) {
return undef;
}
 
......
......@@ -85,6 +85,14 @@ our @params = (
'optional' => '1',
'vhost' => '1',
},
{ 'name' => 'process_archive',
'default' => 'off',
'gettext_id' => 'Store distributed messages into archive',
'gettext_comment' => 'This setting can be overridden by each list',
'vhost' => '1',
'file' => 'sympa.conf',
'edit' => '1',
},
{ 'name' => 'voot_feature',
'default' => 'off',
'file' => 'sympa.conf',
......
......@@ -264,6 +264,11 @@ Archives the Mail::Internet message given as argument.
Returns true is the list is configured to keep archives of
its messages.
=item is_archiving_enabled ( )
Returns true is the list is configured to keep archives of
its messages, i.e. process_archive parameter is set to "on".
=item get_stats ( OPTION )
Returns either a formatted printable strings or an array whith
......@@ -328,7 +333,7 @@ my %list_option = (
# bouncers_level2.notification, bouncers_level1.notification,
# welcome_return_path, remind_return_path, rfc2369_header_fields,
# archive.access
# archive.mail_access
'owner' => {'gettext_id' => 'owner'},
# bouncers_level2.notification, bouncers_level1.notification
......@@ -416,7 +421,7 @@ my %list_option = (
'mime' => {'gettext_id' => 'add a new MIME part'},
'append' => {'gettext_id' => 'append to message body'},
# archive.access
# archive.mail_access
'open' => {'gettext_id' => 'open'},
'closed' => {'gettext_id' => 'closed'},
'private' => {'gettext_id' => 'subscribers only'},
......@@ -1738,7 +1743,9 @@ sub distribute_msg {
}
## Archives
$self->archive_msg($message);
if ($self->is_archiving_enabled) {
$self->archive_msg($message);
}
# Transformation of message after archiving.
$self->post_archive($message, $sequence);
......@@ -5638,7 +5645,7 @@ sub may_do {
$who =~ y/A-Z/a-z/;
if ($action =~ /^(index|get)$/io) {
my $arc_access = $admin->{'archive'}{'access'};
my $arc_access = $admin->{'archive'}{'mail_access'};
if ($arc_access =~ /^public$/io) {
return 1;
} elsif ($arc_access =~ /^private$/io) {
......@@ -5745,7 +5752,7 @@ sub archive_msg {
my ($self, $message) = @_;
Log::do_log('debug2', 'For %s', $self->{'name'});
if ($self->is_archived()) {
if ($self->is_archiving_enabled) {
my $msg_string = $message->to_string(
original => Sympa::Tools::Data::smart_eq(
$self->{admin}{archive_crypted_msg}, 'original'
......@@ -5809,7 +5816,7 @@ sub is_moderated {
## Is the list archived?
sub is_archived {
Log::do_log('debug', '');
if (shift->{'admin'}{'web_archive'}{'access'}) {
if (shift->{'admin'}{'archive'}{'web_access'}) {
Log::do_log('debug', '1');
return 1;
}
......@@ -5821,11 +5828,16 @@ sub is_archived {
sub is_web_archived {
my $self = shift;
return 1
if ref $self->{'admin'}{'web_archive'} eq 'HASH'
and $self->{'admin'}{'web_archive'}{'access'};
if ref $self->{'admin'}{'archive'} eq 'HASH'
and $self->{'admin'}{'archive'}{'web_access'};
return undef;
}
sub is_archiving_enabled {
return Sympa::Tools::Data::smart_eq(shift->{'admin'}{'process_archive'},
'on');
}
## Returns 1 if the digest must be send
sub get_nextdigest {
my $self = shift;
......@@ -7317,7 +7329,7 @@ sub _load_list_members_from_include {
$entry->{'source'});
return undef;
}
my $include_member;
## the file has parameters
if (defined $entry->{'source_parameters'}) {
......@@ -7347,12 +7359,12 @@ sub _load_list_members_from_include {
$include_file);
}
my @types = keys %{$include_member};
my $type = $types[0];
my @defs = @{$include_member->{$type}};
my $def = $defs[0];
push @{$admin->{$type}},$def;
my $type = $types[0];
my @defs = @{$include_member->{$type}};
my $def = $defs[0];
push @{$admin->{$type}}, $def;
}
foreach my $type (@sources_providing_listmembers) {
foreach my $tmp_incl (@{$admin->{$type}}) {
......@@ -9648,7 +9660,7 @@ sub lowercase_field {
sub by_order {
(($Sympa::ListDef::pinfo{$main::a || ''}{'order'} || 0)
<=> ($Sympa::ListDef::pinfo{$main::b || ''}{'order'} || 0))
|| (($main::a || '') cmp ($main::b || ''));
|| (($main::a || '') cmp($main::b || ''));
}
## Apply defaults to parameters definition (%Sympa::ListDef::pinfo)
......
......@@ -38,7 +38,7 @@ our %default = (
our @param_order =
qw (subject visibility info subscribe add unsubscribe del owner owner_include
send editor editor_include delivery_time account topics
host lang web_archive archive digest digest_max_size available_user_options
host lang process_archive web_archive archive digest digest_max_size available_user_options
default_user_options msg_topic msg_topic_keywords_apply_on msg_topic_tagging reply_to_header reply_to forced_reply_to *
verp_rate tracking welcome_return_path remind_return_path user_data_source include_file include_remote_file
include_list include_remote_sympa_list include_ldap_query
......@@ -640,14 +640,22 @@ our %pinfo = (
### Archives page ###
'process_archive' => {
'group' => 'archives',
'gettext_id' => "Store distributed messages into archive",
'format' => ['on', 'off'],
'default' => {'conf' => 'process_archive'},
},
'web_archive' => {
'obsolete' => '1', # Merged into archive.
'group' => 'archives',
'gettext_id' => "Web archives",
'format' => {
'access' => {
'order' => 1,
'gettext_id' => "access right",
'scenario' => 'access_web_archive'
'scenario' => 'access_web_archive',
'obsolete' => 1, # Use archive.web_access
},
'quota' => {
'order' => 2,
......@@ -655,33 +663,60 @@ our %pinfo = (
'gettext_unit' => 'Kbytes',
'format' => '\d+',
'default' => {'conf' => 'default_archive_quota'},
'length' => 8
'length' => 8,
'obsolete' => 1, # Use archive.quota
},
'max_month' => {
'order' => 3,
'gettext_id' => "Maximum number of month archived",
'format' => '\d+',
'length' => 3
'length' => 3,
'obsolete' => 1, # Use archive.max_month
}
}
},
'archive' => {
'group' => 'archives',
'gettext_id' => "Text archives",
'gettext_id' => "Archives",
'format' => {
'period' => {
'order' => 1,
'gettext_id' => "frequency",
'format' => ['day', 'week', 'month', 'quarter', 'year'],
'synonym' => {'weekly' => 'week'},
'obsolete' => 1,
'obsolete' => 1, # Not yet implemented.
},
'access' => {
'order' => 2,
'gettext_id' => "access right",
'format' => ['open', 'private', 'public', 'owner', 'closed'],
'synonym' => {'open' => 'public'},
'obsolete' => 1, # Use archive.mail_access
},
'web_access' => {
'order' => 3,
'gettext_id' => "access right",
'scenario' => 'access_web_archive'
},
'mail_access' => {
'order' => 4,
'gettext_id' => "access right by mail commands",
'format' => ['open', 'private', 'public', 'owner', 'closed'],
'synonym' => {'open' => 'public'}
},
'quota' => {
'order' => 5,
'gettext_id' => "quota",
'gettext_unit' => 'Kbytes',
'format' => '\d+',
'default' => {'conf' => 'default_archive_quota'},
'length' => 8
},
'max_month' => {
'order' => 6,
'gettext_id' => "Maximum number of month archived",
'format' => '\d+',
'length' => 3
}
}
},
......@@ -914,7 +949,8 @@ our %pinfo = (
'group' => 'data_source',
'gettext_id' => "List inclusion",
'format' => Sympa::Regexps::listname() . '(\@'
. Sympa::Regexps::host() . ')?(\s+filter\s+.+)?',
. Sympa::Regexps::host()
. ')?(\s+filter\s+.+)?',
'occurrence' => '0-n'
},
......@@ -2169,7 +2205,8 @@ sub cleanup {
&& $v->{'format'}{$k}{'scenario'}) {
$v->{'format'}{$k}{'format'} = Sympa::Regexps::scenario();
$v->{'format'}{$k}{'default'} = 'default'
unless (($p eq 'web_archive') && ($k eq 'access'));
unless ($p eq 'web_archive' and $k eq 'access')
or ($p eq 'archive' and $k eq 'web_access');
}
## Task format
......
......@@ -384,7 +384,7 @@ sub request_action {
if (defined $list->{'admin'}{$operations[0]});
}
## List parameter might not be defined (example : web_archive.access)
# List parameter might not be defined (example : archive.web_access)
unless (defined $scenario_path) {
my $return = {
'action' => 'reject',
......
......@@ -153,7 +153,9 @@ sub upgrade {
my $all_lists = Sympa::List::get_lists('*');
foreach my $list (@$all_lists) {
# FIXME: line below will always success
next unless (defined $list->{'admin'}{'web_archive'});
next
unless defined $list->{'admin'}{'web_archive'}
or defined $list->{'admin'}{'archive'};
my $file =
$Conf::Conf{'queueoutgoing'}
. '/.rebuild.'
......@@ -557,7 +559,9 @@ sub upgrade {
my $all_lists = Sympa::List::get_lists('*');
foreach my $list (@$all_lists) {
# FIXME: next line always success
next unless (defined $list->{'admin'}{'web_archive'});
next
unless defined $list->{'admin'}{'web_archive'}
or defined $list->{'admin'}{'archive'};
my $file =
$Conf::Conf{'queueoutgoing'}
. '/.rebuild.'
......@@ -1383,6 +1387,43 @@ sub upgrade {
if @performed;
}
# As of 6.2b.1, several list parameters are renamed or added.
if (lower_version($previous_version, '6.2b.1')) {
Log::do_log('notice', 'Upgrading list config...');
my $all_lists = Sympa::List::get_lists('*');
foreach my $list (@$all_lists) {
$list->{'admin'}{'archive'} = {}
unless ref $list->{'admin'}{'archive'} eq 'HASH';
$list->{'admin'}{'archive'}{'mail_access'} =
$list->{'admin'}{'archive'}{'access'}
if $list->{'admin'}{'archive'}{'access'};
delete $list->{'admin'}{'archive'}{'access'};
if (ref $list->{'admin'}{'web_archive'} eq 'HASH'
and $list->{'admin'}{'web_archive'}{'access'}) {
$list->{'admin'}{'process_archive'} = 'on';
delete $list->{'admin'}{'defaults'}{'process_archive'};
#} else {
# $list->{'admin'}{'process_archive'} = 'off';
}
if (ref $list->{'admin'}{'web_archive'} eq 'HASH') {
$list->{'admin'}{'archive'}{'web_access'} =
$list->{'admin'}{'web_archive'}{'access'}
if $list->{'admin'}{'web_archive'}{'access'};
$list->{'admin'}{'archive'}{'quota'} =
$list->{'admin'}{'web_archive'}{'quota'}
if $list->{'admin'}{'web_archive'}{'quota'};
$list->{'admin'}{'archive'}{'max_month'} =
$list->{'admin'}{'web_archive'}{'max_month'}
if $list->{'admin'}{'web_archive'}{'max_month'};
}
delete $list->{'admin'}{'web_archive'};
$list->save_config('automatic');
}
}