diff --git a/avni-server-api/src/main/java/org/avni/messaging/contract/UserContract.java b/avni-server-api/src/main/java/org/avni/messaging/contract/UserContract.java index 2954ba76d..9029dfa11 100644 --- a/avni-server-api/src/main/java/org/avni/messaging/contract/UserContract.java +++ b/avni-server-api/src/main/java/org/avni/messaging/contract/UserContract.java @@ -23,7 +23,7 @@ public String getUsername() { } public void setUsername(String username) { - this.username = username; + this.username = username != null ? username.trim() : null; } public String getName() { @@ -31,7 +31,7 @@ public String getName() { } public void setName(String name) { - this.name = name; + this.name = name != null ? name.trim() : null; } public Long getId() { @@ -49,4 +49,5 @@ public String getUuid() { public void setUuid(String uuid) { this.uuid = uuid; } + } diff --git a/avni-server-api/src/main/java/org/avni/server/service/BulkUploadS3Service.java b/avni-server-api/src/main/java/org/avni/server/service/BulkUploadS3Service.java index fb3e5b37c..751883466 100644 --- a/avni-server-api/src/main/java/org/avni/server/service/BulkUploadS3Service.java +++ b/avni-server-api/src/main/java/org/avni/server/service/BulkUploadS3Service.java @@ -47,4 +47,4 @@ public InputStream downloadErrorFile(String jobUuid) { S3File s3File = S3File.organisationFile(UserContextHolder.getOrganisation(), format("%s.csv", jobUuid), S3FileType.BulkUploadsError); return s3Service.getFileStream(s3File); } -} +} \ No newline at end of file diff --git a/avni-server-api/src/main/java/org/avni/server/service/CognitoIdpService.java b/avni-server-api/src/main/java/org/avni/server/service/CognitoIdpService.java index 39d12e934..9f4349a4d 100644 --- a/avni-server-api/src/main/java/org/avni/server/service/CognitoIdpService.java +++ b/avni-server-api/src/main/java/org/avni/server/service/CognitoIdpService.java @@ -202,4 +202,4 @@ private UserCreateStatus createCognitoUser(AdminCreateUserRequest createUserRequ } return userCreateStatus; } -} +} \ No newline at end of file diff --git a/avni-server-api/src/main/java/org/avni/server/service/IdpServiceFactory.java b/avni-server-api/src/main/java/org/avni/server/service/IdpServiceFactory.java index 04558fbd3..dd986ac1b 100644 --- a/avni-server-api/src/main/java/org/avni/server/service/IdpServiceFactory.java +++ b/avni-server-api/src/main/java/org/avni/server/service/IdpServiceFactory.java @@ -121,4 +121,4 @@ public User getUserFromToken(String token) throws SigningKeyNotFoundException { return null; } } -} +} \ No newline at end of file diff --git a/avni-server-api/src/main/java/org/avni/server/web/ImportController.java b/avni-server-api/src/main/java/org/avni/server/web/ImportController.java index 0222b4d92..67755d1f8 100644 --- a/avni-server-api/src/main/java/org/avni/server/web/ImportController.java +++ b/avni-server-api/src/main/java/org/avni/server/web/ImportController.java @@ -93,7 +93,7 @@ public ResponseEntity doit(@RequestParam MultipartFile file, @RequestParam String type, @RequestParam boolean autoApprove, @RequestParam String locationUploadMode) throws IOException { - + accessControlService.checkPrivilege(PrivilegeType.UploadMetadataAndData); validateFile(file, type.equals("metadataZip") ? ZipFiles : Collections.singletonList("text/csv")); diff --git a/avni-server-api/src/main/java/org/avni/server/web/request/UserContract.java b/avni-server-api/src/main/java/org/avni/server/web/request/UserContract.java index 1c76878c0..efe2df562 100644 --- a/avni-server-api/src/main/java/org/avni/server/web/request/UserContract.java +++ b/avni-server-api/src/main/java/org/avni/server/web/request/UserContract.java @@ -74,7 +74,7 @@ public String getUsername() { } public void setUsername(String username) { - this.username = username; + this.username = username != null ? username.trim() : null; } public Long getCatchmentId() { @@ -196,4 +196,5 @@ public List getUserGroupNames() { public void setUserGroupNames(List userGroupNames) { this.userGroupNames = userGroupNames; } + } diff --git a/avni-server-api/src/main/java/org/avni/server/web/request/rules/RulesContractWrapper/UserContract.java b/avni-server-api/src/main/java/org/avni/server/web/request/rules/RulesContractWrapper/UserContract.java index fdc9d010b..dfbc7d4d3 100644 --- a/avni-server-api/src/main/java/org/avni/server/web/request/rules/RulesContractWrapper/UserContract.java +++ b/avni-server-api/src/main/java/org/avni/server/web/request/rules/RulesContractWrapper/UserContract.java @@ -45,7 +45,7 @@ public String getUsername() { } public void setUsername(String username) { - this.username = username; + this.username = username != null ? username.trim() : null; } public String getOrganisationName() { @@ -69,7 +69,7 @@ public String getName() { } public void setName(String name) { - this.name = name; + this.name = name != null ? name.trim() : null; } public JsonObject getSyncSettings() { @@ -95,4 +95,5 @@ public List getUserGroupNames() { public void setUserGroupNames(List userGroupNames) { this.userGroupNames = userGroupNames; } + }