feat(kanidm): Log some errors

This commit is contained in:
Tom Hubrecht 2024-09-29 19:58:29 +02:00
parent fb70bf13f8
commit f4428ace59
Signed by: thubrecht
SSH key fingerprint: SHA256:r+nK/SIcWlJ0zFZJGHtlAoRwq1Rm+WcKAm5ADYMoQPc

View file

@ -1,3 +1,4 @@
import logging
from dataclasses import dataclass
from functools import cached_property
from typing import Optional, Self
@ -12,6 +13,7 @@ from django.http import HttpRequest
from django.utils.translation import gettext_lazy as _
from kanidm.exceptions import NoMatchingEntries
from kanidm.models.person import Person
from kanidm.radius import ClientConnectorError
from shared.kanidm import klient
@ -174,6 +176,9 @@ class User(AbstractUser):
)
except NoMatchingEntries:
return None
except (TimeoutError, ClientConnectorError) as e:
logging.error(f"Erreur lors de la requête à Kanidm: {e}")
return None
@property
def is_admin(self) -> bool: