mirror of
https://github.com/discourse/discourse.git
synced 2024-11-27 08:53:38 +08:00
FIX: use case insensitive group name search when applying group rules from SSO
This commit is contained in:
parent
33e22cf598
commit
3de45ce0cd
|
@ -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?
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue
Block a user