Fixing GetLDAPUserAttributes to work with SAML as well. (#10498)

Этот коммит содержится в:
Christopher Speller
2019-03-26 05:36:35 -07:00
коммит произвёл Joram Wilander
родитель c3c8b28eb7
Коммит 50ef597a69

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

@@ -284,13 +284,19 @@ func (api *PluginAPI) GetLDAPUserAttributes(userId string, attributes []string)
return nil, err return nil, err
} }
if user.AuthService != model.USER_AUTH_SERVICE_LDAP || user.AuthData == nil { if user.AuthData == nil {
return map[string]string{}, nil return map[string]string{}, nil
} }
// Only bother running the query if the user's auth service is LDAP or it's SAML and sync is enabled.
if user.AuthService == model.USER_AUTH_SERVICE_LDAP ||
(user.AuthService == model.USER_AUTH_SERVICE_SAML && *api.app.Config().SamlSettings.EnableSyncWithLdap) {
return api.app.Ldap.GetUserAttributes(*user.AuthData, attributes) return api.app.Ldap.GetUserAttributes(*user.AuthData, attributes)
} }
return map[string]string{}, nil
}
func (api *PluginAPI) CreateChannel(channel *model.Channel) (*model.Channel, *model.AppError) { func (api *PluginAPI) CreateChannel(channel *model.Channel) (*model.Channel, *model.AppError) {
return api.app.CreateChannel(channel, false) return api.app.CreateChannel(channel, false)
} }