Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

ldap: Enable create_missing_groups=True behavior for group sync.

Mateusz Mandera8483d9147598
diff --git a/docs/overview/changelog.md b/docs/overview/changelog.md
index 6c9a60a371f..16864723b48 100644
--- a/docs/overview/changelog.md
+++ b/docs/overview/changelog.md
@@ -15,7 +15,11 @@ _Unreleased_
### Upgrade notes for 12.0
-- None yet.
+- The `LDAP_SYNCHRONIZED_GROUPS_BY_REALM` setting for LDAP group
+ synchronization no longer ignores groups that are configured to be
+ synced but don't exist in the Zulip organization. Starting in 12.0,
+ such groups will be created automatically when syncing the groups
+ for a user who should be a member of that group.
## Zulip Server 11.x series
diff --git a/docs/production/authentication-methods.md b/docs/production/authentication-methods.md
index e72650a7876..083649ddac7 100644
--- a/docs/production/authentication-methods.md
+++ b/docs/production/authentication-methods.md
@@ -387,6 +387,10 @@ groups. To configure this feature:
and `group2` will match their membership in LDAP groups with those
names.
+ If a group listed here does not already exist in Zulip, it will be
+ created automatically when syncing a user who should be a member of
+ that group.
+
1. Test your configuration and restart the server into the new
configuration as [documented above](#synchronizing-data).
diff --git a/zproject/backends.py b/zproject/backends.py
index 73fd2fbbf92..607a156ba73 100644
--- a/zproject/backends.py
+++ b/zproject/backends.py
@@ -1031,10 +1031,12 @@ class ZulipLDAPAuthBackendBase(ZulipAuthMixin, LDAPBackend):
intended_group_names=intended_group_names,
user_profile=user_profile,
logger=ldap_logger,
- # We don't want to sneakily change LDAP behavior in this commit, we we pass
- # create_missing_group=False to maintain original behavior of ldap group sync.
- # TODO: Change this to True in a follow-up commit. Backport with False to 11.x.
- create_missing_groups=False,
+ # Backward-compatibility note:
+ # For 12.x and forward, we set create_missing_groups to True.
+ # In the backport of this feature to 11.x, this is set to False.
+ # TODO/compatibility: Remove this comment once 11.x is old enough
+ # for this note to no longer be helpful.
+ create_missing_groups=True,
)
except Exception as e:
raise ZulipLDAPError(str(e)) from e