mirror of
https://github.com/zulip/zulip.git
synced 2025-11-02 21:13:36 +00:00
ldap: Fix bad interaction between EMAIL_ADDRESS_VISIBILITY and LDAP sync.
A block of LDAP integration code related to data synchronization did not correctly handle EMAIL_ADDRESS_VISIBILITY_ADMINS, as it was accessing .email, not .delivery_email, both for logging and doing the mapping between email addresses and LDAP users. Fixes #13539.
This commit is contained in:
@@ -28,6 +28,7 @@ from zerver.lib.actions import (
|
||||
do_invite_users,
|
||||
do_reactivate_realm,
|
||||
do_reactivate_user,
|
||||
do_set_realm_property,
|
||||
ensure_stream,
|
||||
validate_email,
|
||||
)
|
||||
@@ -2986,6 +2987,18 @@ class TestZulipLDAPUserPopulator(ZulipLDAPTestCase):
|
||||
hamlet = self.example_user('hamlet')
|
||||
self.assertEqual(hamlet.full_name, 'New Name')
|
||||
|
||||
def test_update_with_hidden_emails(self) -> None:
|
||||
hamlet = self.example_user('hamlet')
|
||||
realm = get_realm("zulip")
|
||||
do_set_realm_property(realm, 'email_address_visibility', Realm.EMAIL_ADDRESS_VISIBILITY_ADMINS)
|
||||
hamlet.refresh_from_db()
|
||||
|
||||
self.change_ldap_user_attr('hamlet', 'cn', 'New Name')
|
||||
self.perform_ldap_sync(hamlet)
|
||||
|
||||
hamlet.refresh_from_db()
|
||||
self.assertEqual(hamlet.full_name, 'New Name')
|
||||
|
||||
def test_update_split_full_name(self) -> None:
|
||||
self.change_ldap_user_attr('hamlet', 'cn', 'Name')
|
||||
self.change_ldap_user_attr('hamlet', 'sn', 'Full')
|
||||
|
||||
Reference in New Issue
Block a user