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

 ##########
 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:
   This assumes the username will always be updated and will be different from 
the current one. In real life, the username usually stays the same when 
updating a user. Do the validation just for creation first and lets see if this 
resolves: https://issues.apache.org/jira/browse/FINERACT-803 as the issue 
occurs during creation.

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to