more fixes for windows agent

This commit is contained in:
wh1te909 2020-05-30 23:49:52 +00:00
parent d9a340e7fe
commit b78e4e58e2
2 changed files with 11 additions and 5 deletions

View File

@ -393,8 +393,15 @@ class CheckRunner(APIView):
permission_classes = [IsAuthenticated]
def get(self, request, pk):
agent = get_object_or_404(Agent, pk=pk)
checks = Check.objects.filter(agent__pk=pk)
return Response(CheckRunnerGetSerializer(checks, many=True).data)
ret = {
"agent": agent.pk,
"check_interval": agent.check_interval,
"checks": CheckRunnerGetSerializer(checks, many=True).data,
}
return Response(ret)
def patch(self, request, pk):
check = get_object_or_404(Check, pk=pk)
@ -420,8 +427,8 @@ class TaskRunner(APIView):
For windows agent
"""
# authentication_classes = [TokenAuthentication]
# permission_classes = [IsAuthenticated]
authentication_classes = [TokenAuthentication]
permission_classes = [IsAuthenticated]
def get(self, request, pk):

View File

@ -63,7 +63,7 @@ class CheckSerializer(serializers.ModelSerializer):
class AssignedTaskCheckRunnerField(serializers.ModelSerializer):
class Meta:
model = AutomatedTask
fields = ["id", "win_task_name", "enabled"]
fields = ["id", "enabled"]
class CheckRunnerGetSerializer(serializers.ModelSerializer):
@ -81,7 +81,6 @@ class CheckRunnerGetSerializer(serializers.ModelSerializer):
class Meta:
model = Check
exclude = [
"agent",
"policy",
"name",
"more_info",