Skip to content

Commit d8b11c4

Browse files
committed
Removed an unused and unnecessary API endpoint, now that gather.town has gotten OpenID Connect authentication working.
- Legacy-Id: 18190
1 parent 1239e91 commit d8b11c4

6 files changed

Lines changed: 24 additions & 37 deletions

File tree

ietf/api/tests.py

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -277,24 +277,6 @@ def test_api_v2_person_export_view(self):
277277
self.assertEqual(data['user']['email'], secretariat.user.email)
278278

279279

280-
def test_api_v2_person_access_meetecho(self):
281-
url = urlreverse('ietf.api.views.person_access_meetecho')
282-
person = PersonFactory()
283-
apikey = PersonalApiKey.objects.create(endpoint=url, person=person)
284-
285-
# error cases
286-
r = self.client.get(url, {'apikey': apikey.hash()})
287-
self.assertContains(r, "Too long since last regular login", status_code=400)
288-
person.user.last_login = timezone.now()
289-
person.user.save()
290-
291-
# working case
292-
r = self.client.get(url, {'apikey': apikey.hash()})
293-
self.assertEqual(r.status_code, 200)
294-
data = r.json()
295-
self.assertEqual(data['name'], person.plain_name())
296-
self.assertEqual(data['email'], person.email().address)
297-
298280
def test_api_new_meeting_registration(self):
299281
meeting = MeetingFactory(type_id='ietf')
300282
reg = {

ietf/api/urls.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,6 @@
3434
url(r'^notify/meeting/registration/?', api_views.api_new_meeting_registration),
3535
# OpenID authentication provider
3636
url(r'^openid/', include('oidc_provider.urls', namespace='oidc_provider')),
37-
# For meetecho access
38-
url(r'^person/access/meetecho', api_views.person_access_meetecho),
3937
# Draft submission API
4038
url(r'^submit/?$', submit_views.api_submit),
4139
]

ietf/api/views.py

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -102,19 +102,26 @@ def post(self, request):
102102

103103
return self.json_view(request, filter=querydict.dict(), expand=expand)
104104

105-
@require_api_key
106-
@csrf_exempt
107-
def person_access_meetecho(request):
108-
person = get_object_or_404(Person, user=request.user)
109-
110-
return HttpResponse(json.dumps({
111-
'name' : person.plain_name(),
112-
'email': person.email().address,
113-
'roles': {
114-
'chair': list(person.role_set.filter(name='chair', group__state__in=['active', 'bof', 'proposed']).values_list('group__acronym', flat=True)),
115-
'secr': list(person.role_set.filter(name='secr', group__state__in=['active', 'bof', 'proposed']).values_list('group__acronym', flat=True)),
116-
}
117-
}), content_type='application/json')
105+
# @require_api_key
106+
# @csrf_exempt
107+
# def person_access_token(request):
108+
# person = get_object_or_404(Person, user=request.user)
109+
#
110+
# if request.method == 'POST':
111+
# client_id = request.POST.get('client_id', None)
112+
# client_secret = request.POST.get('client_secret', None)
113+
# client = get_object_or_404(ClientRecord, client_id=client_id, client_secret=client_secret)
114+
#
115+
# return HttpResponse(json.dumps({
116+
# 'name' : person.plain_name(),
117+
# 'email': person.email().address,
118+
# 'roles': {
119+
# 'chair': list(person.role_set.filter(name='chair', group__state__in=['active', 'bof', 'proposed']).values_list('group__acronym', flat=True)),
120+
# 'secr': list(person.role_set.filter(name='secr', group__state__in=['active', 'bof', 'proposed']).values_list('group__acronym', flat=True)),
121+
# }
122+
# }), content_type='application/json')
123+
# else:
124+
# return HttpResponse(status=405)
118125

119126
@require_api_key
120127
@role_required('Robot')

ietf/utils/management/commands/send_apikey_usage_emails.py renamed to ietf/ietfauth/management/commands/send_apikey_usage_emails.py

File renamed without changes.

ietf/ietfauth/tests.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -530,8 +530,9 @@ def test_change_username(self):
530530
self.assertTrue(user.check_password('password'))
531531

532532
def test_apikey_management(self):
533-
person = PersonFactory()
534-
533+
# Create a person with a role that will give at least one valid apikey
534+
person = RoleFactory(name_id='secr', group__acronym='secretariat').person
535+
535536
url = urlreverse('ietf.ietfauth.views.apikey_index')
536537

537538
# Check that the url is protected, then log in
@@ -632,7 +633,7 @@ def test_send_apikey_report(self):
632633
from ietf.ietfauth.management.commands.send_apikey_usage_emails import Command
633634
from ietf.utils.mail import outbox, empty_outbox
634635

635-
person = PersonFactory()
636+
person = RoleFactory(name_id='secr', group__acronym='secretariat').person
636637

637638
url = urlreverse('ietf.ietfauth.views.apikey_create')
638639
# Check that the url is protected, then log in

ietf/person/models.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,6 @@ def salt():
340340
("/api/iesg/position", "/api/iesg/position", "Area Director"),
341341
("/api/v2/person/person", "/api/v2/person/person", "Secretariat"),
342342
("/api/meeting/session/video/url", "/api/meeting/session/video/url", "Recording Manager"),
343-
("/api/person/access/meetecho", "/api/person/access/meetecho", None),
344343
("/api/notify/meeting/registration", "/api/notify/meeting/registration", "Robot"),
345344
]
346345
PERSON_API_KEY_ENDPOINTS = [ (v, n) for (v, n, r) in PERSON_API_KEY_VALUES ]

0 commit comments

Comments
 (0)