diff --git a/search-service/src/main/kotlin/com/egm/stellio/search/authorization/SubjectReferentialService.kt b/search-service/src/main/kotlin/com/egm/stellio/search/authorization/SubjectReferentialService.kt index 9541c6d61..8f53e719a 100644 --- a/search-service/src/main/kotlin/com/egm/stellio/search/authorization/SubjectReferentialService.kt +++ b/search-service/src/main/kotlin/com/egm/stellio/search/authorization/SubjectReferentialService.kt @@ -285,7 +285,7 @@ class SubjectReferentialService( """ DELETE FROM subject_referential WHERE subject_id = :subject_id - OR jsonb_path_match(subject_info, 'exists($.value.id ? (@ == ${'$'}value))', '{ "value": "$sub" }') + OR jsonb_path_match(subject_info, 'exists($.value.internalClientId ? (@ == ${'$'}value))', '{ "value": "$sub" }') """.trimIndent() ) .bind("subject_id", sub) diff --git a/search-service/src/test/kotlin/com/egm/stellio/search/authorization/SubjectInfoUtils.kt b/search-service/src/test/kotlin/com/egm/stellio/search/authorization/SubjectInfoUtils.kt index 4e071e48f..4495e3f7e 100644 --- a/search-service/src/test/kotlin/com/egm/stellio/search/authorization/SubjectInfoUtils.kt +++ b/search-service/src/test/kotlin/com/egm/stellio/search/authorization/SubjectInfoUtils.kt @@ -19,6 +19,6 @@ internal fun getSubjectInfoForGroup(name: String): Json = internal fun getSubjectInfoForClient(clientId: String, kcId: String): Json = Json.of( """ - { "type": "Property", "value": { "clientId": "$clientId", "id": "$kcId" } } + { "type": "Property", "value": { "clientId": "$clientId", "internalClientId": "$kcId" } } """.trimIndent() )