diff --git a/office365-group.py b/office365-group.py index 8092a47..bcc2de9 100755 --- a/office365-group.py +++ b/office365-group.py @@ -124,7 +124,7 @@ def create_groups(ol, dn, new, old): udm_group["UniventionOffice365ObjectID"] = new_group["objectId"] else: new_azure_data = {ol.adconnection_alias: new_group} - old_azure_data_encoded = old.get('univentionOffice365Data', [''])[0] + old_azure_data_encoded = udm_user["UniventionOffice365Data"] if old_azure_data_encoded: # The account already has an Azure AD connection old_azure_data = Office365Listener.decode_o365data(old_azure_data_encoded) diff --git a/office365-user.py b/office365-user.py index aa721f8..cf197bf 100755 --- a/office365-user.py +++ b/office365-user.py @@ -264,7 +264,7 @@ def new_or_reactivate_user(ol, dn, new, old): 'userPrincipalName': new_user['userPrincipalName'], } } - old_azure_data_encoded = old.get('univentionOffice365Data', [''])[0] + old_azure_data_encoded = udm_user["UniventionOffice365Data"] if old_azure_data_encoded: # The account already has an Azure AD connection old_azure_data = Office365Listener.decode_o365data(old_azure_data_encoded) @@ -294,7 +294,7 @@ def delete_user(ol, dn, new, old): udm_user["UniventionOffice365Data"] = Office365Listener.encode_o365data(None) udm_user.modify() else: - old_azure_data_encoded = old.get('univentionOffice365Data', [''])[0] + old_azure_data_encoded = udm_user["UniventionOffice365Data"] if old_azure_data_encoded: old_azure_data = Office365Listener.decode_o365data(old_azure_data_encoded) try: @@ -317,7 +317,7 @@ def deactivate_user(ol, dn, new, old): udm_user["UniventionOffice365Data"] = Office365Listener.encode_o365data(None) udm_user.modify() else: - old_azure_data_encoded = old.get('univentionOffice365Data', [''])[0] + old_azure_data_encoded = udm_user["UniventionOffice365Data"] if old_azure_data_encoded: # The account already has an Azure AD connection old_azure_data = Office365Listener.decode_o365data(old_azure_data_encoded) @@ -344,7 +344,7 @@ def modify_user(ol, dn, new, old): 'userPrincipalName': azure_user['userPrincipalName'], } } - old_azure_data_encoded = old.get('univentionOffice365Data', [''])[0] + old_azure_data_encoded = udm_user["UniventionOffice365Data"] if old_azure_data_encoded: # The account already has an Azure AD connection old_azure_data = Office365Listener.decode_o365data(old_azure_data_encoded) diff --git a/office365_user_ADConnections_hook.py b/office365_user_ADConnections_hook.py index 796bdd6..3614fb0 100644 --- a/office365_user_ADConnections_hook.py +++ b/office365_user_ADConnections_hook.py @@ -82,6 +82,10 @@ class Office365ADConnectionsHook(simpleHook): value = (adconnection, upn) module["UniventionOffice365ADConnections"].append(value) + def hook_ldap_addlist(self, module, al=[]): + al = [a for a in al if a[0] != "dummyUniventionOffice365ADConnections"] + return al + def hook_ldap_modlist(self, module, ml=[]): # remove virtual dummy attribute from modlist ml = [m for m in ml if m[0] != "dummyUniventionOffice365ADConnections"]