diff --git a/ietf/ietfauth/tests.py b/ietf/ietfauth/tests.py index 27ef217ab..4d6d19f54 100644 --- a/ietf/ietfauth/tests.py +++ b/ietf/ietfauth/tests.py @@ -847,6 +847,14 @@ class OpenIDConnectTests(TestCase): self.assertIn('full_week', set(userinfo['ticket_type'].split())) self.assertIn('Some Company', userinfo['affiliation']) + # Create a third registration, with a composite reg type + MeetingRegistration.objects.create( + meeting=meeting, person=None, first_name=person.first_name(), last_name=person.last_name(), + email=email_list[1], ticket_type='one_day', reg_type='hackathon remote', affiliation='Some Company, Inc', + ) + userinfo = client.do_user_info_request(state=params["state"], scope=args['scope']) + self.assertEqual(set(userinfo['reg_type'].split()), set(['remote', 'hackathon'])) + # Check that ending a session works r = client.do_end_session_request(state=params["state"], scope=args['scope']) self.assertEqual(r.status_code, 302) diff --git a/ietf/ietfauth/utils.py b/ietf/ietfauth/utils.py index 6f2565b70..4c23c7208 100644 --- a/ietf/ietfauth/utils.py +++ b/ietf/ietfauth/utils.py @@ -268,12 +268,19 @@ class OidcExtraScopeClaims(oidc_provider.lib.claims.ScopeClaims): reg.attended = True reg.save() # fill in info to return + ticket_types = set([]) + reg_types = set([]) + for reg in regs: + for t in reg.ticket_type.split(): + ticket_types.add(t) + for r in reg.reg_type.split(): + reg_types.add(r) info = { 'meeting': meeting.number, # full_week, one_day, student: - 'ticket_type': ' '.join(set( reg.ticket_type for reg in regs )), + 'ticket_type': ' '.join(ticket_types), # in_person, onliine, hackathon: - 'reg_type': ' '.join(set( reg.reg_type for reg in regs )), + 'reg_type': ' '.join(reg_types), 'affiliation': ([ reg.affiliation for reg in regs if reg.affiliation ] or [''])[0], }