Skip to content

Commit

Permalink
Fixed issue with duplicate roles from LDAP sigin (bigbluebutton#1090)
Browse files Browse the repository at this point in the history
Co-authored-by: Jesus Federico <[email protected]>
  • Loading branch information
farhatahmad and jfederico authored Apr 1, 2020
1 parent f9d193b commit fab3b47
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions app/models/concerns/auth_values.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,14 @@ def auth_image(auth)
end

def auth_roles(user, auth)
auth['info']['roles'] = "Viewer"
unless auth['info']['roles'].nil?
roles = auth['info']['roles'].split(',')

role_provider = auth['provider'] == "bn_launcher" ? auth['info']['customer'] : "greenlight"
roles.each do |role_name|
role = Role.where(provider: role_provider, name: role_name).first
user.roles << role unless role.nil?
role = Role.find_by(provider: role_provider, name: role_name)
user.roles << role if !role.nil? && !user.has_role?(role_name)
end
end
end
Expand Down

0 comments on commit fab3b47

Please sign in to comment.