Project

General

Profile

« Previous | Next » 

Revision 2ef6f4da

Added by Daniel Lobato Garcia over 8 years ago

Fixes #11407 - Uppercase logins from LDAP break external user group sync

On LDAP the login can contain uppercase chars, for instance, "FOO". However
when we log in Foreman for the first time and have that account auto-created,
we can login using "foo". After that, our login will be saved as "foo" on
Foreman.

When a user group that contains said group is refreshed, we pull the names
from LDAP, auth_source.users_in_group(name). This will return an array
containing "FOO". After that, we will call usergroup.add_users(["FOO"])
which in turn calls User.where(:login => ["FOO"]). This will be empty since
our login in the database is "foo".

This commit fixes this issue in two places:
One, by saving the login as it comes from LDAP (case aware), so that
in the previous example 'FOO' would've been saved even if the user had
try to login as 'foo'.

Two, by making add_users and remove_users case insensitive.
  • added
  • modified
  • copied
  • renamed
  • deleted