Commit 76849217 authored by sikeda's avatar sikeda
Browse files

[bug][#5976] [Reported by I. Vindenes, Universitetet i Oslo] Users can...

[bug][#5976] [Reported by I. Vindenes, Universitetet i Oslo] Users can subscribe to a pending list even if allow_subscribe_if_pending parameter is set to off.


git-svn-id: https://subversion.renater.fr/sympa/branches/sympa-6.2-branch@12857 05aa8bb8-cd2b-0410-b1d7-8918dfa770ce
parent f4ffa322
......@@ -158,6 +158,10 @@ Your configuration regarding this command has not been updated.[%END-%]
[% ELSIF u_err.entry == 'already_subscriber' -%]
[%|loc(u_err.email,u_err.listname)%]The User '%1' is already subscriber of list '%2'.[%END%]
[% ELSIF u_err.entry == 'list_not_open' -%]
[%~ statdesc = BLOCK %][% u_err.status | optdesc('status') %][%END -%]
[%|loc(statdesc)%]Service unavailable because list status is '%1'[%END%]
[% ELSIF u_err.entry == 'max_list_members_exceeded' -%]
[%|loc(u_err.email,u_err.listname,u_err.max_list_members)%]Unable to add user '%1' in list '%2'. Attempt to exceed the max number of members (%3) for this list.[%END%]
......
......@@ -133,7 +133,9 @@
[% ELSIF u_err.msg == 'select_month' %][%|loc%]Please select archive months[%END%]
[% ELSIF u_err.msg == 'no_soap_service' %][%|loc%]No SOAP service[%END%]
[% ELSIF u_err.msg == 'auth_failed' %][%|loc%]Authentication failed[%END%]
[% ELSIF u_err.msg == 'list_not_open' %][%|loc(u_err.status)%]Service unavailable because list status is '%1'[%END%]
[% ELSIF u_err.msg == 'list_not_open' ~%]
[% statdesc = BLOCK %][% u_err.status | optdesc('status') %][%END ~%]
[%|loc(statdesc)%]Service unavailable because list status is '%1'[%END%]
[% ELSIF u_err.msg == 'template_exists' %][%|loc(u_err.argument)%]This Template '%1' already exists[%END%]
[% ELSIF u_err.msg == 'cannot_delete' %][%|loc(u_err.file_del)%]Cannot delete this file '%1'[%END%]
[% ELSIF u_err.msg == 'invalid_filename' %][%|loc(u_err.filename)%]Invalid filename: '%1'[%END%]
......
......@@ -5831,6 +5831,27 @@ sub do_subscribe {
return undef;
}
} else {
# If a list is not 'open' and allow_subscribe_if_pending
# has been set to 'off', returns undef.
unless (
$list->{'admin'}{'status'} eq 'open'
or Conf::get_robot_conf(
$robot, 'allow_subscribe_if_pending'
) eq 'on'
) {
Sympa::Report::reject_report_web('user', 'list_not_open',
{'status' => $list->{'admin'}{'status'}},
$param->{'action'});
wwslog('info', 'List not open');
web_db_log(
{ 'target_email' => $in{'email'},
'status' => 'error',
'error_type' => 'list_not_open'
}
);
return undef;
}
my $defaults = $list->get_default_user_options();
my $u;
%{$u} = %{$defaults};
......@@ -6299,7 +6320,8 @@ sub do_signoff {
} else {
Sympa::Report::reject_report_web(
$result{'category_error'},
$result{'reason_error'}, {'list' => $list->{'name'}},
$result{'reason_error'},
{%{$result{'details_error'} || {}}, 'list' => $list->{'name'}},
$param->{'action'}, $list
);
}
......@@ -6388,6 +6410,26 @@ sub unsubscribe {
$report{'details'} = 'sent_to_owner';
return %report;
} else {
# If a list is not 'open' and allow_subscribe_if_pending has been set
# to 'off' returns error report.
unless ($list->{'admin'}{'status'} eq 'open'
or Conf::get_robot_conf($robot, 'allow_subscribe_if_pending') eq
'on') {
wwslog('info', 'List not open');
web_db_log(
{ 'target_email' => $in{'email'},
'status' => 'error',
'error_type' => 'list_not_open'
}
);
$report{'success'} = 0;
$report{'category_error'} = 'user';
$report{'reason_error'} = 'list_not_open',
$report{'details_error'} =
{'status' => $list->{'admin'}{'status'}};
return %report;
}
unless (
$list->delete_list_member(
'users' => [$authenticated_email_address],
......
......@@ -29,6 +29,7 @@ use warnings;
use Time::HiRes qw();
use Sympa;
use Conf;
use Sympa::Language;
use Sympa::Log;
use Sympa::Tools::Password;
......@@ -66,6 +67,18 @@ sub _twist {
return undef;
}
# If a list is not 'open' and allow_subscribe_if_pending has been set to
# 'off' returns undef.
unless ($list->{'admin'}{'status'} eq 'open'
or
Conf::get_robot_conf($list->{'domain'}, 'allow_subscribe_if_pending')
eq 'on') {
$self->add_stash($request, 'user', 'list_not_open',
{'status' => $list->{'admin'}{'status'}});
$log->syslog('info', 'List %s not open', $list);
return undef;
}
my $u;
my $defaults = $list->get_default_user_options();
%{$u} = %{$defaults};
......
......@@ -29,6 +29,7 @@ use warnings;
use Time::HiRes qw();
use Sympa;
use Conf;
use Sympa::Language;
use Sympa::Log;
......@@ -65,6 +66,18 @@ sub _twist {
return undef;
}
# If a list is not 'open' and allow_subscribe_if_pending has been set to
# 'off' returns undef.
unless ($list->{'admin'}{'status'} eq 'open'
or
Conf::get_robot_conf($list->{'domain'}, 'allow_subscribe_if_pending')
eq 'on') {
$self->add_stash($request, 'user', 'list_not_open',
{'status' => $list->{'admin'}{'status'}});
$log->syslog('info', 'List %s not open', $list);
return undef;
}
# Really delete and rewrite to disk.
unless (
$list->delete_list_member(
......
......@@ -29,6 +29,7 @@ use warnings;
use Time::HiRes qw();
use Sympa;
use Conf;
use Sympa::Language;
use Sympa::Log;
......@@ -81,6 +82,18 @@ sub _twist {
return undef;
}
# If a list is not 'open' and allow_subscribe_if_pending has been set to
# 'off' returns undef.
unless ($list->{'admin'}{'status'} eq 'open'
or
Conf::get_robot_conf($list->{'domain'}, 'allow_subscribe_if_pending')
eq 'on') {
$self->add_stash($request, 'user', 'list_not_open',
{'status' => $list->{'admin'}{'status'}});
$log->syslog('info', 'List %s not open', $list);
return undef;
}
## Really delete and rewrite to disk.
unless (
$list->delete_list_member(
......
......@@ -29,6 +29,7 @@ use warnings;
use Time::HiRes qw();
use Sympa;
use Conf;
use Sympa::Language;
use Sympa::Log;
use Sympa::Tools::Password;
......@@ -83,6 +84,18 @@ sub _twist {
return undef;
}
# If a list is not 'open' and allow_subscribe_if_pending has been set to
# 'off' returns undef.
unless ($list->{'admin'}{'status'} eq 'open'
or
Conf::get_robot_conf($list->{'domain'}, 'allow_subscribe_if_pending')
eq 'on') {
$self->add_stash($request, 'user', 'list_not_open',
{'status' => $list->{'admin'}{'status'}});
$log->syslog('info', 'List %s not open', $list);
return undef;
}
my $u;
my $defaults = $list->get_default_user_options();
%{$u} = %{$defaults};
......
......@@ -866,6 +866,19 @@ sub add {
->faultstring('Unable to add user')->faultdetail($error);
} else {
# If a list is not 'open' and allow_subscribe_if_pending has been set
# to 'off' returns error report.
unless ($list->{'admin'}{'status'} eq 'open'
or Conf::get_robot_conf($robot, 'allow_subscribe_if_pending') eq
'on') {
my $error =
sprintf 'Service unavailable because list status is \'%s\'',
$list->{'admin'}{'status'};
$log->syslog('info', 'List %s not open', $list);
die SOAP::Fault::faultcode("Server")
->faultstring('List not open')->faultdetail($error);
}
my $u;
my $defaults = $list->get_default_user_options();
my $u2 = Sympa::User->new($email);
......@@ -1019,6 +1032,19 @@ sub del {
->faultdetail('Not member of list or not subscribed');
}
# If a list is not 'open' and allow_subscribe_if_pending has been set
# to 'off' returns error report.
unless ($list->{'admin'}{'status'} eq 'open'
or Conf::get_robot_conf($robot, 'allow_subscribe_if_pending') eq
'on') {
my $error =
sprintf 'Service unavailable because list status is \'%s\'',
$list->{'admin'}{'status'};
$log->syslog('info', 'List %s not open', $list);
die SOAP::Fault::faultcode("Server")
->faultstring('List not open')->faultdetail($error);
}
# Really delete and rewrite to disk.
unless (
$list->delete_list_member(
......@@ -1345,6 +1371,19 @@ sub signoff {
);
}
# If a list is not 'open' and allow_subscribe_if_pending has been set
# to 'off' returns error report.
unless ($list->{'admin'}{'status'} eq 'open'
or Conf::get_robot_conf($robot, 'allow_subscribe_if_pending') eq
'on') {
my $error =
sprintf 'Service unavailable because list status is \'%s\'',
$list->{'admin'}{'status'};
$log->syslog('info', 'List %s not open', $list);
die SOAP::Fault::faultcode("Server")
->faultstring('List not open')->faultdetail($error);
}
## Really delete and rewrite to disk.
$list->delete_list_member(
'users' => [$sender],
......@@ -1529,6 +1568,20 @@ sub subscribe {
->faultdetail("SOAP subscribe : update user failed");
}
} else {
# If a list is not 'open' and allow_subscribe_if_pending has been
# set to 'off' returns error report.
unless ($list->{'admin'}{'status'} eq 'open'
or
Conf::get_robot_conf($robot, 'allow_subscribe_if_pending') eq
'on') {
my $error =
sprintf 'Service unavailable because list status is \'%s\'',
$list->{'admin'}{'status'};
$log->syslog('info', 'List %s not open', $list);
die SOAP::Fault::faultcode("Server")
->faultstring('List not open')->faultdetail($error);
}
my $u;
my $defaults = $list->get_default_user_options();
%{$u} = %{$defaults};
......
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