Fix issues in fix-172

3.x.x
milanperera 5 years ago
parent a044bbd385
commit 576ccd2363

@ -159,15 +159,21 @@ public class UserManagementServiceImpl implements UserManagementService {
List<String> tmpRoles = new ArrayList<>();
String[] userInfoRoles = userInfo.getRoles();
tmpRoles.add(DEFAULT_DEVICE_USER);
boolean subscriberFound = false;
if (userInfoRoles != null) {
//check if subscriber role is coming in the payload
boolean subscriberFound = false;
for (String r : userInfoRoles) {
if (DEFAULT_SUBSCRIBER.equals(r)) {
subscriberFound = true;
break;
}
}
tmpRoles.addAll(Arrays.asList(userInfoRoles));
}
if (!subscriberFound) {
// Add Internal/subscriber role to new users
if (userStoreManager.isExistingRole(DEFAULT_SUBSCRIBER)) {
@ -177,8 +183,7 @@ public class UserManagementServiceImpl implements UserManagementService {
DEFAULT_SUBSCRIBER + "' is missing in the system");
}
}
tmpRoles.addAll(Arrays.asList(userInfoRoles));
}
String[] roles = new String[tmpRoles.size()];
tmpRoles.toArray(roles);

Loading…
Cancel
Save