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_func = getattr(task_module, task.task_call_func)
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(
{
"successful": True,

View File

@ -32,7 +32,10 @@ def ldap_sync(self: MonitoredTask, source_pk: int):
TaskResult(
TaskResultStatus.SUCCESSFUL,
[f"Synced {user_count} users", f"Synced {group_count} groups"],
uid=source.name,
)
)
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"""
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.backends import BaseBackend
from django.contrib.auth.signals import user_login_failed