diff options
| author | 2024-07-26 15:08:33 +0100 | |
|---|---|---|
| committer | 2024-07-26 18:08:09 +0100 | |
| commit | 1d1ddd295134942321bb72a3308703a6197e642a (patch) | |
| tree | 8122821651666fd4d3b83d302da94ba59eb10003 /arthur/apis/directory/ldap.py | |
| parent | Update Grafana to sync with both GitHub and LDAP (diff) | |
Cache the creation of clients for directory APIs
Diffstat (limited to 'arthur/apis/directory/ldap.py')
| -rw-r--r-- | arthur/apis/directory/ldap.py | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/arthur/apis/directory/ldap.py b/arthur/apis/directory/ldap.py index efb7fb7..a4941af 100644 --- a/arthur/apis/directory/ldap.py +++ b/arthur/apis/directory/ldap.py @@ -1,6 +1,7 @@ """API utilities for fetching data from the LDAP directory.""" from dataclasses import dataclass +from functools import cache from bonsai import LDAPClient, LDAPDN, LDAPSearchScope @@ -30,6 +31,7 @@ def get_cn(dn: str) -> str: return parsed.rdns[0][0][1] +@cache def create_client() -> LDAPClient: """Create an LDAP client with the configured settings.""" client = LDAPClient(str(CONFIG.ldap_host), tls=True) |