Skip to content

Commit d047f6b

Browse files
committed
add department and company fields from keycloak to subjects
1 parent 21c11c3 commit d047f6b

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

src/kitconcept/contentsync/converters/keycloak.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ class KeycloakPersonConverter(ItemConverter):
1515
("last_name", "lastName"),
1616
("contact_email", "email"),
1717
("function", "job_title"),
18-
("company", "subjects")
18+
("company", "subjects"),
19+
("department", "")
1920
)
2021

2122
def _field__transition(self, src: t.KeycloakUser) -> str:
@@ -51,7 +52,16 @@ def _field_job_title(self, src: t.KeycloakUser) -> str:
5152
def _field_subjects(self, src: t.KeycloakUser) -> str:
5253
"""Extracts the job title from the user attributes."""
5354
attrs = src.get("attributes", {}) or {}
54-
subjects = attrs.get("company", [])
55+
subjects = []
56+
57+
abteilung = attrs.get("company", [None])[0]
58+
if abteilung:
59+
subjects.append(f"Abteilung - {abteilung}")
60+
61+
organisationseinheit = attrs.get("department", [None])[0]
62+
if organisationseinheit:
63+
subjects.append(f"Organisationseinheit - {organisationseinheit}")
64+
5565
return subjects
5666

5767

0 commit comments

Comments
 (0)