-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Updated Docker base image to debian 12 - Make sure we stay compatible with Vaultwarden v1.32.0+ (Thanks @p4i1ipp) - First step in making sourcecode less ldap specific
Showing
7 changed files
with
88 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,7 +30,7 @@ def test_vw_admin_enable_disable(self): | |
|
||
self.vwc.enable_user(self.user_id1) | ||
change_set = collect_change_set(self.vwc, self.ls, | ||
ldap_users=[self.user_email1, self.user_email2]) | ||
source_email_addresses=[self.user_email1, self.user_email2]) | ||
|
||
self.assertEqual(set(), change_set['invite']) | ||
self.assertEqual([], change_set['disable']) | ||
|
@@ -40,43 +40,43 @@ def test_user_changed_email(self): | |
self.ls.update_vw_email(self.user_id1, '[email protected]') | ||
_, _, t = self.ls.get_all_users() | ||
change_set = collect_change_set(self.vwc, self.ls, | ||
ldap_users=[self.user_email1, self.user_email2]) | ||
source_email_addresses=[self.user_email1, self.user_email2]) | ||
self.assertEqual(set(), change_set['invite']) | ||
self.assertEqual([], change_set['disable']) | ||
|
||
# and then this user registration address disappears from ldap | ||
change_set = collect_change_set(self.vwc, self.ls, | ||
ldap_users=[self.user_email2]) | ||
source_email_addresses=[self.user_email2]) | ||
|
||
self.assertEqual(set(), change_set['invite'], 'Users to invite') | ||
self.assertEqual([self.user_id1], change_set['disable'], 'Users to disable') | ||
|
||
def test_unknown_only_to_us(self): | ||
self.vwc.invite_user('[email protected]') | ||
change_set = collect_change_set(self.vwc, self.ls, | ||
ldap_users=[self.user_email1, self.user_email2, '[email protected]']) | ||
source_email_addresses=[self.user_email1, self.user_email2, '[email protected]']) | ||
self.assertEqual(set(), change_set['invite']) | ||
self.assertEqual([], change_set['disable']) | ||
|
||
def test_user_already_known(self): | ||
self.ls.register_user('[email protected]', 'uuuu-iiii-dddd') | ||
self.ls.set_user_state('uuuu-iiii-dddd', 'DISABLED') | ||
change_set = collect_change_set(self.vwc, self.ls, | ||
ldap_users=['[email protected]', self.user_email1, self.user_email2]) | ||
source_email_addresses=['[email protected]', self.user_email1, self.user_email2]) | ||
self.assertEqual(change_set['invite'], set()) | ||
|
||
def test_user_appeared_on_ldap(self): | ||
change_set = collect_change_set(self.vwc, self.ls, | ||
ldap_users=[self.user_email1, self.user_email2, '[email protected]']) | ||
source_email_addresses=[self.user_email1, self.user_email2, '[email protected]']) | ||
self.assertEqual(change_set['invite'], {'[email protected]'}) | ||
|
||
def test_user_disappeared_from_ldap(self): | ||
change_set = collect_change_set(self.vwc, self.ls, ldap_users=[self.user_email1]) | ||
change_set = collect_change_set(self.vwc, self.ls, source_email_addresses=[self.user_email1]) | ||
self.assertEqual([self.user_id2], change_set['disable']) | ||
|
||
def test_nothing_to_do(self): | ||
# We are in sync | ||
change_set = collect_change_set(self.vwc, self.ls, ldap_users=[self.user_email1, self.user_email2]) | ||
change_set = collect_change_set(self.vwc, self.ls, source_email_addresses=[self.user_email1, self.user_email2]) | ||
self.assertEqual(set(), change_set['invite']) | ||
self.assertEqual([], change_set['disable']) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
from abc import ABC, abstractmethod | ||
from typing import List | ||
|
||
|
||
class EmailSource(ABC): | ||
""" | ||
Generic Email source base class | ||
""" | ||
source_name: str | ||
|
||
def __init__(self, source_name: str): | ||
self.source_name = source_name | ||
|
||
@abstractmethod | ||
def get_email_list(self) -> List[str]: | ||
""" | ||
Get email addresses to invite | ||
:return: A (possibly) empty list of email addresses | ||
""" | ||
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters