Added a personal API key for meetecho access.
- Legacy-Id: 17630
This commit is contained in:
parent
bba2149b5e
commit
bd934d0f2d
|
@ -20,8 +20,12 @@ urlpatterns = [
|
|||
url(r'^meeting/session/video/url$', meeting_views.api_set_session_video_url),
|
||||
url(r'^submit/?$', submit_views.api_submit),
|
||||
url(r'^iesg/position', views_ballot.api_set_position),
|
||||
# GPRD: export of all personal information
|
||||
url(r'^export/personal-information/$', api_views.PersonalInformationExportView.as_view()),
|
||||
# For mailarchive
|
||||
url(r'^v2/person/person', api_views.ApiV2PersonExportView.as_view()),
|
||||
# For meetecho access
|
||||
url(r'^v2/person/access/meetecho', api_views.PersonAccessMeetechoView.as_view()),
|
||||
]
|
||||
|
||||
# Additional (standard) Tastypie endpoints
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
|
||||
import json
|
||||
|
||||
from jwcrypto.jwk import JWK
|
||||
|
||||
from django.conf import settings
|
||||
|
@ -92,3 +94,14 @@ class ApiV2PersonExportView(DetailView, JsonExportMixin):
|
|||
return self.err(400, "No filters provided")
|
||||
|
||||
return self.json_view(request, filter=querydict.dict(), expand=expand)
|
||||
|
||||
@method_decorator((csrf_exempt, require_api_key), name='dispatch')
|
||||
class PersonAccessMeetechoView(DetailView, JsonExportMixin):
|
||||
model = Person
|
||||
|
||||
def err(self, code, text):
|
||||
return HttpResponse(text, status=code, content_type='text/plain')
|
||||
|
||||
def get(self, request):
|
||||
person = get_object_or_404(self.model, user=request.user)
|
||||
return HttpResponse(json.dumps({ 'name' : person.name, 'email': person.email().address, }), content_type='application/json')
|
||||
|
|
Loading…
Reference in a new issue