Added some normalisation of the reg_type and ticket_type entries in the OIDC registration scope.
- Legacy-Id: 18301
This commit is contained in:
parent
5d296775ca
commit
8ac37a3f51
|
@ -847,6 +847,14 @@ class OpenIDConnectTests(TestCase):
|
||||||
self.assertIn('full_week', set(userinfo['ticket_type'].split()))
|
self.assertIn('full_week', set(userinfo['ticket_type'].split()))
|
||||||
self.assertIn('Some Company', userinfo['affiliation'])
|
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
|
# Check that ending a session works
|
||||||
r = client.do_end_session_request(state=params["state"], scope=args['scope'])
|
r = client.do_end_session_request(state=params["state"], scope=args['scope'])
|
||||||
self.assertEqual(r.status_code, 302)
|
self.assertEqual(r.status_code, 302)
|
||||||
|
|
|
@ -268,12 +268,19 @@ class OidcExtraScopeClaims(oidc_provider.lib.claims.ScopeClaims):
|
||||||
reg.attended = True
|
reg.attended = True
|
||||||
reg.save()
|
reg.save()
|
||||||
# fill in info to return
|
# 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 = {
|
info = {
|
||||||
'meeting': meeting.number,
|
'meeting': meeting.number,
|
||||||
# full_week, one_day, student:
|
# 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:
|
# 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],
|
'affiliation': ([ reg.affiliation for reg in regs if reg.affiliation ] or [''])[0],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue