FAQ
Hi

[Mailman 2.1.5, Debian sarge, exim 4, Apache 2]

I'm developing a new Mailman service here, and want to be able to change
the available list of things that a mail owner/admin can change for
their list. Some things I can configure from mm_cfg.py, but not
everything.

For instance, I do not want the list owner to be changed: this request
has to come to the Computer Centre in other ways. There does not seem to
be a way of restricting this by default.

The only way I have currently found is to modify Mailman/Gui/General.py
and comment out the admin section of the list that is returned. This
does exactly what I want, but of course involves changing "program"
files rather than "config" files.

If there is no standard way of doing this, I will probably look at
writing a patch where there is a list, say mm_cfg.RESTRICT_CHANGES, that
contains all configuration sections that should not be shown. Is this
a good idea?


I would also like to hook into the subscription code to, do at least two
things: automatically change all addresses with
s/@le\.ac\.uk$/@leicester.ac.uk/ and to block subscription requests that
match /@lists\.le(icester)?\.ac\.uk/ (I do not want to allow umbrella
lists). Is there a standard way, or hook into the code, for doing this
(on a site-wide basis, not per list)?

Thanks for any help you can give!

--
Matthew Newton <mcn4 at le.ac.uk>

UNIX and e-mail Systems Administrator, Network Support Section,
Computer Centre, University of Leicester,
Leicester LE1 7RH, United Kingdom

Search Discussions

  • Brad Knowles at Mar 9, 2005 at 12:27 am

    At 5:55 PM +0000 2005-03-08, Matthew Newton wrote:

    If there is no standard way of doing this, I will probably look at
    writing a patch where there is a list, say mm_cfg.RESTRICT_CHANGES, that
    contains all configuration sections that should not be shown. Is this
    a good idea?
    That sounds like a reasonable solution.
    I would also like to hook into the subscription code to, do at least two
    things: automatically change all addresses with
    s/@le\.ac\.uk$/@leicester.ac.uk/ and to block subscription requests that
    match /@lists\.le(icester)?\.ac\.uk/ (I do not want to allow umbrella
    lists). Is there a standard way, or hook into the code, for doing this
    (on a site-wide basis, not per list)?
    I'm not aware of a standard way to do this sort of stuff.

    --
    Brad Knowles, <brad at stop.mail-abuse.org>

    "Those who would give up essential Liberty, to purchase a little
    temporary Safety, deserve neither Liberty nor Safety."

    -- Benjamin Franklin (1706-1790), reply of the Pennsylvania
    Assembly to the Governor, November 11, 1755

    SAGE member since 1995. See <http://www.sage.org/> for more info.
  • Matthew Newton at Mar 15, 2005 at 5:58 pm
    Hi

    Regarding the message I sent the other day...
    On Tue, Mar 08, 2005 at 05:55:00PM +0000, Matthew Newton wrote:
    I'm developing a new Mailman service here, and want to be able to change
    the available list of things that a mail owner/admin can change for
    their list. Some things I can configure from mm_cfg.py, but not
    everything. <snip>
    If there is no standard way of doing this, I will probably look at
    writing a patch where there is a list, say mm_cfg.RESTRICT_CHANGES, that
    contains all configuration sections that should not be shown. Is this
    a good idea?
    Please find attached site_hide_list_options.patch that adds a new option
    SITE_HIDE_LIST_OPTIONS. Any options given in this list will not be
    displayed on the admin pages. Example:

    SITE_HIDE_LIST_OPTIONS = ['owner',
    'umbrella_list',
    'umbrella_member_suffix']
    I would also like to hook into the subscription code to, do at least two
    things: automatically change all addresses with
    s/@le\.ac\.uk$/@leicester.ac.uk/ and to block subscription requests that
    match /@lists\.le(icester)?\.ac\.uk/ (I do not want to allow umbrella
    lists). Is there a standard way, or hook into the code, for doing this
    (on a site-wide basis, not per list)?
    Secondly, the attached patch, transform_address_hook.patch, adds a new
    hook into the add member routines to allow the address to be changed.
    The function is given the supplied address, and should return the new
    address, or raise an error. An example for my site, where all addresses
    in the domain "le.ac.uk" should be changed to "leicester.ac.uk" is:

    def transform_email_address(email):
    (local, domain) = email.split("@", 2)
    if domain == "le.ac.uk":
    domain = "leicester.ac.uk"
    return "@".join([local, domain])

    Hope these are useful.

    Thanks!

    Matthew

    (Please let me know if I should subscribe to the development list, and
    send these patches there!)


    --
    Matthew Newton <mcn4 at le.ac.uk>

    UNIX and e-mail Systems Administrator, Network Support Section,
    Computer Centre, University of Leicester,
    Leicester LE1 7RH, United Kingdom
    -------------- next part --------------
    Index: trunk/Mailman/Defaults.py.in
    ===================================================================
    --- trunk/Mailman/Defaults.py.in (revision 16)
    +++ trunk/Mailman/Defaults.py.in (working copy)
    @@ -109,6 +109,10 @@
    # name of the temporary file that the program should operate on.
    HTML_TO_PLAIN_TEXT_COMMAND = '/usr/bin/lynx -dump %(filename)s'

    +# Site-wide prohibition from changing certain list options. Adding
    +# an option to this list (for example, "owner") will stop the
    +# option from being seen in the list admin pages.
    +SITE_HIDE_LIST_OPTIONS = []


    #####
    Index: trunk/Mailman/MailList.py
    ===================================================================
    --- trunk/Mailman/MailList.py (revision 16)
    +++ trunk/Mailman/MailList.py (working copy)
    @@ -426,6 +426,18 @@
    if hasattr(gui, 'GetConfigInfo'):
    value = gui.GetConfigInfo(self, category, subcat)
    if value:
    + title = None
    + for item in value[1:]:
    + if not isinstance(item, TupleType):
    + if title is not None:
    + value.remove(title)
    + title = item
    + if not isinstance(item, TupleType) or len(item) < 5:
    + continue
    + if item[0] in mm_cfg.SITE_HIDE_LIST_OPTIONS:
    + value.remove(item)
    + else:
    + title = None
    return value


    -------------- next part --------------
    Index: trunk/Mailman/Cgi/admin.py
    ===================================================================
    --- trunk/Mailman/Cgi/admin.py (revision 17)
    +++ trunk/Mailman/Cgi/admin.py (working copy)
    @@ -1320,12 +1320,13 @@
    # to render the status page.
    for entry in entries:
    fullname, address = parseaddr(entry)
    - # Canonicalize the full name
    - fullname = Utils.canonstr(fullname, mlist.preferred_language)
    - userdesc = UserDesc(address, fullname,
    - Utils.MakeRandomPassword(),
    - digest, mlist.preferred_language)
    try:
    + address = mm_cfg.transform_email_address(address)
    + # Canonicalize the full name
    + fullname = Utils.canonstr(fullname, mlist.preferred_language)
    + userdesc = UserDesc(address, fullname,
    + Utils.MakeRandomPassword(),
    + digest, mlist.preferred_language)
    if subscribe_or_invite:
    if mlist.isMember(address):
    raise Errors.MMAlreadyAMember
    Index: trunk/Mailman/Defaults.py.in
    ===================================================================
    --- trunk/Mailman/Defaults.py.in (revision 17)
    +++ trunk/Mailman/Defaults.py.in (working copy)
    @@ -114,6 +114,21 @@
    # option from being seen in the list admin pages.
    SITE_HIDE_LIST_OPTIONS = []

    +# Helper function to transform e-mail addresses. Use, for example,
    +# when the list is run on a large site such as a university, and
    +# two domain names are in use, but people may not realise to
    +# subscribe with their proper address.
    +#
    +# example:
    +# transform_email_address('original at secondary.domain.name')
    +# ==> original at primary.domain.name
    +#
    +# default is to return the same address.
    +
    +def transform_email_address(address):
    + return address
    +
    +

    #####
    # Virtual domains
    Index: trunk/Mailman/MailList.py
    ===================================================================
    --- trunk/Mailman/MailList.py (revision 17)
    +++ trunk/Mailman/MailList.py (working copy)
    @@ -931,6 +931,7 @@
    admin_notif = self.admin_notify_mchanges
    # Suck values out of userdesc, and apply defaults.
    email = Utils.LCDomain(userdesc.address)
    + email = mm_cfg.transform_email_address(email)
    name = getattr(userdesc, 'fullname', '')
    lang = getattr(userdesc, 'language', self.preferred_language)
    digest = getattr(userdesc, 'digest', None)
  • Brad Knowles at Mar 15, 2005 at 6:10 pm

    At 5:58 PM +0000 2005-03-15, Matthew Newton wrote:

    (Please let me know if I should subscribe to the development list, and
    send these patches there!)
    Yeah, this stuff is really more suitable for discussion on the
    development list. You're more likely to run into more people who can
    talk to you intelligently about what works and what doesn't, why,
    programming style, etc....

    Some of the developers are also over here on mailman-users, but
    the traffic on this list is much higher and many of them don't have
    the time to try to keep up with both lists.

    --
    Brad Knowles, <brad at stop.mail-abuse.org>

    "Those who would give up essential Liberty, to purchase a little
    temporary Safety, deserve neither Liberty nor Safety."

    -- Benjamin Franklin (1706-1790), reply of the Pennsylvania
    Assembly to the Governor, November 11, 1755

    SAGE member since 1995. See <http://www.sage.org/> for more info.
  • Mark Sapiro at Mar 15, 2005 at 6:43 pm

    Matthew Newton wrote:
    (Please let me know if I should subscribe to the development list, and
    send these patches there!)
    The patches should be posted at
    http://sourceforge.net/tracker/?group_id3&atid00103 and
    referenced in a post to mailman-developers at python.org.

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

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupmailman-users @
categoriespython
postedMar 8, '05 at 5:55p
activeMar 15, '05 at 6:43p
posts5
users3
websitelist.org

People

Translate

site design / logo © 2022 Grokbase