From 923f6181c123c317ebb55a68d9fec6b53ff9fe95 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Thorsten=20Ro=C3=9Fner?= <thorsten.rossner.extern@zendis.de>
Date: Thu, 26 Sep 2024 17:47:28 +0200
Subject: [PATCH] fix: Add `--admin_enable_knowledgemanagement` option with
 backwards compatibility.

---
 lib/ucs.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/lib/ucs.py b/lib/ucs.py
index 41df36e..93cd862 100644
--- a/lib/ucs.py
+++ b/lib/ucs.py
@@ -178,7 +178,6 @@ class Ucs:
                 "opendeskLivecollaborationEnabled": (not person['is_admin'] and not self.__option2bool(self.options_object.component_disable_livecollaboration)),
                 "opendeskFileshareAdmin": self.__option2bool(self.options_object.admin_enable_fileshare),
                 "opendeskProjectmanagementAdmin": self.__option2bool(self.options_object.admin_enable_projectmanagement),
-                #"opendeskKnowledgemanagementAdmin": self.__option2bool(self.options_object.admin_enable_knowledgemanagement),
                 "mailPrimaryAddress": person['username']+"@"+self.maildomain if not 'mailPrimaryAddress' in person or not isinstance(person['mailPrimaryAddress'], str) else person['mailPrimaryAddress'],
                 "PasswordRecoveryEmail": person['email'],
                 "oxContext": int(person['oxContext'] if 'oxContext' in person and not pd.isna(person['oxContext']) else self.options_object.default_oxcontext),
@@ -194,6 +193,10 @@ class Ucs:
             "position": self.user_base
         }
 
+        # different handling as above as feature was introduced with openDesk 0.10.0
+        if self.__option2bool(self.options_object.admin_enable_knowledgemanagement):
+            user_json['properties']['opendeskKnowledgemanagementAdmin'] = True
+
         if (self.__option2bool(self.options_object.create_maildomains)):
             users_maildomain = user_json['properties']['mailPrimaryAddress'].split('@')[-1]
             if not users_maildomain in self.existing_maildomains:
-- 
GitLab