sources/ldap: fix MonitoredTask not using uid

This commit is contained in:
Jens Langhammer 2020-10-16 16:42:46 +02:00
parent aa9c7a6567
commit 54088239ab
3 changed files with 9 additions and 3 deletions

View file

@ -53,7 +53,10 @@ class TaskViewSet(ViewSet):
task_module = import_module(task.task_call_module) task_module = import_module(task.task_call_module)
task_func = getattr(task_module, task.task_call_func) task_func = getattr(task_module, task.task_call_func)
task_func.delay(*task.task_call_args, **task.task_call_kwargs) task_func.delay(*task.task_call_args, **task.task_call_kwargs)
messages.success(self.request, _("Successfully re-scheduled Task %(name)s!" % {'name': task.task_name})) messages.success(
self.request,
_("Successfully re-scheduled Task %(name)s!" % {"name": task.task_name}),
)
return Response( return Response(
{ {
"successful": True, "successful": True,

View file

@ -32,7 +32,10 @@ def ldap_sync(self: MonitoredTask, source_pk: int):
TaskResult( TaskResult(
TaskResultStatus.SUCCESSFUL, TaskResultStatus.SUCCESSFUL,
[f"Synced {user_count} users", f"Synced {group_count} groups"], [f"Synced {user_count} users", f"Synced {group_count} groups"],
uid=source.name,
) )
) )
except LDAPException as exc: except LDAPException as exc:
self.set_status(TaskResult(TaskResultStatus.ERROR).with_error(exc)) self.set_status(
TaskResult(TaskResultStatus.ERROR, uid=source.name).with_error(exc)
)

View file

@ -1,7 +1,7 @@
"""passbook password stage""" """passbook password stage"""
from typing import Any, Dict, List, Optional from typing import Any, Dict, List, Optional
from django.contrib import messages
from django.contrib import messages
from django.contrib.auth import _clean_credentials from django.contrib.auth import _clean_credentials
from django.contrib.auth.backends import BaseBackend from django.contrib.auth.backends import BaseBackend
from django.contrib.auth.signals import user_login_failed from django.contrib.auth.signals import user_login_failed