From 78e09f9803a284d030ef42f76d06cddc95b2062e Mon Sep 17 00:00:00 2001 From: Holash Chand Date: Mon, 8 Jul 2024 20:23:32 +0530 Subject: [PATCH] Fixed encrypted properties in the credential after update entity --- .../registry/service/impl/RegistryServiceImpl.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/java/registry/src/main/java/dev/sunbirdrc/registry/service/impl/RegistryServiceImpl.java b/java/registry/src/main/java/dev/sunbirdrc/registry/service/impl/RegistryServiceImpl.java index c2af9ef31..a97df83c5 100755 --- a/java/registry/src/main/java/dev/sunbirdrc/registry/service/impl/RegistryServiceImpl.java +++ b/java/registry/src/main/java/dev/sunbirdrc/registry/service/impl/RegistryServiceImpl.java @@ -309,9 +309,6 @@ private void generateCredentials(JsonNode rootNode, JsonNode inputNode, String v public void updateEntity(Shard shard, String userId, String id, String jsonString, boolean skipSignature) throws Exception { JsonNode inputNode = objectMapper.readTree(jsonString); String entityType = inputNode.fields().next().getKey(); - if (encryptionEnabled) { - inputNode = encryptionHelper.getEncryptedJson(inputNode); - } systemFieldsHelper.ensureUpdateAuditFields(entityType, inputNode.get(entityType), userId); DatabaseProvider databaseProvider = shard.getDatabaseProvider(); @@ -369,6 +366,10 @@ public void updateEntity(Shard shard, String userId, String id, String jsonStrin generateCredentials(mergedNode, inputNode, entityType); } + if (encryptionEnabled) { + inputNode = encryptionHelper.getEncryptedJson(inputNode); + } + if (entityType.equals(Schema)) { schemaService.validateUpdateSchema(readNode, mergedNode); }