diff --git a/authentik/enterprise/providers/google_workspace/clients/groups.py b/authentik/enterprise/providers/google_workspace/clients/groups.py index 158fe0724710..7cb841dcc879 100644 --- a/authentik/enterprise/providers/google_workspace/clients/groups.py +++ b/authentik/enterprise/providers/google_workspace/clients/groups.py @@ -92,12 +92,14 @@ def update(self, group: Group, connection: GoogleWorkspaceProviderGroup): google_group = self.to_schema(group, connection) self.check_email_valid(google_group["email"]) try: - return self._request( + response = self._request( self.directory_service.groups().update( groupKey=connection.google_id, body=google_group, ) ) + connection.attributes = response + connection.save() except NotFoundSyncException: # Resource missing is handled by self.write, which will re-create the group raise diff --git a/authentik/enterprise/providers/google_workspace/clients/users.py b/authentik/enterprise/providers/google_workspace/clients/users.py index 859efa25e892..b8316f476bbc 100644 --- a/authentik/enterprise/providers/google_workspace/clients/users.py +++ b/authentik/enterprise/providers/google_workspace/clients/users.py @@ -88,9 +88,11 @@ def update(self, user: User, connection: GoogleWorkspaceProviderUser): self.check_email_valid( google_user["primaryEmail"], *[x["address"] for x in google_user.get("emails", [])] ) - self._request( + response = self._request( self.directory_service.users().update(userKey=connection.google_id, body=google_user) ) + connection.attributes = response + connection.save() def discover(self): """Iterate through all users and connect them with authentik users if possible""" diff --git a/authentik/enterprise/providers/microsoft_entra/clients/groups.py b/authentik/enterprise/providers/microsoft_entra/clients/groups.py index 54545594c3dc..6edadfb08568 100644 --- a/authentik/enterprise/providers/microsoft_entra/clients/groups.py +++ b/authentik/enterprise/providers/microsoft_entra/clients/groups.py @@ -104,9 +104,11 @@ def update(self, group: Group, connection: MicrosoftEntraProviderGroup): microsoft_group = self.to_schema(group, connection) microsoft_group.id = connection.microsoft_id try: - return self._request( + response = self._request( self.client.groups.by_group_id(connection.microsoft_id).patch(microsoft_group) ) + connection.attributes = self.entity_as_dict(response) + connection.save() except NotFoundSyncException: # Resource missing is handled by self.write, which will re-create the group raise diff --git a/authentik/enterprise/providers/microsoft_entra/clients/users.py b/authentik/enterprise/providers/microsoft_entra/clients/users.py index 56e4ac10d0fc..a5ffea4f83bb 100644 --- a/authentik/enterprise/providers/microsoft_entra/clients/users.py +++ b/authentik/enterprise/providers/microsoft_entra/clients/users.py @@ -110,7 +110,11 @@ def update(self, user: User, connection: MicrosoftEntraProviderUser): """Update existing user""" microsoft_user = self.to_schema(user, connection) self.check_email_valid(microsoft_user.user_principal_name) - self._request(self.client.users.by_user_id(connection.microsoft_id).patch(microsoft_user)) + response = self._request( + self.client.users.by_user_id(connection.microsoft_id).patch(microsoft_user) + ) + connection.attributes = self.entity_as_dict(response) + connection.save() def discover(self): """Iterate through all users and connect them with authentik users if possible"""