Unverified Commit 1d921ab1 authored by Hari-stackroute's avatar Hari-stackroute Committed by GitHub
Browse files

Assign v1 failing to add existing role when sent for update (#887)

Showing with 4 additions and 1 deletion
+4 -1
......@@ -10,6 +10,7 @@ import java.util.Map;
import java.util.Optional;
import java.util.stream.Collectors;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.SerializationUtils;
import org.apache.commons.lang3.StringUtils;
import org.sunbird.exception.ProjectCommonException;
import org.sunbird.exception.ResponseCode;
......@@ -47,8 +48,10 @@ public class UserRoleServiceImpl implements UserRoleService {
userRequest, dbUserRoleListToUpdate, dbUserRoleListToDelete, context);
// Update existing role scope, if same role is in request
if (CollectionUtils.isNotEmpty(dbUserRoleListToUpdate)) {
List<Map<String, Object>> newUserReqMap =
SerializationUtils.clone(new ArrayList<>(dbUserRoleListToUpdate));
userRoleListResponse.addAll(newUserReqMap);
userRoleDao.updateRoleScope(dbUserRoleListToUpdate, context);
userRoleListResponse.addAll(dbUserRoleListToUpdate);
}
// Delete existing roles of user, if the same is not in request
if (CollectionUtils.isNotEmpty(dbUserRoleListToDelete)) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment