[Mailman-Users] Batch member attributes

Mark Sapiro msapiro at value.net
Tue May 23 06:39:57 CEST 2006


Benjamin Roger wrote:
>
>I am somewhat desperate - I need a few people to be able to post on 
>about 80 lists (cascaded) here, without moderation (moderation being the 
>default setting for members).
>I think that to achieve this, I need to add them as members - and then 
>change their attributes, so they're not moderated, and do *not* receive 
>mails (80 times...).


This is one way to do it, but it is insecure as it allows anyone to
post be spoofing the unmoderated user's address.

A much better way is to give these authorized posters the moderator
password for the lists and have them post using an Approved: header or
first body line. Although, if they reallty need 80 different passwords
each, I can see that would be quite a pain.


>Adding them shouldn't be that much of a problem, with the add_members 
>script.
>But I wonder about changing the attributes. Is there a way, via withlist 
>or anything else, to batch this kind of task?


Yes. You could do it with a withlist script. You could add them too in
the same script if you want to.

The things you need to do in the withlist script would be

from Mailman import mm_cfg
from Mailman.Userdesc import Userdesc

Then to add a member

userdesc = Userdesc()
userdesc.address = <the member's email address>

See the AddMember definition in Mailman/MailList.py for other
(optional) userdesc attributes and their defaults.

Then do

mlist.ApprovedAddMember(userdesc, ack=x, admin_notif=x)

where x is True or False to add the member. The ack and admin_notif
arguments are optional and default to list settings.

To set a member's moderate flag off

mlist.setMemberOption(member, mm_cfg.Moderate, False)

where member is the members email address.

-- 
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