[MM-63772] Add LDAP setting to re-add removed members (#30787)

Этот коммит содержится в:
Ben Schumacher
2025-05-20 11:15:25 +02:00
коммит произвёл GitHub
родитель 5021fc72c6
Коммит c2d08b7540
22 изменённых файлов: 143 добавлений и 101 удалений

Просмотреть файл

@@ -5759,16 +5759,23 @@ func (c *Client4) GetClusterStatus(ctx context.Context) ([]*ClusterInfo, *Respon
// LDAP Section
// SyncLdap will force a sync with the configured LDAP server.
// If includeRemovedMembers is true, then group members who left or were removed from a
// SyncLdap starts a run of the LDAP sync job.
//
// If reAddRemovedMembers is true, then group members who left or were removed from a
// synced team/channel will be re-joined; otherwise, they will be excluded.
func (c *Client4) SyncLdap(ctx context.Context, includeRemovedMembers bool) (*Response, error) {
reqBody, err := json.Marshal(map[string]any{
"include_removed_members": includeRemovedMembers,
})
//
// The ReAddRemovedMembers option is deprecated. Use LdapSettings.ReAddRemovedMembers instead.
func (c *Client4) SyncLdap(ctx context.Context, reAddRemovedMembers *bool) (*Response, error) {
data := map[string]any{}
if reAddRemovedMembers != nil {
data["include_removed_members"] = *reAddRemovedMembers
}
reqBody, err := json.Marshal(data)
if err != nil {
return nil, NewAppError("SyncLdap", "api.marshal_error", nil, "", http.StatusInternalServerError).Wrap(err)
}
r, err := c.DoAPIPostBytes(ctx, c.ldapRoute()+"/sync", reqBody)
if err != nil {
return BuildResponse(r), err

Просмотреть файл

@@ -2480,7 +2480,8 @@ type LdapSettings struct {
PictureAttribute *string `access:"authentication_ldap"`
// Synchronization
SyncIntervalMinutes *int `access:"authentication_ldap"`
SyncIntervalMinutes *int `access:"authentication_ldap"`
ReAddRemovedMembers *bool `access:"authentication_ldap"`
// Advanced
SkipCertificateVerification *bool `access:"authentication_ldap"`
@@ -2613,6 +2614,10 @@ func (s *LdapSettings) SetDefaults() {
s.SyncIntervalMinutes = NewPointer(60)
}
if s.ReAddRemovedMembers == nil {
s.ReAddRemovedMembers = NewPointer(false)
}
if s.SkipCertificateVerification == nil {
s.SkipCertificateVerification = NewPointer(false)
}