[Mailman-Users] Moderation and Whitelisting

Mark Sapiro msapiro at value.net
Sat Jul 28 00:52:06 CEST 2007


Derek J. Balling wrote:
>
>Is there any way to have *one concise* place for "Who is able to send  
>to a list"?
>
>We have some campus-wide lists. Sometimes the people who can send to  
>them are members of the list. Sometimes they're not. Sometimes they  
>are members and then later vanish from the list automatically, even  
>though they still have the right to post to them (e.g., if they move  
>from one building to another, but they are able to send to all the  
>auto-populated building-specific mailing lists).
>
>This whole "having to look to see if they're a member, in which case  
>we want to turn off their mod bit, otherwise, go and manually add them  
>to the whitelist" routine, well, frankly it sucks.


If you're willing to have all approved posters to a list know the list
moderator password, They can post with an 'Approved: password' header
whether or not they are list members or moderated.


>Ideal would be to have the value of "accept_these_nonmembers" also  
>work if the person listed is a member (and maybe someday simply call  
>it "accept_these_posters_always" or something like that).
>
>Has anyone either [a] figured out some cool function of Mailman that  
>we're missing, or [b] come up with an easy hack to mailman to allow it  
>to use that value for member posters as well as nonmember?


You could create a custom handler (see
<http://www.python.org/cgi-bin/faqw-mm.py?req=show&file=faq04.067.htp>)
to be run in the pipeline before Moderate (just as in the FAQ
example), and it could check if the message sender is in
accept_these_nonmembers, and set the approved flag in the message
metadata if so. The entire handler could be as simple as


from Mailman.Handlers.Moderate import matches_p

def process(mlist, msg, msgdata):
    if matches_p(msg.get_sender(), mlist.accept_these_nonmembers):
        msgdata['approved'] = True


This would have the effect of bypassing all membership and moderation
tests as well as any of the various Hold.py tests including
administrivia, max_num_recipients, require_explicit_destination,
bounce_matching_headers and max_message_size for anyone who matched
accept_these_nonmembers.

If you wanted to retain the Hold.py holds for these posters, It is a
bit more complicated. You could reorder the pipeline so that Hold came
before your handler and Moderate after, or you could set your own flag
in your handler and patch Moderate.py to test it. OTOH, if you're
going to patch Moderate.py, you could simple add

    if matches_p(msg.get_sender(), mlist.accept_these_nonmembers):
        return

to the beginning of the process() function in Moderate.py.

-- 
Mark Sapiro <msapiro at value.net>       The highway is for gamblers,
San Francisco Bay Area, California    better use your sense - B. Dylan



More information about the Mailman-Users mailing list