diff --git a/createlinks b/createlinks index b8c79a3..3d93e07 100644 --- a/createlinks +++ b/createlinks @@ -2,11 +2,14 @@ use esmith::Build::CreateLinks qw(:all); -event_link("user-reset-expired", "password-modify", "80"); -event_link("user-expire-account", "user-expire-account", "20"); -event_link("user-lock-passwd", "user-expire-account", "30"); -event_link("count-active-user-accounts", "user-expire-account", "40"); -event_link("ldap-update-simple", "user-expire-account", "50"); -event_link("qmail-update-user", "user-expire-account", "60"); +event_link("user-reset-expired", "password-modify", "80"); +event_link("user-expire-account", "user-expire-account", "20"); +event_link("user-update-auto-response", "user-expire-account", "25"); +event_link("user-lock-passwd", "user-expire-account", "30"); +event_link("count-active-user-accounts", "user-expire-account", "40"); +event_link("ldap-update-simple", "user-expire-account", "50"); +event_link("qmail-update-user", "user-expire-account", "60"); + +event_link("user-update-auto-response", "user-update-expire-settings", "20"); panel_link("expireaccounts", 'manager'); diff --git a/root/etc/e-smith/events/actions/user-expire-account b/root/etc/e-smith/events/actions/user-expire-account index 1f597e5..5bb1a76 100644 --- a/root/etc/e-smith/events/actions/user-expire-account +++ b/root/etc/e-smith/events/actions/user-expire-account @@ -46,24 +46,6 @@ foreach my $user (@users){ $user->delete_prop('ExpireLastNotifiedOn'); # Set the expiration date $user->set_prop('ExpireLockedOn', $now->ymd); - - my $home = getpwnam($userName)->dir; - if (!-d $home . '/.lock-auto-reply'){ - mkdir $home . '/.lock-auto-reply'; - chown getpwnam($userName)->uid, getpwnam($userName)->gid, $home . '/.lock-auto-reply'; - chmod 750, $home . '/.lock-auto-reply'; - } - esmith::templates::processTemplate ({ - MORE_DATA => { USERNAME => $userName }, - TEMPLATE_PATH => "/.lock-auto-reply/message.txt", - TEMPLATE_EXPAND_QUEUE => - [ - "/etc/e-smith/templates-user-custom", - "/etc/e-smith/templates-user", - ], - OUTPUT_PREFIX => "$home", - PERMS => 0644, - }); } exit (0); diff --git a/root/etc/e-smith/events/actions/user-update-auto-response b/root/etc/e-smith/events/actions/user-update-auto-response new file mode 100644 index 0000000..7260bdc --- /dev/null +++ b/root/etc/e-smith/events/actions/user-update-auto-response @@ -0,0 +1,44 @@ +#!/usr/bin/perl -w + +use strict; +use esmith::AccountsDB; +use esmith::templates; +use User::pwent; + +my $a = esmith::AccountsDB->open or + die "Could not open AccountsDB\n"; + +my $event = shift; +my $userName = shift; +my @users; + +if (defined $userName){ + my $user = $a->get($userName); + die "Account $userName is not a user account; can't update the auto-reply message.\n" + unless $user && $user->prop('type') eq "user"; + @users = ($user); +} +else{ + @users = ( $a->users ); +} + +foreach my $user (@users){ + my $userName = $user->key; + + my $home = getpwnam($userName)->dir; + mkdir $home . '/.lock-auto-reply' unless -d $home . '/.lock-auto-reply'; + + esmith::templates::processTemplate ({ + MORE_DATA => { USERNAME => $userName }, + TEMPLATE_PATH => "/.lock-auto-reply/message.txt", + TEMPLATE_EXPAND_QUEUE => + [ + "/etc/e-smith/templates-user-custom", + "/etc/e-smith/templates-user", + ], + OUTPUT_PREFIX => "$home", + PERMS => 0644, + }); +} + +exit(0);