From 71426b07981e62e14b1e2a1b4362ba092fb9f4fa Mon Sep 17 00:00:00 2001 From: muralibasani Date: Mon, 13 Nov 2023 14:54:04 +0100 Subject: [PATCH] Fix owner Signed-off-by: muralibasani --- .../aiven/klaw/service/SchemaRegistryControllerService.java | 2 +- core/src/test/java/io/aiven/klaw/TopicAclControllerIT.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/core/src/main/java/io/aiven/klaw/service/SchemaRegistryControllerService.java b/core/src/main/java/io/aiven/klaw/service/SchemaRegistryControllerService.java index afe8d12d86..398741ae8a 100644 --- a/core/src/main/java/io/aiven/klaw/service/SchemaRegistryControllerService.java +++ b/core/src/main/java/io/aiven/klaw/service/SchemaRegistryControllerService.java @@ -453,6 +453,7 @@ public ApiResponse uploadSchema( getPrincipal(), PermissionType.REQUEST_CREATE_SCHEMAS)) { return ApiResponse.NOT_AUTHORIZED; } + schemaRequest.setRequestor(userName); int tenantId = commonUtilsService.getTenantId(getUserName()); Optional schemaEnv = getSchemaEnvFromKafkaEnvId(schemaRequest.getEnvironment()); @@ -542,7 +543,6 @@ public ApiResponse uploadSchema( } } - schemaRequest.setRequestor(userName); SchemaRequest schemaRequestDao = new SchemaRequest(); copyProperties(schemaRequest, schemaRequestDao); schemaRequestDao.setReq_no(schemaRequest.getRequestId()); diff --git a/core/src/test/java/io/aiven/klaw/TopicAclControllerIT.java b/core/src/test/java/io/aiven/klaw/TopicAclControllerIT.java index 07dd4997f7..58ec689661 100644 --- a/core/src/test/java/io/aiven/klaw/TopicAclControllerIT.java +++ b/core/src/test/java/io/aiven/klaw/TopicAclControllerIT.java @@ -1336,7 +1336,7 @@ public void editSchemaRequestFailureNotOwnerOfRequest() throws Exception { SchemaRequestModel schemaRequest = new SchemaRequestModel(); schemaRequest.setRequestId(schemaRequestId); schemaRequest.setTopicname(schemaRequestsResponseModel.getTopicname()); - schemaRequest.setRequestor(user3); + schemaRequest.setRequestor(user2); schemaRequest.setEnvironment(schemaRequestsResponseModel.getEnvironment()); schemaRequest.setForceRegister(schemaRequestsResponseModel.getForceRegister()); schemaRequest.setSchemafull(schemaRequestsResponseModel.getSchemafull()); @@ -1350,7 +1350,7 @@ public void editSchemaRequestFailureNotOwnerOfRequest() throws Exception { .thenReturn(responseResponseEntity); mvc.perform( MockMvcRequestBuilders.post("/uploadSchema") - .with(user(user1).password(PASSWORD).roles("USER")) + .with(user(user2).password(PASSWORD).roles("USER")) .content(jsonReq) .contentType(MediaType.APPLICATION_JSON) .accept(MediaType.APPLICATION_JSON))