allow any authenticated user to access the schedule preview API endpoint

see: https://github.com/ansible/tower/issues/1939
This commit is contained in:
Ryan Petrello 2018-05-23 16:51:58 -04:00
parent 1564f62c2a
commit 63f089c712
2 changed files with 7 additions and 0 deletions

View File

@ -720,6 +720,7 @@ class SchedulePreview(GenericAPIView):
model = Schedule
view_name = _('Schedule Recurrence Rule Preview')
serializer_class = SchedulePreviewSerializer
permission_classes = (IsAuthenticated,)
def post(self, request):
serializer = self.get_serializer(data=request.data)

View File

@ -87,6 +87,12 @@ def test_invalid_rrules(post, admin_user, project, inventory, rrule, error):
assert error in resp.content
@pytest.mark.django_db
def test_normal_users_can_preview_schedules(post, alice):
url = reverse('api:schedule_rrule')
post(url, {'rrule': get_rrule()}, alice, expect=200)
@pytest.mark.django_db
def test_utc_preview(post, admin_user):
url = reverse('api:schedule_rrule')