From aaf8a30688ee61585b5fcd8e6a34ae91686189d6 Mon Sep 17 00:00:00 2001 From: Daniel Berteaud Date: Wed, 28 Nov 2012 17:22:35 +0100 Subject: [PATCH] Delete SOGo data on user removal --- createlinks | 1 + root/etc/e-smith/events/actions/sogo-delete-user | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) create mode 100644 root/etc/e-smith/events/actions/sogo-delete-user diff --git a/createlinks b/createlinks index a6b6ff1..c6d2dac 100755 --- a/createlinks +++ b/createlinks @@ -20,6 +20,7 @@ safe_symlink("restart", "root/etc/e-smith/events/email-update/services2adjust/my event_link("sogo-delete-backup", "pre-backup", "60"); event_link("sogo-delete-backup", "post-backup", "60"); event_link("sogo-backup", "pre-backup", "70"); +event_link("sogo-delete-user", "user-delete", "10"); panel_link("sogo", "manager"); diff --git a/root/etc/e-smith/events/actions/sogo-delete-user b/root/etc/e-smith/events/actions/sogo-delete-user new file mode 100644 index 0000000..9733f85 --- /dev/null +++ b/root/etc/e-smith/events/actions/sogo-delete-user @@ -0,0 +1,16 @@ +#!/bin/bash + +EVENT=$1 +USER=$2 + +if [ -z "$EVENT" ]; then + echo "event name is missing" + exit 1 +fi +if [ -z "$USER" ]; then + echo "user account is missing" + exit 1 +fi + +su - sogo -c "/usr/sbin/sogo-tool remove $USER" > /dev/null 2>&1 +