Skip to content

Commit aa19a84

Browse files
committed
add function to sync company field to subjects
1 parent 6abe7fe commit aa19a84

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/kitconcept/contentsync/converters/keycloak.py

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

2021
def _field__transition(self, src: t.KeycloakUser) -> str:
@@ -47,6 +48,13 @@ def _field_job_title(self, src: t.KeycloakUser) -> str:
4748
return job_title
4849

4950

51+
def _field_subjects(self, src: t.KeycloakUser) -> str:
52+
"""Extracts the job title from the user attributes."""
53+
attrs = src.get("attributes", {}) or {}
54+
subjects = attrs.get("company", [])
55+
return subjects
56+
57+
5058

5159
def _blocks_factory_(self, src: t.KeycloakUser) -> VoltoBlocksInfo:
5260
"""Constructs the blocks for the user."""

0 commit comments

Comments
 (0)