Prevend subscribing or users with the schleuders own key
This commit is contained in:
parent
d8a6f14386
commit
fc793f82c2
3 changed files with 15 additions and 11 deletions
|
@ -35,18 +35,22 @@ class MultiList:
|
|||
target_list, sources = self._lists_by_name()
|
||||
target_admins = self._api.get_list_admins(target_list)
|
||||
# Get current subs, except for unmanaged adresses
|
||||
current_subs: Set[SchleuderSubscriber] = {
|
||||
s
|
||||
for s in self._api.get_subscribers(target_list)
|
||||
if s.email not in self._unmanaged
|
||||
}
|
||||
current_subs: Set[SchleuderSubscriber] = set()
|
||||
for s in self._api.get_subscribers(target_list):
|
||||
if s.email in self._unmanaged or s.email == self._target:
|
||||
continue
|
||||
if s.key is not None and s.key.fingerprint == target_list.fingerprint:
|
||||
continue
|
||||
current_subs.add(s)
|
||||
current_keys: Set[SchleuderKey] = {s.key for s in current_subs if s.key is not None}
|
||||
all_subs: List[SchleuderSubscriber] = []
|
||||
# This loop may return multiple subscriptions for some users if they are subscribed on multiple sub-lists ...
|
||||
for source in sources:
|
||||
subs: List[SchleuderSubscriber] = self._api.get_subscribers(source)
|
||||
for s in subs:
|
||||
if s.email in self._banned or s.email in self._unmanaged:
|
||||
if s.email in self._banned or s.email in self._unmanaged or s.email == self._target:
|
||||
continue
|
||||
if s.key is not None and s.key.fingerprint == target_list.fingerprint:
|
||||
continue
|
||||
all_subs.append(s)
|
||||
# ... which is taken care of by the key conflict resolution routine
|
||||
|
|
|
@ -19,7 +19,6 @@ lists:
|
|||
- test-south@schleuder.example.org
|
||||
- test-west@schleuder.example.org
|
||||
from: test-global-owner@schleuder.example.org
|
||||
send_admin_reports: no
|
||||
|
||||
- target: test2-global@schleuder.example.org
|
||||
unmanaged:
|
||||
|
@ -32,6 +31,7 @@ lists:
|
|||
- test-north@schleuder.example.org
|
||||
- test-east@schleuder.example.org
|
||||
from: test2-global-owner@schleuder.example.org
|
||||
send_admin_reports: no
|
||||
|
||||
smtp:
|
||||
hostname: localhost
|
||||
|
|
|
@ -114,11 +114,11 @@ if msg1['Precedence'] != 'list':
|
|||
if 'X-MultiSchleuder-Digest' in msg2:
|
||||
print(f'Admin report message should not have a X-MultiSchleuder-Digest header, got {msg2["X-MultiSchleuder-Digest"]}')
|
||||
exit(1)
|
||||
if msg2['From'] != 'test2-global-owner@schleuder.example.org':
|
||||
print(f'Expected "From: test2-global-owner@schleuder.example.org", got {msg2["From"]}')
|
||||
if msg2['From'] != 'test-global-owner@schleuder.example.org':
|
||||
print(f'Expected "From: test-global-owner@schleuder.example.org", got {msg2["From"]}')
|
||||
exit(1)
|
||||
if msg2['To'] != 'admin2@example.org':
|
||||
print(f'Expected "To: admin2@example.org", got {msg2["To"]}')
|
||||
if msg2['To'] != 'admin@example.org':
|
||||
print(f'Expected "To: admin@example.org", got {msg2["To"]}')
|
||||
exit(1)
|
||||
if msg2['Auto-Submitted'] != 'auto-generated':
|
||||
print(f'Expected "Auto-Submitted: auto-generated", got {msg2["Auto-Submitted"]}')
|
||||
|
|
Loading…
Reference in a new issue