Esempio n. 1
0
 def post(self, request, *args, **kwargs):
     serializer = InsecureCommandAlertSerializer(data=request.data, many=True)
     serializer.is_valid(raise_exception=True)
     commands = serializer.validated_data
     for command in commands:
         if command['risk_level'] >= settings.SECURITY_INSECURE_COMMAND_LEVEL:
             CommandAlertMessage(command).publish_async()
     return Response()
Esempio n. 2
0
 def post(self, request, *args, **kwargs):
     serializer = InsecureCommandAlertSerializer(data=request.data,
                                                 many=True)
     serializer.is_valid(raise_exception=True)
     commands = serializer.validated_data
     for command in commands:
         if command['risk_level'] >= settings.SECURITY_INSECURE_COMMAND_LEVEL and \
                 settings.SECURITY_INSECURE_COMMAND and \
                 settings.SECURITY_INSECURE_COMMAND_EMAIL_RECEIVER:
             send_command_alert_mail(command)
     return Response()