FIX: use case insensitive group name search when applying group rules from SSO

This commit is contained in:
Neil Lalonde 2017-08-02 11:30:23 -04:00
parent 33e22cf598
commit 3de45ce0cd
2 changed files with 2 additions and 2 deletions

View File

@ -108,7 +108,7 @@ class DiscourseSingleSignOn < SingleSignOn
def apply_group_rules(user)
if add_groups
split = add_groups.split(",")
split = add_groups.split(",").map(&:downcase)
if split.length > 0
Group.where('name in (?) AND NOT automatic', split).pluck(:id).each do |id|
unless GroupUser.where(group_id: id, user_id: user.id).exists?

View File

@ -141,7 +141,7 @@ describe DiscourseSingleSignOn do
sso.email = user.email
sso.external_id = "A"
sso.add_groups = "#{add_group1.name},#{add_group2.name},badname"
sso.add_groups = "#{add_group1.name},#{add_group2.name.capitalize},badname"
sso.remove_groups = "#{existing_group.name},badname"
sso.lookup_or_create_user(ip_address)