From 3d836546c3b3145b387a24a04fe6da5d5c89efc1 Mon Sep 17 00:00:00 2001 From: lars Date: Wed, 15 Oct 2008 20:27:07 +0000 Subject: [PATCH] ezmlm-web interface code: * remove list entry from webusers file after list removal (Closes: #54) --- ezmlm-web.cgi | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/ezmlm-web.cgi b/ezmlm-web.cgi index edf2b7a..1c6ff7e 100755 --- a/ezmlm-web.cgi +++ b/ezmlm-web.cgi @@ -1617,6 +1617,10 @@ sub delete_list { } warn "List '" . $list->thislist() . "' deleted"; } + + # remove the authorization line from the webusers file + webauth_remove_list($listname); + return (0==0); } @@ -2532,6 +2536,7 @@ sub is_option_in_selections { sub update_webusers { # replace existing webusers-line or add a new one + # empty "webusers_input" results in the removal of the line my $listname = shift; my $webusers_input = shift; @@ -2578,9 +2583,13 @@ sub update_webusers { } while() { if ($_ =~ m/^$listname\s*:/i) { - print WU $listname . ': ' . $webusers_input . "\n" - if ($matched == 0); - $matched = 1; + if ($matched == 0) { + # print the new permission only if it is non-empty + # this allows to reuse the code for list removal + print WU $listname . ': ' . $webusers_input . "\n" + if ($webusers_input); + $matched = 1; + } } else { print WU $_; } @@ -2791,6 +2800,15 @@ sub webauth_create_list { # --------------------------------------------------------------------------- +sub webauth_remove_list { + my $listname = shift; + + # call "update_webusers" with an empty string -> removal + return (update_webusers($listname, '')); +} + +# --------------------------------------------------------------------------- + sub get_available_interface_languages { my (%languages, @files, $file);