From c2ea9c3c00fa7615545e330620bcd4147222f4ea Mon Sep 17 00:00:00 2001 From: Matthew Jones Date: Thu, 10 Mar 2016 16:08:11 -0500 Subject: [PATCH] Make survey always visible if license enables Previously this would only be visible if survey is enabled. It should be possible to define and view a survey even if this is disabled. The enablement flag controls whether the survey prompt is shown and required. --- awx/api/views.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/awx/api/views.py b/awx/api/views.py index eb7cf9d64e..9b330805aa 100644 --- a/awx/api/views.py +++ b/awx/api/views.py @@ -1907,8 +1907,11 @@ class JobTemplateSurveySpec(GenericAPIView): def get(self, request, *args, **kwargs): obj = self.get_object() - if not obj.survey_enabled: - return Response(status=status.HTTP_404_NOT_FOUND) + # Sanity check: Are surveys available on this license? + # If not, do not allow them to be used. + if not feature_enabled('surveys'): + raise LicenseForbids('Your license does not allow ' + 'adding surveys.') return Response(obj.survey_spec) def post(self, request, *args, **kwargs):