Add support for public mailboxes
Patch from John H. Bennett III <bennettj@thebennetthome.com>
This commit is contained in:
parent
6ccd9eb6c1
commit
39818deb8a
|
@ -4,6 +4,10 @@ use esmith::Build::CreateLinks qw(:all);
|
|||
|
||||
event_link("dovecot-acl", "email-update", "85");
|
||||
event_link("dovecot-acl", "user-create", "85");
|
||||
event_link("dovecot-acl", "post-upgrade", "85");
|
||||
|
||||
event_link("dovecot-compile-sieve", "email-update", "86");
|
||||
|
||||
safe_touch("root/etc/dovecot/sharedmailbox/dict.db");
|
||||
|
||||
templates2events("/home/e-smith/files/public/dovecot-acl", "email-update");
|
||||
|
|
|
@ -14,6 +14,14 @@ die "couldn't find dovecot service\n" unless ($dovecot);
|
|||
|
||||
my $event = $ARGV[0];
|
||||
|
||||
# If PublicMailbox is enabled
|
||||
if (($dovecot->prop('PublicMailbox') || 'disabled') eq 'enabled'){
|
||||
system('/bin/mkdir' ,'-p', "/home/e-smith/files/public") unless (-d '/home/e-smith/files/public');
|
||||
system('/bin/chmod', "770", "/home/e-smith/files/public");
|
||||
system('/bin/chmod', 'g+s', "/home/e-smith/files/public");
|
||||
system('/bin/chown', 'root.sharedmailbox', "/home/e-smith/files/public");
|
||||
}
|
||||
|
||||
# SharedMailboxes disabled ?
|
||||
if (($dovecot->prop('SharedMailbox') || 'disabled') eq 'disabled'){
|
||||
if (($dovecot->prop('SharedMailboxAcl') || 'yes') ne 'no'){
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
GID="sharedmailbox"
|
|
@ -1,10 +1,11 @@
|
|||
{
|
||||
return "" if (($dovecot{'SharedMailbox'} || 'disabled') eq 'disabled');
|
||||
return "# Mailbox sharing is not enabled"
|
||||
if (($dovecot{'SharedMailbox'} || 'disabled') eq 'disabled') && (($dovecot{'PublicMailbox'} || 'disabled') eq 'disabled');
|
||||
|
||||
push @plugins, 'acl';
|
||||
push @imap_plugins, 'imap_acl';
|
||||
|
||||
my $string =<<'HERE';
|
||||
my $common =<<'_EOF';
|
||||
|
||||
mail_access_groups = sharedmailbox
|
||||
|
||||
|
@ -39,7 +40,13 @@ namespace {
|
|||
prefix =
|
||||
inbox = yes
|
||||
}
|
||||
_EOF
|
||||
|
||||
{
|
||||
my $shared_mb = "\n# SharedMailbox is disabled\n";
|
||||
my $public_mb = "\n# PublicMailbox is disabled\n";
|
||||
if (($dovecot{'SharedMailbox'} || 'disabled') eq 'enabled'){
|
||||
$shared_mb =<<'_EOF';
|
||||
namespace {
|
||||
type = shared
|
||||
separator = /
|
||||
|
@ -48,7 +55,22 @@ namespace {
|
|||
subscriptions = no
|
||||
list = children
|
||||
}
|
||||
_EOF
|
||||
}
|
||||
if (($dovecot{'PublicMailbox'} || 'disabled') eq 'enabled'){
|
||||
$public_mb =<<'_EOF';
|
||||
namespace {
|
||||
type = public
|
||||
separator = /
|
||||
prefix = public/
|
||||
location = maildir:/home/e-smith/files/public
|
||||
subscriptions = no
|
||||
list = children
|
||||
}
|
||||
_EOF
|
||||
}
|
||||
|
||||
my $acl =<<'_EOF';
|
||||
plugin {
|
||||
acl_shared_dict = file:/home/e-smith/db/dovecot/sharedmailbox.db
|
||||
}
|
||||
|
@ -61,8 +83,8 @@ plugin {
|
|||
acl_anyone = allow
|
||||
}
|
||||
|
||||
HERE
|
||||
_EOF
|
||||
|
||||
push @conf, $string;
|
||||
push @conf, $common, $shared_mb, $public_mb, $acl;
|
||||
$OUT .= '';
|
||||
}
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
|
||||
if (($dovecot{'PublicMailbox'} || 'disabled') eq 'enabled'){
|
||||
my @PublicMailboxAdmins = split /[,:]/, ($dovecot{PublicMailboxAdmins} || '');
|
||||
$OUT .= "authenticated lrwsie" . "\n";
|
||||
$OUT .= "user=admin lrswtipekxa" . "\n";
|
||||
foreach my $PublicMailboxAdmins (sort @PublicMailboxAdmins){
|
||||
$OUT .= 'user=' . "$PublicMailboxAdmins " . 'lrswtipekxa' . "\n";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue