Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/kitconcept/contentsync/converters/keycloak.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,14 @@ def _field_contact_phone(self, src: t.KeycloakUser) -> str:
mobile = attrs.get("mobile", [""])[0]
return phone or mobile

def _field_academic_title(self, src: t.KeycloakUser) -> dict:
"""Extracts the academic title from the user attributes."""
attrs = src.get("attributes", {}) or {}
fullname = attrs.get("fullname", [""])[0]
titles = ["Prof. Dr.", "Dr.", "Prof."]
academic_title = next((t for t in titles if t in fullname), "")
return {"title": academic_title, "token": academic_title}

def _blocks_factory_(self, src: t.KeycloakUser) -> VoltoBlocksInfo:
"""Constructs the blocks for the user."""
attrs = src.get("attributes", {}) or {}
Expand Down
Loading