|
1 | 1 | from django.http import HttpResponse, HttpResponseRedirect, JsonResponse
|
2 | 2 | from django.template import loader
|
3 |
| -from apps.utils.apcd_database import get_registrations, get_registration_contacts, get_user_role, get_submitter_info, get_registration_entities |
| 3 | +from apps.utils.apcd_database import get_registrations, get_registration_contacts, get_submitter_info, get_registration_entities |
| 4 | +from apps.utils.apcd_groups import has_groups |
4 | 5 | from apps.admin_regis_table.views import RegistrationsTable
|
5 | 6 | import logging
|
6 | 7 | import json
|
@@ -31,9 +32,9 @@ def get(self, request, *args, **kwargs):
|
31 | 32 | return HttpResponse(template.render(context, request))
|
32 | 33 |
|
33 | 34 | def dispatch(self, request, *args, **kwargs):
|
34 |
| - if not request.user.is_authenticated or not (get_user_role(request.user.username) in ['APCD_ADMIN', 'SUBMITTER_ADMIN']): |
| 35 | + if not request.user.is_authenticated or not (has_groups(request.user, ['APCD_ADMIN', 'SUBMITTER_ADMIN'])): |
35 | 36 | return HttpResponseRedirect('/')
|
36 |
| - return super(SubmittersTable, self).dispatch(request, *args, **kwargs) |
| 37 | + return super(RegistrationsTable, self).dispatch(request, *args, **kwargs) |
37 | 38 |
|
38 | 39 | def get_context_data(self, registrations_content, registrations_entities, registrations_contacts, *args, **kwargs):
|
39 | 40 | registrations_entities = []
|
|
0 commit comments