Skip to content

Commit

Permalink
Merge pull request #391 from ikedas/issue-297 by ikedas
Browse files Browse the repository at this point in the history
Prevent the use of the list address as owner or moderator #297
  • Loading branch information
ikedas authored Aug 16, 2018
2 parents b9f2e1a + c6acbbd commit 52afb77
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 10 deletions.
16 changes: 15 additions & 1 deletion src/lib/Sympa/List/Users.pm
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,20 @@ use constant _global_validations => {
};

use constant _local_validations => {
# Checking that list owner/editor address is not set to list address.
list_address => sub {
my $self = shift;
my $new = shift;

my $list = $self->{context};

my $email = Sympa::Tools::Text::canonic_email($new);
return 'syntax_errors'
unless defined $email;

return 'incorrect_email'
if Sympa::get_address($list) eq $email;
},
# Checking that list editor address is not set to editor special address.
list_editor_address => sub {
my $self = shift;
Expand All @@ -133,7 +147,7 @@ use constant _local_validations => {
unless defined $email;

return 'incorrect_email'
if Sympa::get_address($list, 'editor') eq $new;
if Sympa::get_address($list, 'editor') eq $email;
},
# Checking that list owner address is not set to one of the special
# addresses.
Expand Down
21 changes: 12 additions & 9 deletions src/lib/Sympa/ListDef.pm
Original file line number Diff line number Diff line change
Expand Up @@ -2492,14 +2492,15 @@ our %user_info = (
'Owners are managing subscribers of the list. They may review subscribers and add or delete email addresses from the mailing list. If you are a privileged owner of the list, you can choose other owners for the mailing list. Privileged owners may edit a few more options than other owners. ',
format => {
email => {
order => 2,
gettext_id => "email address",
format_s => '$email',
occurrence => '1',
length => 30,
filters => ['canonic_email'],
validations =>
[qw(list_special_addresses unique_paragraph_key)],
order => 2,
gettext_id => "email address",
format_s => '$email',
occurrence => '1',
length => 30,
filters => ['canonic_email'],
validations => [
qw(list_address list_special_addresses unique_paragraph_key)
],
},
gecos => {
order => 3,
Expand Down Expand Up @@ -2587,7 +2588,9 @@ our %user_info = (
occurrence => '1',
length => 30,
filters => ['canonic_email'],
validations => [qw(list_editor_address unique_paragraph_key)],
validations => [
qw(list_address list_editor_address unique_paragraph_key)
],
},
gecos => {
order => 2,
Expand Down

0 comments on commit 52afb77

Please sign in to comment.