Skip to Content.
Sympa Menu

en - Re: [sympa-users] Getting owners and moderators for lists

Subject: The mailing list for listmasters using Sympa

List archive

Chronological Thread  
  • From: "Stefan Hornburg (Racke)" <address@concealed>
  • To: address@concealed
  • Subject: Re: [sympa-users] Getting owners and moderators for lists
  • Date: Tue, 30 Nov 2021 21:43:05 +0100

On 30/11/2021 16:59, Pat Allen wrote:
Good morning!

I'm currently running Sympa 6.2.64 on CentOS 7. I put together some scripts
back when we started using 5.3.3 which alert me when messages are waiting to
be moderated. They pulled the names of the moderators from the list's config
file which seemed to be correct. But this morning I noticed that the email
contained the names of people who no longer work here. And yet the GUI has
the correct information.

So the list config file is no longer the correct place to look for
information. I'm presuming that I need to use LDAP to get this. Can anyone
confirm this and possibly supply the LDAP command that I would use to query
the moderators?

Thanks for the help!
Pat



Hello Pat,

I attached a simple script that reads out the moderators from your SQL
database (adjust path to the directory with the Perl modules in line 11 if
needed).

In general you need to be careful to get the information directly from the
database, because you circumvent any logic that Sympa might use.
However in this particular case this advice doesn't apply IMHO.

Regards
Racke

--
Ecommerce and Linux consulting + Perl and web application programming.
Debian and Sympa administration.

#! /usr/bin/env perl
#
# Copyright (C) 2021 Stefan Hornburg (Racke) <address@concealed>
# SPDX-License-Identifier: Artistic-2.0

use warnings;
use strict;
use utf8;
use open ':encoding(utf8)';

use lib '/usr/local/sympa/bin';
use Conf;
use Sympa;
use Sympa::Constants;
use Sympa::DatabaseManager;

# Load Sympa.conf
unless ( Conf::load(Sympa::Constants::CONFIG) ) {
print gettext("The configuration file contains errors.\n");
exit(1);
}

my $sympa_db = Sympa::Database->new(
$Conf::Conf{db_type},
db_name => $Conf::Conf{db_name},
db_user => $Conf::Conf{db_user},
db_passwd => $Conf::Conf{db_passwd} || '',
db_host => $Conf::Conf{db_host} || '',
);

# get all open lists
my $sth = $sympa_db->do_prepared_query(
q{SELECT name_list, robot_list FROM list_table WHERE status_list =
'open'},
);

my $editor_query = q{select user_admin from admin_table where list_admin = ?
and robot_admin = ? and role_admin = 'editor'};

while (my $row = $sth->fetch) {
my $list_email = $row->[0] . "@" . $row->[1];

# retrieve editors for the current list
my $sth_list = $sympa_db->do_prepared_query($editor_query, $row->[0],
$row->[1]);
my $editor_list = $sth_list->fetchall_arrayref;

if (@$editor_list) {
print "$list_email: ", join(',', map {$_->[0]} @$editor_list), "\n";
}
}

Attachment: OpenPGP_signature
Description: OpenPGP digital signature




Archive powered by MHonArc 2.6.19+.

Top of Page