You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@fineract.apache.org by GitBox <gi...@apache.org> on 2019/11/27 10:10:55 UTC

[GitHub] [fineract] jamesidw commented on a change in pull request #660: FINERACT-803: validate username uniqueness

jamesidw commented on a change in pull request #660: FINERACT-803: validate username uniqueness
URL: https://github.com/apache/fineract/pull/660#discussion_r351199044
 
 

 ##########
 File path: fineract-provider/src/main/java/org/apache/fineract/useradministration/service/UserDataValidator.java
 ##########
 @@ -173,6 +185,11 @@ public void validateForUpdate(final String json) {
         if (this.fromApiJsonHelper.parameterExists("username", element)) {
             final String username = this.fromApiJsonHelper.extractStringNamed("username", element);
             baseDataValidator.reset().parameter("username").value(username).notBlank().notExceedingLengthOf(100);
+            // this will be cumbersome if the username remains the same. Since the parameter seems to be optional, the client can work around it...[I hope]
+            AppUser exists = appUserRepository.findAppUserByName(username);
+            if (exists != null) {
 
 Review comment:
   @awasum I'd changed the approach so we ignore the repeated username if it is the same as the current one but still flag the validation failure if the request would genuinely violate the unique constraint.
   
   Let me just drop the validation in the update function as you've suggested.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services