Adding page size option to LDAP (#3439)
Этот коммит содержится в:
коммит произвёл
Joram Wilander
родитель
0cdc242cfd
Коммит
5dfa4fb629
@@ -2531,6 +2531,14 @@
|
||||
"id": "model.config.is_valid.ldap_sync_interval.app_error",
|
||||
"translation": "Invalid sync interval time. Must be at least one minute."
|
||||
},
|
||||
{
|
||||
"id": "model.config.is_valid.ldap_required.app_error",
|
||||
"translation": "Required LDAP field missing."
|
||||
},
|
||||
{
|
||||
"id": "model.config.is_valid.ldap_max_page_size.app_error",
|
||||
"translation": "Invalid max page size value."
|
||||
},
|
||||
{
|
||||
"id": "model.config.is_valid.listen_address.app_error",
|
||||
"translation": "Invalid listen address for service settings Must be set."
|
||||
|
||||
@@ -208,6 +208,7 @@ type LdapSettings struct {
|
||||
// Advanced
|
||||
SkipCertificateVerification *bool
|
||||
QueryTimeout *int
|
||||
MaxPageSize *int
|
||||
|
||||
// Customization
|
||||
LoginFieldName *string
|
||||
@@ -526,6 +527,11 @@ func (o *Config) SetDefaults() {
|
||||
*o.LdapSettings.QueryTimeout = 60
|
||||
}
|
||||
|
||||
if o.LdapSettings.MaxPageSize == nil {
|
||||
o.LdapSettings.MaxPageSize = new(int)
|
||||
*o.LdapSettings.MaxPageSize = 0
|
||||
}
|
||||
|
||||
if o.LdapSettings.LoginFieldName == nil {
|
||||
o.LdapSettings.LoginFieldName = new(string)
|
||||
*o.LdapSettings.LoginFieldName = ""
|
||||
@@ -724,6 +730,10 @@ func (o *Config) IsValid() *AppError {
|
||||
return NewLocAppError("Config.IsValid", "model.config.is_valid.ldap_sync_interval.app_error", nil, "")
|
||||
}
|
||||
|
||||
if *o.LdapSettings.MaxPageSize < 0 {
|
||||
return NewLocAppError("Config.IsValid", "model.config.is_valid.ldap_max_page_size.app_error", nil, "")
|
||||
}
|
||||
|
||||
if *o.LdapSettings.Enable {
|
||||
if *o.LdapSettings.LdapServer == "" ||
|
||||
*o.LdapSettings.BaseDN == "" ||
|
||||
|
||||
@@ -38,6 +38,7 @@ export default class LdapSettings extends AdminSettings {
|
||||
syncIntervalMinutes: props.config.LdapSettings.SyncIntervalMinutes,
|
||||
skipCertificateVerification: props.config.LdapSettings.SkipCertificateVerification,
|
||||
queryTimeout: props.config.LdapSettings.QueryTimeout,
|
||||
maxPageSize: props.config.LdapSettings.MaxPageSize,
|
||||
loginFieldName: props.config.LdapSettings.LoginFieldName
|
||||
});
|
||||
}
|
||||
@@ -60,6 +61,7 @@ export default class LdapSettings extends AdminSettings {
|
||||
config.LdapSettings.SyncIntervalMinutes = this.parseIntNonZero(this.state.syncIntervalMinutes);
|
||||
config.LdapSettings.SkipCertificateVerification = this.state.skipCertificateVerification;
|
||||
config.LdapSettings.QueryTimeout = this.parseIntNonZero(this.state.queryTimeout);
|
||||
config.LdapSettings.MaxPageSize = this.parseInt(this.state.maxPageSize);
|
||||
config.LdapSettings.LoginFieldName = this.state.loginFieldName;
|
||||
|
||||
return config;
|
||||
@@ -386,6 +388,25 @@ export default class LdapSettings extends AdminSettings {
|
||||
onChange={this.handleChange}
|
||||
disabled={!this.state.enable}
|
||||
/>
|
||||
<TextSetting
|
||||
id='maxPageSize'
|
||||
label={
|
||||
<FormattedMessage
|
||||
id='admin.ldap.maxPageSizeTitle'
|
||||
defaultMessage='Maximum Page Size'
|
||||
/>
|
||||
}
|
||||
placeholder={Utils.localizeMessage('admin.ldap.maxPageSizeEx', 'Ex "2000"')}
|
||||
helpText={
|
||||
<FormattedMessage
|
||||
id='admin.ldap.maxPageSizeHelpText'
|
||||
defaultMessage='The maximum number of users the Mattermost server will request from the LDAP server at one time. 0 is unlimited.'
|
||||
/>
|
||||
}
|
||||
value={this.state.maxPageSize}
|
||||
onChange={this.handleChange}
|
||||
disabled={!this.state.enable}
|
||||
/>
|
||||
<TextSetting
|
||||
id='loginFieldName'
|
||||
label={
|
||||
|
||||
@@ -317,6 +317,9 @@
|
||||
"admin.ldap.queryDesc": "The timeout value for queries to the LDAP server. Increase if you are getting timeout errors caused by a slow LDAP server.",
|
||||
"admin.ldap.queryEx": "Ex \"60\"",
|
||||
"admin.ldap.queryTitle": "Query Timeout (seconds):",
|
||||
"admin.ldap.maxPageSizeTitle": "Maximum Page Size",
|
||||
"admin.ldap.maxPageSizeHelpText": "The maximum number of users the Mattermost server will request from the LDAP server at one time. 0 is unlimited.",
|
||||
"admin.ldap.maxPageSizeEx": "Ex \"2000\"",
|
||||
"admin.ldap.serverDesc": "The domain or IP address of LDAP server.",
|
||||
"admin.ldap.serverEx": "Ex \"10.0.0.23\"",
|
||||
"admin.ldap.serverTitle": "LDAP Server:",
|
||||
|
||||
Ссылка в новой задаче
Block a user