Skip to Content.
Sympa Menu

en - Re: [sympa-users] Allow posts to one list of you're subscribed to another?

Subject: The mailing list for listmasters using Sympa

List archive

Chronological Thread  
  • From: David Verdin <address@concealed>
  • To: address@concealed
  • Subject: Re: [sympa-users] Allow posts to one list of you're subscribed to another?
  • Date: Thu, 8 Oct 2015 17:41:49 +0200

Hi John,

Yes we can. :-)

This is a solution for Sympa 6.2. Code should be slightly different for previous versions because access to database and logs is different. Tell me if it does not work for you.

First, the perl content below in  <your/sympa/home/dir>/etc/custom_conditions/is_user.pm

#!/usr/bin/perl
package CustomCondition::is_user;
use strict;
use warnings;
use Sympa::DatabaseManager;
use Sympa::Log;
sub verify {
  my @args = @_;
    my $sdm = Sympa::DatabaseManager->instance;
    my $log = Sympa::Log->instance;
    my $sth;

    unless (
        $sdm and $sth = $sdm->do_prepared_query(
                q{SELECT count(*) as count
                  FROM subscriber_table
                  WHERE user_subscriber = ?},
            $args[0],
        )
        ) {
        $log->syslog('err', 'Unable to execute custom condition "is_user"');
        return undef;
    }

    my $users = $sth->fetchall_arrayref({}) || [];
    $sth->finish;
    return 1 if ($users->[0]{count} > 0);
    return 0;
}
## Packages must return true.
1;

Then use the following send scenario for your list:

title.gettext All server users.

CustomCondition::is_user([sender])                             smtp,dkim,md5,smime    -> do_it
true()                             smtp,dkim,md5,smime    -> reject


Like this, any user subscribed to a list on the server will be allowed to post a message.
Any other condition will lead to message rejection.

Hope this helps.

Regards (and thanks for DKIM),

David


Le 08/10/2015 16:16, John Levine a écrit :
On the off chance that someone's already done this ...

I run a bunch of lists for my church, and it would be nice if I could
configure a list to allow posts from everyone subscribed to another
list.  It's nothing exotic, we have some task forces that accept
comments from everyone on the general church list.

I can imagine various ways to do this, but it would be nice not to
have to reinvent it.

R's,
John

--
A bug in Sympa? Quick! To the bug tracker!

 
David Verdin
Études et projets applicatifs
 
Tél : +33 2 23 23 69 71
Fax : +33 2 23 23 71 21
 
www.renater.fr
RENATER
263 Avenue du Gal Leclerc
35042 Rennes Cedex



PNG image

Attachment: smime.p7s
Description: Signature cryptographique S/MIME




Archive powered by MHonArc 2.6.19+.

Top of Page