diff options
| author | fukachan <fukachan> | 2001-04-15 08:46:39 +0000 |
|---|---|---|
| committer | fukachan <fukachan> | 2001-04-15 08:46:39 +0000 |
| commit | 8e1c59dd34f8f01b14cb0eccc993a69ec1eaf886 (patch) | |
| tree | a70cebce79acbd083b458b859c193856252259d0 | |
| parent | 9c982c205792c28dfd493993b363545f3e676b01 (diff) | |
| download | fml8-8e1c59dd34f8f01b14cb0eccc993a69ec1eaf886.tar.gz fml8-8e1c59dd34f8f01b14cb0eccc993a69ec1eaf886.tar.bz2 fml8-8e1c59dd34f8f01b14cb0eccc993a69ec1eaf886.zip | |
move sender_is_member() to FML::Credential
define premit_post($args) and permit_command($args).
They are the entrance for _check_resitrictions() which compares the
sender address with reject_system_accounts.
| -rw-r--r-- | fml/lib/FML/Process/Kernel.pm | 82 |
1 files changed, 63 insertions, 19 deletions
diff --git a/fml/lib/FML/Process/Kernel.pm b/fml/lib/FML/Process/Kernel.pm index 99ac86ef..94e21b51 100644 --- a/fml/lib/FML/Process/Kernel.pm +++ b/fml/lib/FML/Process/Kernel.pm @@ -5,7 +5,7 @@ # redistribute it and/or modify it under the same terms as Perl itself. # # $Id$ -# $FML: Kernel.pm,v 1.40 2001/04/08 06:13:16 fukachan Exp $ +# $FML: Kernel.pm,v 1.41 2001/04/14 14:44:23 fukachan Exp $ # package FML::Process::Kernel; @@ -312,24 +312,6 @@ sub verify_sender_credential } -=head2 C<sender_is_member($args)> - -not yet implemented. - -=cut - -# Descriptions: -# Arguments: $self $args -# Side Effects: -# Return Value: none -sub sender_is_member -{ - my ($curproc, $args) = @_; - $curproc->{'credential'}->{'sender'} - # &IsMailingListMember( $from ); -} - - =head2 C<simple_loop_check($args)> loop checks following rules of $config->{ header_check_rules }. @@ -427,6 +409,68 @@ sub parse_incoming_message } +=head1 CREDENTIAL + +=head2 C<premit_post($args)> + +permit posting. +The restriction rules are based on C<post_restrictions>. + +=head2 C<premit_command($args)> + +permit fml command use. +The restriction rules are based on C<command_restrictions>. + +=cut + + +sub permit_post +{ + my ($curproc, $args) = @_; + $curproc->_check_resitrictions($args, 'post'); +} + +sub permit_command +{ + my ($curproc, $args) = @_; + $curproc->_check_resitrictions($args, 'command'); +} + +sub _check_resitrictions +{ + my ($curproc, $args, $type) = @_; + my $config = $curproc->{ config }; + my $cred = $curproc->{ credential }; # user credential + + for my $rule (split(/\s+/, $config->{ "${type}_restrictions" })) { + if ($rule eq 'reject_system_accounts') { + my $match = $cred->match_system_accounts($curproc, $args); + if ($match) { + Log("${rule}: $match matches sender address"); + return 0; + } + } + elsif ($rule eq 'permit_members_only') { + # Q: the mail sender is a ML member? + if ($cred->is_member($curproc, $args)) { + # A: If so, we try to distribute this article. + return 1; + } + else { + Log("not a ML member"); + Log( $cred->error() ); + } + } + elsif ($rule eq 'reject') { + return 1; + } + else { + LogWarn("unknown rule=$rule"); + } + } +} + + =head1 MISCELLANEOUS METHODS =head2 C<load_module($args, $module)> |
