sympa
sympa copied to clipboard
restore option to mirror dump (do_export_member())
Expected Behavior
The review screen in wwsympa provides a "Dump with Names" option (do_export_member()) to download the current list membership. It would be quite nice if people could edit the file that this generates offline and then upload the results:
- Where email addresses have been added to the file, they should be added to the list
- Where email addresses have been removed from the file, they should be removed from the llist
- If GeCOS values are provided but are different from existing entries they can be updated
- Any remaining email addresses which appear in both places should be left alone.
Current Behavior
The closest approximation to this behaviour at the moment is:
- Delete the current membership of the list
- Copy and paste the list of addresses into the
However that discards any state for existing list members.
Curiously, the wwsympa do_import() function has some code of the form:
my $content;
my $fh = $query->upload('uploaded_file');
if (defined $fh) {
my $ioh = $fh->handle;
$content = do { local $RS; <$ioh> };
} else {
$content = $in{'dump'};
}
but that isn't actually used at all.
Possible Solution
Add an extra entry "Restore" on the tabs for the list review screen.
With my version of Steve Shipley's whitelist plugin. this currently looks something like:
Pending subscriptions
Pending unsubscriptions
Blocklist
Moderated Senders
Allowed Senders
Bounces
Dump
Dump with names
Restore <-- this is new
Exclude
The new "restore" screen contains nothing but a file selection dialogue, a submit button, and a warning that the current list membership will be overwritten. When people click submit they get a status page of the form:
Changes:
Add: 0
Remove: 0
Duplicate: 0
Ignore: 0
Context
Our existing (heavily customised) Mailman installation has an export/import option. This is quite useful for people who want to make ad hoc bulk updates to a list, but aren't up to running Perl/Python scripts. We also provide:
https://help.uis.cam.ac.uk/service/email/lists/sympa/information-about-uis-managed-mailing-lists/sympasoap
which is the preferred approach to the same problem.
Additional information
I have a proof of concept implementation using list_custom_actions if you are interested.
In order to implement this I needed to make a small change to wwwsympa in order to pass the current authenticated user and the contents of the uploaded file into the lca script:
An Aside: Concerns about authentication for LCA plugin scripts.
In the process of implementing this, it occurred to me that there is currently no real authentication available to lca scripts.
We currently use (a modified version of) Steve Shipley's whitelist plugin. I believe that anyone with a valid login session (required to generate a csrftoken) could forge HTTP POST requests in order to update the whitelist or modlist on any list in the system.
Small correction. LCA plugins scripts can access the determine the current logged in user using:
my $param = $main::param;
my $is_owner = $param->{'is_owner'};
($is_owner) or die "Not list owner";
my $sender = $param->{'user'}{'email'};
Obviously $main::param is a bit of a hack, and I don't know if it is officially supported.
I am however going to add a guard of that form to my version of the whitelist plugin, for my own peace of mind.
return 'home' unless ($main::param->{'is_owner'});
Just to add: I could implement the restore feature entirely as a LCA using:
my $param = $main::param;
my $query = $main::query;
If I replace "my $query" with "our $query" in wwsympa.pl
Yes. These would be welcome features and very useful to our community, as well.
Hi @ikedas
If I put together a Pull Request for this feature (inline rather than as a LCA plugin) would you be likely to merge it?