mirror of https://github.com/jumpserver/jumpserver
parent
ef33bc211d
commit
b8c872c68e
|
@ -3,10 +3,10 @@ from django.utils.translation import ugettext_lazy as _
|
|||
from rest_framework import status, mixins, viewsets
|
||||
from rest_framework.response import Response
|
||||
|
||||
from accounts.models import AutomationExecution
|
||||
from accounts.tasks import execute_automation
|
||||
from assets import serializers
|
||||
from assets.models import BaseAutomation
|
||||
from accounts.tasks import execute_automation
|
||||
from accounts.models import AutomationExecution
|
||||
from common.const.choices import Trigger
|
||||
from orgs.mixins import generics
|
||||
|
||||
|
@ -110,6 +110,6 @@ class AutomationExecutionViewSet(
|
|||
serializer.is_valid(raise_exception=True)
|
||||
automation = serializer.validated_data.get('automation')
|
||||
task = execute_automation.delay(
|
||||
pid=automation.pk, trigger=Trigger.manual, tp=self.tp
|
||||
pid=str(automation.pk), trigger=Trigger.manual, tp=self.tp
|
||||
)
|
||||
return Response({'task': task.id}, status=status.HTTP_201_CREATED)
|
||||
|
|
|
@ -52,6 +52,8 @@ class AccountSerializerCreateValidateMixin:
|
|||
return instance
|
||||
|
||||
def update(self, instance, validated_data):
|
||||
# account cannot be modified
|
||||
validated_data.pop('username', None)
|
||||
push_now = validated_data.pop('push_now', None)
|
||||
instance = super().update(instance, validated_data)
|
||||
self.push_account(instance, push_now)
|
||||
|
|
|
@ -295,10 +295,6 @@ class DatesLoginMetricMixin:
|
|||
def user_login_success_logs_amount(self):
|
||||
return self.login_logs_queryset.filter(status=LoginStatusChoices.success).count()
|
||||
|
||||
@lazyproperty
|
||||
def user_login_logs_amount(self):
|
||||
return self.login_logs_queryset.values('username').count()
|
||||
|
||||
@lazyproperty
|
||||
def user_login_amount(self):
|
||||
return self.login_logs_queryset.values('username').distinct().count()
|
||||
|
@ -383,11 +379,6 @@ class IndexApi(DateTimeMixin, DatesLoginMetricMixin, APIView):
|
|||
'total_count_login_users': self.user_login_amount
|
||||
})
|
||||
|
||||
if _all or query_params.get('total_count') or query_params.get('total_count_login_user_logs'):
|
||||
data.update({
|
||||
'total_count_login_user_logs': self.user_login_logs_amount
|
||||
})
|
||||
|
||||
if _all or query_params.get('total_count') or query_params.get('total_count_today_active_assets'):
|
||||
data.update({
|
||||
'total_count_today_active_assets': caches.total_count_today_active_assets,
|
||||
|
|
Loading…
Reference in New Issue