Added some code to set the meeting attendance flag when Meetecho pulls OAuth2 profile data for session participation between the start and end dates for a meeting.
- Legacy-Id: 17956
This commit is contained in:
parent
efcdc4d917
commit
61f01721c6
|
@ -4,7 +4,11 @@
|
|||
|
||||
# various authentication and authorization utilities
|
||||
|
||||
import datetime
|
||||
|
||||
import oidc_provider.lib.claims
|
||||
from oidc_provider.models import Client as ClientRecord
|
||||
|
||||
|
||||
from functools import wraps
|
||||
|
||||
|
@ -238,8 +242,16 @@ class OidcExtraScopeClaims(oidc_provider.lib.claims.ScopeClaims):
|
|||
meeting = get_current_ietf_meeting()
|
||||
person = self.user.person
|
||||
reg = MeetingRegistration.objects.filter(person=person, meeting=meeting).first()
|
||||
today = datetime.date.today()
|
||||
info = {}
|
||||
if reg:
|
||||
# maybe register attendence if logged in to follow a meeting
|
||||
if meeting.date <= today <= meeting.end_date():
|
||||
client = ClientRecord.objects.get(client_id=self.client.client_id)
|
||||
if client.name == 'Meetecho' and not reg.attended:
|
||||
reg.attended = True
|
||||
reg.save()
|
||||
# fill in info to return
|
||||
info = {
|
||||
'meeting': reg.meeting.number,
|
||||
# full_week, one_day, student:
|
||||
|
|
Loading…
Reference in a new issue