From 4482396ccb96d74298ea853fb68b78d16cf376bb Mon Sep 17 00:00:00 2001 From: sophia-massie <96220951+sophia-massie@users.noreply.github.com> Date: Wed, 1 Nov 2023 10:18:42 -0500 Subject: [PATCH] task/wp-346-submitter-reg-listing-permissions (#238) * Updated permissions for registration table view * Remove unused submitter_admin check function * Remove diff --- apcd-cms/src/apps/submitter_renewals_listing/views.py | 5 ++--- apcd-cms/src/apps/utils/apcd_groups.py | 3 --- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/apcd-cms/src/apps/submitter_renewals_listing/views.py b/apcd-cms/src/apps/submitter_renewals_listing/views.py index 921c8a52..fb766c34 100644 --- a/apcd-cms/src/apps/submitter_renewals_listing/views.py +++ b/apcd-cms/src/apps/submitter_renewals_listing/views.py @@ -1,8 +1,7 @@ from django.http import HttpResponse, HttpResponseRedirect, JsonResponse from django.views.generic.base import TemplateView from django.template import loader -from apps.utils.apcd_database import get_registrations, get_registration_contacts, get_submitter_info, get_registration_entities -from apps.utils.apcd_groups import is_submitter_admin +from apps.utils.apcd_database import get_registrations, get_registration_contacts, get_user_role, get_submitter_info, get_registration_entities from apps.admin_regis_table.views import RegistrationsTable import logging import json @@ -31,7 +30,7 @@ def get(self, request, *args, **kwargs): return HttpResponse(template.render(context, request)) def dispatch(self, request, *args, **kwargs): - if not request.user.is_authenticated or not is_submitter_admin(request.user): + if not request.user.is_authenticated or not (get_user_role(request.user.username) in ['APCD_ADMIN', 'SUBMITTER_ADMIN']): return HttpResponseRedirect('/') return super(SubmittersTable, self).dispatch(request, *args, **kwargs) diff --git a/apcd-cms/src/apps/utils/apcd_groups.py b/apcd-cms/src/apps/utils/apcd_groups.py index 39305034..866afb65 100644 --- a/apcd-cms/src/apps/utils/apcd_groups.py +++ b/apcd-cms/src/apps/utils/apcd_groups.py @@ -6,6 +6,3 @@ def has_apcd_group(user): def is_apcd_admin(user): return user.groups.filter(name='APCD_ADMIN').exists() - -def is_submitter_admin(user): - return user.groups.filter(name='SUBMITTER_ADMIN').exists() \ No newline at end of file