Skip to content

Commit

Permalink
task/wp-346-submitter-reg-listing-permissions (#238)
Browse files Browse the repository at this point in the history
* Updated permissions for registration table view

* Remove unused submitter_admin check function

* Remove diff
  • Loading branch information
sophia-massie authored Nov 1, 2023
1 parent ed8c266 commit 4482396
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
5 changes: 2 additions & 3 deletions apcd-cms/src/apps/submitter_renewals_listing/views.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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)

Expand Down
3 changes: 0 additions & 3 deletions apcd-cms/src/apps/utils/apcd_groups.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

0 comments on commit 4482396

Please sign in to comment.