From 54088239ab4734cbfba8df3c4e6e490bf4ebf1a4 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Fri, 16 Oct 2020 16:42:46 +0200 Subject: [PATCH] sources/ldap: fix MonitoredTask not using uid --- passbook/admin/api/tasks.py | 5 ++++- passbook/sources/ldap/tasks.py | 5 ++++- passbook/stages/password/stage.py | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/passbook/admin/api/tasks.py b/passbook/admin/api/tasks.py index b0c752747..3a0a2b15a 100644 --- a/passbook/admin/api/tasks.py +++ b/passbook/admin/api/tasks.py @@ -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, diff --git a/passbook/sources/ldap/tasks.py b/passbook/sources/ldap/tasks.py index eb5ddfd2e..fda1fea9f 100644 --- a/passbook/sources/ldap/tasks.py +++ b/passbook/sources/ldap/tasks.py @@ -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) + ) diff --git a/passbook/stages/password/stage.py b/passbook/stages/password/stage.py index 6389bdffe..9dce680bf 100644 --- a/passbook/stages/password/stage.py +++ b/passbook/stages/password/stage.py @@ -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