Skip to content

Commit

Permalink
Merge pull request #8398 from RocketChat/improvements/ldap-size-config
Browse files Browse the repository at this point in the history
Fix: Missing settings to configure LDAP size and page limits
  • Loading branch information
rodrigok authored Oct 4, 2017
2 parents 76d2061 + 1945cd3 commit 8627049
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
6 changes: 5 additions & 1 deletion packages/rocketchat-i18n/i18n/en.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -1044,6 +1044,10 @@
"LDAP_Sync_User_Data_Description": "Keep user data in sync with server on **login** or on **background sync** (eg: name, email).",
"LDAP_Sync_User_Data_FieldMap": "User Data Field Map",
"LDAP_Sync_User_Data_FieldMap_Description": "Configure how user account fields (like email) are populated from a record in LDAP (once found). <br/>As an example, `{\"cn\":\"name\", \"mail\":\"email\"}` will choose a person's human readable name from the cn attribute, and their email from the mail attribute. Additionally it is possible to use variables, for example: `{ \"#{givenName} #{sn}\": \"name\", \"mail\": \"email\" }` uses a combination of the user's first name and last name for the rocket chat `name` field.<br/>Available fields in Rocket.Chat: `name`, `email` and `customFields`.",
"LDAP_Search_Page_Size": "Search Page Size",
"LDAP_Search_Page_Size_Description": "The maximum number of entries each result page will return to be processed",
"LDAP_Search_Size_Limit": "Search Size Limit",
"LDAP_Search_Size_Limit_Description": "The maximum number of entries to return.<br/>**Attention** This number should greater than **Search Page Size**",
"LDAP_Test_Connection": "Test Connection",
"LDAP_Timeout": "Timeout (ms)",
"LDAP_Timeout_Description": "How many mileseconds wait for a search result before return an error",
Expand Down Expand Up @@ -2029,4 +2033,4 @@
"your_message_optional": "your message (optional)",
"Your_password_is_wrong": "Your password is wrong!",
"Your_push_was_sent_to_s_devices": "Your push was sent to %s devices"
}
}
5 changes: 4 additions & 1 deletion packages/rocketchat-ldap/server/ldap.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ export default class LDAP {
User_Search_Filter: RocketChat.settings.get('LDAP_User_Search_Filter'),
User_Search_Scope: RocketChat.settings.get('LDAP_User_Search_Scope'),
User_Search_Field: RocketChat.settings.get('LDAP_User_Search_Field'),
Search_Page_Size: RocketChat.settings.get('LDAP_Search_Page_Size'),
Search_Size_Limit: RocketChat.settings.get('LDAP_Search_Size_Limit'),
group_filter_enabled: RocketChat.settings.get('LDAP_Group_Filter_Enable'),
group_filter_object_class: RocketChat.settings.get('LDAP_Group_Filter_ObjectClass'),
group_filter_group_id_attribute: RocketChat.settings.get('LDAP_Group_Filter_Group_Id_Attribute'),
Expand Down Expand Up @@ -209,8 +211,9 @@ export default class LDAP {
const searchOptions = {
filter: this.getUserFilter(username),
scope: this.options.User_Search_Scope || 'sub',
sizeLimit: this.options.Search_Size_Limit,
paged: {
pageSize: 250,
pageSize: this.options.Search_Page_Size,
pagePause: !!page
}
};
Expand Down
2 changes: 2 additions & 0 deletions packages/rocketchat-ldap/server/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ RocketChat.settings.addGroup('LDAP', function() {
this.add('LDAP_User_Search_Filter', '(objectclass=*)', { type: 'string', enableQuery });
this.add('LDAP_User_Search_Scope', 'sub', { type: 'string', enableQuery });
this.add('LDAP_User_Search_Field', 'sAMAccountName', { type: 'string', enableQuery });
this.add('LDAP_Search_Page_Size', 250, { type: 'int', enableQuery });
this.add('LDAP_Search_Size_Limit', 1000, { type: 'int', enableQuery });
});

this.section('User Search (Group Validation)', function() {
Expand Down

0 comments on commit 8627049

Please sign in to comment.