From 5987976054708439559cc213daeedf3e6e5c85b4 Mon Sep 17 00:00:00 2001 From: Kamil Czaja Date: Mon, 9 Dec 2024 16:00:06 +0100 Subject: [PATCH] fix: user deletion --- .../db/migration/V12__Fix_Service_Provider_User_Deletion.sql | 1 + .../web/pages/usermanagement/UserDeletionApiService.kt | 5 +++-- .../sovity/authorityportal/web/services/ConnectorService.kt | 1 + 3 files changed, 5 insertions(+), 2 deletions(-) create mode 100644 authority-portal-backend/authority-portal-db/src/main/resources/db/migration/V12__Fix_Service_Provider_User_Deletion.sql diff --git a/authority-portal-backend/authority-portal-db/src/main/resources/db/migration/V12__Fix_Service_Provider_User_Deletion.sql b/authority-portal-backend/authority-portal-db/src/main/resources/db/migration/V12__Fix_Service_Provider_User_Deletion.sql new file mode 100644 index 000000000..6d690a123 --- /dev/null +++ b/authority-portal-backend/authority-portal-db/src/main/resources/db/migration/V12__Fix_Service_Provider_User_Deletion.sql @@ -0,0 +1 @@ +alter table connector alter column created_by drop not null; diff --git a/authority-portal-backend/authority-portal-quarkus/src/main/kotlin/de/sovity/authorityportal/web/pages/usermanagement/UserDeletionApiService.kt b/authority-portal-backend/authority-portal-quarkus/src/main/kotlin/de/sovity/authorityportal/web/pages/usermanagement/UserDeletionApiService.kt index 016e36f21..31f60feef 100644 --- a/authority-portal-backend/authority-portal-quarkus/src/main/kotlin/de/sovity/authorityportal/web/pages/usermanagement/UserDeletionApiService.kt +++ b/authority-portal-backend/authority-portal-quarkus/src/main/kotlin/de/sovity/authorityportal/web/pages/usermanagement/UserDeletionApiService.kt @@ -102,11 +102,12 @@ class UserDeletionApiService( userService.deleteInvitationReferencesToOrgMembers(orgMemberIds) userService.deleteOrganizationIds(orgMemberIds) - keycloakService.deleteOrganization(organizationId) organizationService.deleteOrganization(organizationId) - keycloakService.deleteUsers(orgMemberIds) userService.deleteUsers(orgMemberIds) + keycloakService.deleteUsers(orgMemberIds) + keycloakService.deleteOrganization(organizationId) + Log.info( "Organization and related users, connectors and central components deleted. " + "organization=${organizationId}, adminUserId=$adminUserId." diff --git a/authority-portal-backend/authority-portal-quarkus/src/main/kotlin/de/sovity/authorityportal/web/services/ConnectorService.kt b/authority-portal-backend/authority-portal-quarkus/src/main/kotlin/de/sovity/authorityportal/web/services/ConnectorService.kt index 81379d607..5cf9e7653 100644 --- a/authority-portal-backend/authority-portal-quarkus/src/main/kotlin/de/sovity/authorityportal/web/services/ConnectorService.kt +++ b/authority-portal-backend/authority-portal-quarkus/src/main/kotlin/de/sovity/authorityportal/web/services/ConnectorService.kt @@ -106,6 +106,7 @@ class ConnectorService( val c = Tables.CONNECTOR dsl.update(c) .setNull(c.PROVIDER_ORGANIZATION_ID) + .setNull(c.CREATED_BY) .where(c.PROVIDER_ORGANIZATION_ID.eq(organizationId)) .execute() }