From c2093e46c3170cacaaad3da4b4b84085946e2b22 Mon Sep 17 00:00:00 2001
From: Lars Beckers <lars.beckers@rwth-aachen.de>
Date: Mon, 26 Apr 2021 00:23:01 +0200
Subject: [PATCH] dovecot: add custom mail namespaces for shared folders

---
 dovecot/defaults/main.yml                | 1 +
 dovecot/templates/conf.d/10-mail.conf.j2 | 8 ++++++++
 2 files changed, 9 insertions(+)

diff --git a/dovecot/defaults/main.yml b/dovecot/defaults/main.yml
index dcf1bde..f656071 100644
--- a/dovecot/defaults/main.yml
+++ b/dovecot/defaults/main.yml
@@ -40,4 +40,5 @@ dovecot_auth_default_realm: ''
 dovecot_auth_krb5_keytab: ''
 dovecot_auth_mechanisms:
   - plain
+dovecot_mail_namespaces: []
 dovecot_special_mailbox_auto_subscribe: false
diff --git a/dovecot/templates/conf.d/10-mail.conf.j2 b/dovecot/templates/conf.d/10-mail.conf.j2
index 52df2b7..f74f8b7 100644
--- a/dovecot/templates/conf.d/10-mail.conf.j2
+++ b/dovecot/templates/conf.d/10-mail.conf.j2
@@ -79,6 +79,14 @@ namespace inbox {
   # See 15-mailboxes.conf for definitions of special mailboxes.
 }
 
+{% for namespace in dovecot_mail_namespaces %}
+namespace {
+  {% for key, value in namespace.items() %}
+  {{ key }} = {{ value }}
+  {% endfor %}
+}
+{% endfor %}
+
 # Example shared namespace configuration
 #namespace {
   #type = shared
-- 
GitLab