Skip to Content.
Sympa Menu

devel - [sympa-dev] List.pm and owners/editors

Subject: Developers of Sympa

List archive

Chronological Thread  
  • From: Thomas Berry <address@concealed>
  • To: sympa dev <address@concealed>
  • Subject: [sympa-dev] List.pm and owners/editors
  • Date: Fri, 29 Jun 2007 13:48:52 -0700


Currently--the way List.pm is coded--you can not have a mailing list whose members are synchronized with an LDAP source *and* owners/editors that are defined in the list config. If 'user_data_source' is set to include2 the owners and editors *must* be pulled from the LDAP source.

Instead, I think the get_editors and get_owners subroutines should return a list of owners/editors from both external source and list config before determine the list "has got no owner defined" (or editor).

Any thoughts?



List.pm
## Return a list of hash's owners and their param
sub get_owners {
my($self) = @_;
&do_log('debug3', 'List::get_owners(%s)', $self->{'name'});

my $owners = ();

# owners are in the admin_table
if ($self->{'admin'}{'user_data_source'} eq 'include2') {
for (my $owner = $self->get_first_admin_user('owner'); $owner; $owner = $self->get_next_admin_user()) {
push(@{$owners},$owner);
}

#owners are only in the config
} else {
$owners = $self->{'admin'}{'owner'};
}
return $owners;
}

## Return a hash of list's editors and their param(empty if there isn't any editor)
sub get_editors {
my($self) = @_;
&do_log('debug3', 'List::get_editors(%s)', $self->{'name'});

my $editors = ();

# editors are in the admin_table
if ($self->{'admin'}{'user_data_source'} eq 'include2') {
for (my $editor = $self->get_first_admin_user('editor'); $editor; $editor = $self->get_next_admin_user()) {
push(@{$editors},$editor);
}

#editors are only in the config
} else {
$editors = $self->{'admin'}{'editor'};
}
return $editors;
}



The following is a patch that revises get_owners and get_editors
--- List.pm 2007-05-25 08:33:23.000000000 -0700
+++ /tmp/List.pm 2007-06-29 13:43:37.000000000 -0700
@@ -1959,15 +1959,15 @@ sub get_owners {
my $owners = ();

# owners are in the admin_table
- if ($self->{'admin'}{'user_data_source'} eq 'include2') {
- for (my $owner = $self->get_first_admin_user('owner'); $owner; $owner = $self->get_next_admin_user()) {
- push(@{$owners},$owner);
- }
+ for (my $owner = $self->get_first_admin_user('owner'); $owner; $owner = $self->get_next_admin_user()) {
+ push(@{$owners},$owner);
+ }

#owners are only in the config
- } else {
- $owners = $self->{'admin'}{'owner'};
+ unless ( @{$owners} ) {
+ $owners = $self->{'admin'}{'owner'};
}
+
return $owners;
}

@@ -1992,15 +1992,15 @@ sub get_editors {
my $editors = ();

# editors are in the admin_table
- if ($self->{'admin'}{'user_data_source'} eq 'include2') {
- for (my $editor = $self->get_first_admin_user('editor'); $editor; $editor = $self->get_next_admin_user()) {
- push(@{$editors},$editor);
- }
+ for (my $editor = $self->get_first_admin_user('editor'); $editor; $editor = $self->get_next_admin_user()) {
+ push(@{$editors},$editor);
+ }

#editors are only in the config
- } else {
+ unless (defined $editors) {
$editors = $self->{'admin'}{'editor'};
}
+
return $editors;
}


  • [sympa-dev] List.pm and owners/editors, Thomas Berry, 06/29/2007

Archive powered by MHonArc 2.6.19+.

Top of Page