Skip to content

Commit

Permalink
Fix for add roles issue
Browse files Browse the repository at this point in the history
  • Loading branch information
karthik-tarento committed Jul 28, 2022
1 parent f845106 commit 4382d3c
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions src/main/java/org/sunbird/profile/service/ProfileServiceImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -450,16 +450,10 @@ private void getModifiedPersonalDetails(Object personalDetailsObj, Map<String, O
Map<String, Object> personalDetailsMap = (Map<String, Object>) personalDetailsObj;
if (!ObjectUtils.isEmpty(personalDetailsMap)) {
for (String paramName : personalDetailsMap.keySet()) {
String value = (String) personalDetailsMap.get(paramName);
if (StringUtils.isNotEmpty(value)) {
switch (paramName) {
case Constants.FIRST_NAME_LOWER_CASE:
updatedRequest.put(Constants.FIRSTNAME, value);
break;
case Constants.SURNAME:
updatedRequest.put(Constants.LASTNAME, value);
break;
}
if(Constants.FIRST_NAME_LOWER_CASE.equalsIgnoreCase(paramName)) {
updatedRequest.put(Constants.FIRSTNAME, (String) personalDetailsMap.get(paramName));
} else if (Constants.SURNAME.equalsIgnoreCase(paramName)) {
updatedRequest.put(Constants.FIRSTNAME, (String) personalDetailsMap.get(paramName));
}
}
}
Expand Down Expand Up @@ -712,6 +706,9 @@ private String assignUserRole(Map<String, Object> requestBody, List<String> exis
Map<String, Object> assignRoleReqBody = new HashMap<String, Object>();
assignRoleReqBody.put(Constants.ORGANIZATION_ID, requestBody.get(Constants.SB_ORG_ID));
assignRoleReqBody.put(Constants.USER_ID, requestBody.get(Constants.USER_ID));
if(existingRoles == null) {
existingRoles = new ArrayList<String>();
}
if (existingRoles.size() == 0) {
existingRoles.add(Constants.PUBLIC);
}
Expand Down

0 comments on commit 4382d3c

Please sign in to comment.