Support DELETE of the license on the config endpoint

This commit is contained in:
Matthew Jones 2015-06-05 15:53:35 -04:00
parent ea1d07aaa4
commit 23eaf9ae42

View File

@ -3,6 +3,7 @@
# All Rights Reserved.
# Python
import os
import cgi
import datetime
import dateutil
@ -263,6 +264,16 @@ class ApiV1ConfigView(APIView):
return Response(license_data)
return Response({"error": "Invalid license"}, status=status.HTTP_400_BAD_REQUEST)
def delete(self, request):
if not request.user.is_superuser:
return Response(None, status=status.HTTP_404_NOT_FOUND)
try:
os.remove(TASK_FILE)
mongodb_control.delay('stop')
except OSError:
pass
return Response()
class DashboardView(APIView):
view_name = "Dashboard"