[FIX] LDAP login error on Enterprise version (#17497)

pull/17419/head^2
pierre-lehnen-rc 6 years ago committed by GitHub
parent e0b867666d
commit 2808ce7e97
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      app/ldap/server/loginHandler.js
  2. 2
      app/ldap/server/sync.js
  3. 2
      ee/app/ldap-enterprise/server/listener.js

@ -126,6 +126,7 @@ Accounts.registerLoginHandler('ldap', function(loginRequest) {
if (settings.get('LDAP_Login_Fallback') === true && typeof loginRequest.ldapPass === 'string' && loginRequest.ldapPass.trim() !== '') {
Accounts.setPassword(user._id, loginRequest.ldapPass, { logout: false });
}
logger.info('running afterLDAPLogin');
callbacks.run('afterLDAPLogin', { user, ldapUser, ldap });
return {
userId: user._id,

@ -210,6 +210,7 @@ export function mapLdapGroupsToUserRoles(ldap, ldapUser, user) {
const syncUserRolesFieldMap = settings.get('LDAP_Sync_User_Data_GroupsMap').trim();
if (!syncUserRoles || !syncUserRolesFieldMap) {
logger.debug('not syncing user roles');
return [];
}
@ -296,6 +297,7 @@ export function mapLDAPGroupsToChannels(ldap, ldapUser, user) {
const userChannels = [];
if (!syncUserRoles || !syncUserRolesAutoChannels || !syncUserRolesChannelFieldMap) {
logger.debug('not syncing groups to channels');
return [];
}

@ -5,8 +5,8 @@ export const onLdapLogin = ({ user, ldapUser, ldap }) => {
const validateLdapRolesForEachLogin = settings.get('LDAP_Validate_Roles_For_Each_Login');
const userExists = user._id;
const userId = userExists ? user._id : user.userId;
const ldapUserRoles = getLdapRolesByUsername(ldapUser.uid, ldap);
if (!userExists || validateLdapRolesForEachLogin) {
const ldapUserRoles = getLdapRolesByUsername(ldapUser.uid, ldap);
const roles = getRocketChatRolesByLdapRoles(JSON.parse(settings.get('LDAP_Roles_To_Rocket_Chat_Roles')), ldapUserRoles);
updateUserUsingMappedLdapRoles(userId, roles);
}

Loading…
Cancel
Save