mirror of
https://repository.entgra.net/community/device-mgt-core.git
synced 2025-10-06 02:01:45 +00:00
Fix issues in fix-172
This commit is contained in:
parent
a044bbd385
commit
576ccd2363
@ -159,26 +159,31 @@ public class UserManagementServiceImpl implements UserManagementService {
|
|||||||
List<String> tmpRoles = new ArrayList<>();
|
List<String> tmpRoles = new ArrayList<>();
|
||||||
String[] userInfoRoles = userInfo.getRoles();
|
String[] userInfoRoles = userInfo.getRoles();
|
||||||
tmpRoles.add(DEFAULT_DEVICE_USER);
|
tmpRoles.add(DEFAULT_DEVICE_USER);
|
||||||
|
|
||||||
|
boolean subscriberFound = false;
|
||||||
|
|
||||||
if (userInfoRoles != null) {
|
if (userInfoRoles != null) {
|
||||||
|
|
||||||
//check if subscriber role is coming in the payload
|
//check if subscriber role is coming in the payload
|
||||||
boolean subscriberFound = false;
|
|
||||||
for (String r : userInfoRoles) {
|
for (String r : userInfoRoles) {
|
||||||
if (DEFAULT_SUBSCRIBER.equals(r)) {
|
if (DEFAULT_SUBSCRIBER.equals(r)) {
|
||||||
subscriberFound = true;
|
subscriberFound = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!subscriberFound) {
|
|
||||||
// Add Internal/subscriber role to new users
|
|
||||||
if (userStoreManager.isExistingRole(DEFAULT_SUBSCRIBER)) {
|
|
||||||
tmpRoles.add(DEFAULT_SUBSCRIBER);
|
|
||||||
} else {
|
|
||||||
log.warn("User: " + userInfo.getUsername() + " will not be able to enroll devices as '" +
|
|
||||||
DEFAULT_SUBSCRIBER + "' is missing in the system");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
tmpRoles.addAll(Arrays.asList(userInfoRoles));
|
tmpRoles.addAll(Arrays.asList(userInfoRoles));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!subscriberFound) {
|
||||||
|
// Add Internal/subscriber role to new users
|
||||||
|
if (userStoreManager.isExistingRole(DEFAULT_SUBSCRIBER)) {
|
||||||
|
tmpRoles.add(DEFAULT_SUBSCRIBER);
|
||||||
|
} else {
|
||||||
|
log.warn("User: " + userInfo.getUsername() + " will not be able to enroll devices as '" +
|
||||||
|
DEFAULT_SUBSCRIBER + "' is missing in the system");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
String[] roles = new String[tmpRoles.size()];
|
String[] roles = new String[tmpRoles.size()];
|
||||||
tmpRoles.toArray(roles);
|
tmpRoles.toArray(roles);
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user