From 238da5d92c0db57f8932e9ce5686360c27030131 Mon Sep 17 00:00:00 2001 From: Daniel Berteaud Date: Wed, 6 Feb 2013 09:21:26 +0100 Subject: [PATCH] Do not remove ACL all the time if SharedMailbox is disabled --- root/etc/e-smith/events/actions/dovecot-acl | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/root/etc/e-smith/events/actions/dovecot-acl b/root/etc/e-smith/events/actions/dovecot-acl index edceafc..3ff142f 100644 --- a/root/etc/e-smith/events/actions/dovecot-acl +++ b/root/etc/e-smith/events/actions/dovecot-acl @@ -16,19 +16,21 @@ my $event = $ARGV[0]; # SharedMailboxes disabled ? if (($dovecot->prop('SharedMailbox') || 'disabled') eq 'disabled'){ - foreach my $user ($a->users){ - my $name = $user->key; - die "Error removing SharedMailbox ACLs ($name"."'s Maildir)\n" unless ( - system('/usr/bin/setfacl', - '-R', - '-x', - 'g:sharedmailbox', - "/home/e-smith/files/users/$name") == 0 && - system('/bin/chmod', - '-R', - 'g-s', - "/home/e-smith/files/users/$name/Maildir") == 0 - ); + if (($dovecot->prop('SharedMailboxAcl') || 'yes') ne 'no'){ + foreach my $user ($a->users){ + my $name = $user->key; + die "Error removing SharedMailbox ACLs ($name"."'s Maildir)\n" unless ( + system('/usr/bin/setfacl', + '-R', + '-x', + 'g:sharedmailbox', + "/home/e-smith/files/users/$name") == 0 && + system('/bin/chmod', + '-R', + 'g-s', + "/home/e-smith/files/users/$name/Maildir") == 0 + ); + } } $dovecot->set_prop('SharedMailboxAcl','no'); exit(0);