Skip to content

Commit

Permalink
Remove is_staff check for GroupUtilizationView (#1028)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jkrzy authored Apr 10, 2020
1 parent 5808d5a commit 313e5f3
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 7 deletions.
2 changes: 1 addition & 1 deletion tock/utilization/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ def setUp(self):

self.user = User.objects.create(
username='regular.user',
is_staff=True
)

# When we create the user, we have to assign them a unit from test data
# or else we can't find them in test data.
self.user_data = UserData.objects.get_or_create(user=self.user)[0]
Expand Down
6 changes: 0 additions & 6 deletions tock/utilization/views.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from django.contrib.auth import get_user_model
from django.core.exceptions import PermissionDenied
from django.views.generic import ListView
from hours.models import ReportingPeriod
from organizations.models import Unit
Expand All @@ -22,14 +21,9 @@ def dispatch(self, *args, **kwargs):
Although recent_rps is set to the last four reporting periods,
we could accept a form response that allows the user or app to
dynamically customize number of periods to include in the queryset.
Also, if they're not staff, we're going to go ahead and bounce
them to 403 so we don't make all these queries.
"""
if not self.request.user.is_authenticated:
return self.handle_no_permission()
if not self.request.user.is_staff:
raise PermissionDenied
self.available_periods = ReportingPeriod.objects.count()
return super().dispatch(*args, **kwargs)

Expand Down

0 comments on commit 313e5f3

Please sign in to comment.