diff options
| author | fukachan <fukachan> | 2008-06-28 21:08:26 +0000 |
|---|---|---|
| committer | fukachan <fukachan> | 2008-06-28 21:08:26 +0000 |
| commit | 8620989b32b8ca0a9557f988bd66e3dbd177ff4a (patch) | |
| tree | 4e6024f45837f88b88f483c723964cfa1c7868c0 /fml/lib/FML | |
| parent | e1d2a9638cd6839464e824390e0136d4c12f76e2 (diff) | |
| download | fml8-8620989b32b8ca0a9557f988bd66e3dbd177ff4a.tar.gz fml8-8620989b32b8ca0a9557f988bd66e3dbd177ff4a.tar.bz2 fml8-8620989b32b8ca0a9557f988bd66e3dbd177ff4a.zip | |
"who can do newml operations" code is rewritten to use of
createonpost_newml_restrictions.
Diffstat (limited to 'fml/lib/FML')
| -rw-r--r-- | fml/lib/FML/Process/CreateOnPost.pm | 52 |
1 files changed, 7 insertions, 45 deletions
diff --git a/fml/lib/FML/Process/CreateOnPost.pm b/fml/lib/FML/Process/CreateOnPost.pm index 5315152f..0c208d2a 100644 --- a/fml/lib/FML/Process/CreateOnPost.pm +++ b/fml/lib/FML/Process/CreateOnPost.pm @@ -3,7 +3,7 @@ # Copyright (C) 2006,2008 Ken'ichi Fukamachi # All rights reserved. # -# $FML: CreateOnPost.pm,v 1.5 2008/06/08 03:09:13 fukachan Exp $ +# $FML: CreateOnPost.pm,v 1.6 2008/06/08 13:13:09 fukachan Exp $ # package FML::Process::CreateOnPost; @@ -564,55 +564,17 @@ sub _create_ml # Descriptions: check if the sender is allowed to create a new ML. -# Arguments: OBJ($self) +# Arguments: OBJ($curproc) # Side Effects: none # Return Value: NUM(1 or 0) sub _is_sender_allowed_to_create_ml { my ($curproc) = @_; - my $ml_domain = $curproc->default_domain(); - my $config = $curproc->config(); - my $cred = $curproc->credential(); - my $header = $curproc->incoming_message_header(); - my $from = $header->address_cleanup( $header->get('from') ); - my $status = 0; - my $map_count = 0; - - # 1. check $createonpost_maintainer_maps. - my $maintainer_maps = - $config->get_as_array_ref('createonpost_maintainer_maps') || []; - - # sanity - return 0 unless defined $maintainer_maps; - - # check if from: address is contained in either map. - MAP: - for my $map (@$maintainer_maps) { - if (defined $map) { - my $is_valid = $cred->is_valid_map($map, $config); - if ($is_valid) { - $map_count++; - $status = $cred->has_address_in_map($map, $config, $from); - last MAP if $status; - } - else { - $curproc->logdebug("invalid map: $map"); - } - } - } - - # 2. try the default naive restriction if no valid map. - unless ($map_count) { - $curproc->logdebug("no valid map: createonpost_maintainer_maps"); - - # ok if same domain (user@domain == ml@domain). - if ($from =~ /\@$ml_domain$/i) { - $curproc->log("from address is our domain <$ml_domain>"); - return 1; - } - } - return $status; + my $restriction = 'createonpost_newml_restrictions', + my $addr_list = $curproc->_apply_restrictions($restriction); + my $is_allowed = $addr_list->{ permit } ? 1 : 0; + return $is_allowed; } @@ -626,7 +588,7 @@ Ken'ichi Fukamachi =head1 COPYRIGHT -Copyright (C) 2006 Ken'ichi Fukamachi +Copyright (C) 2006,2008 Ken'ichi Fukamachi All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. |
