From 6fbd7179dbd6f651c4a7f89f3caf5fc2a083b504 Mon Sep 17 00:00:00 2001
From: Thomas Schneider <thomas@fsmpi.rwth-aachen.de>
Date: Sat, 19 Mar 2022 17:16:26 +0100
Subject: [PATCH] Allow excluding users from final list

---
 bin/rezelist       | 7 ++++++-
 config.sample.json | 4 ++++
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/bin/rezelist b/bin/rezelist
index f37819a..7137313 100755
--- a/bin/rezelist
+++ b/bin/rezelist
@@ -34,7 +34,12 @@ def main():
     for d in config["domains"]:
         # set to make unique, list to make sortable
         output[d] = list(
-            {a.localpart for a in addresses if a.domain is None or a.domain == d}
+            {
+                a.localpart
+                for a in addresses
+                if (a.domain is None or a.domain == d)
+                and a.localpart not in config["exclude"]
+            }
         )
         output[d].sort()
 
diff --git a/config.sample.json b/config.sample.json
index 0f1a062..8dc9137 100644
--- a/config.sample.json
+++ b/config.sample.json
@@ -5,6 +5,10 @@
     "sub.example.com",
     "example.org"
   ],
+  "exclude": [
+    "nobody",
+    "testuser"
+  ],
   "sources": [
     {
       "type": "aliases",
-- 
GitLab