1
0
mirror of https://github.com/ansible/awx.git synced 2024-11-01 08:21:15 +03:00

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.
This commit is contained in:
Matthew Jones 2016-03-10 16:08:11 -05:00
parent c5eae5de41
commit c2ea9c3c00

View File

@ -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):