feat(kanidm): Log some errors
This commit is contained in:
parent
fb70bf13f8
commit
f4428ace59
1 changed files with 5 additions and 0 deletions
|
@ -1,3 +1,4 @@
|
||||||
|
import logging
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
from functools import cached_property
|
from functools import cached_property
|
||||||
from typing import Optional, Self
|
from typing import Optional, Self
|
||||||
|
@ -12,6 +13,7 @@ from django.http import HttpRequest
|
||||||
from django.utils.translation import gettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
from kanidm.exceptions import NoMatchingEntries
|
from kanidm.exceptions import NoMatchingEntries
|
||||||
from kanidm.models.person import Person
|
from kanidm.models.person import Person
|
||||||
|
from kanidm.radius import ClientConnectorError
|
||||||
|
|
||||||
from shared.kanidm import klient
|
from shared.kanidm import klient
|
||||||
|
|
||||||
|
@ -174,6 +176,9 @@ class User(AbstractUser):
|
||||||
)
|
)
|
||||||
except NoMatchingEntries:
|
except NoMatchingEntries:
|
||||||
return None
|
return None
|
||||||
|
except (TimeoutError, ClientConnectorError) as e:
|
||||||
|
logging.error(f"Erreur lors de la requête à Kanidm: {e}")
|
||||||
|
return None
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def is_admin(self) -> bool:
|
def is_admin(self) -> bool:
|
||||||
|
|
Loading…
Reference in a new issue