use of org.wso2.ei.dashboard.core.rest.model.UsersInner in project product-mi-tooling by wso2.
the class UsersDelegate method getUsers.
private Users getUsers(String groupId) throws ManagementApiException {
Users users = new Users();
NodeList nodeList = databaseManager.fetchNodes(groupId);
// assumption - In a group, users of all nodes in the group should be identical
String nodeId = nodeList.get(0).getNodeId();
String mgtApiUrl = ManagementApiUtils.getMgtApiUrl(groupId, nodeId);
String accessToken = databaseManager.getAccessToken(groupId, nodeId);
String url = mgtApiUrl.concat("users/");
CloseableHttpResponse httpResponse = Utils.doGet(groupId, nodeId, accessToken, url);
JsonArray userList = HttpUtils.getJsonResponse(httpResponse).get("list").getAsJsonArray();
for (JsonElement user : userList) {
UsersInner usersInner = getUserDetails(groupId, nodeId, accessToken, url, user);
users.add(usersInner);
}
return users;
}
use of org.wso2.ei.dashboard.core.rest.model.UsersInner in project product-mi-tooling by wso2.
the class UsersDelegate method getUserDetails.
private UsersInner getUserDetails(String groupId, String nodeId, String accessToken, String url, JsonElement user) throws ManagementApiException {
String userId = user.getAsJsonObject().get("userId").getAsString();
UsersInner usersInner = new UsersInner();
usersInner.setUserId(userId);
String getUsersDetailsUrl;
if (userId.contains(DOMAIN_SEPARATOR)) {
String[] parts = userId.split(DOMAIN_SEPARATOR);
// parts[0] = domain, parts[1] = new userId
getUsersDetailsUrl = url.concat(parts[1]).concat("?domain=").concat(parts[0]);
} else {
getUsersDetailsUrl = url.concat(userId);
}
CloseableHttpResponse userDetailResponse = Utils.doGet(groupId, nodeId, accessToken, getUsersDetailsUrl);
String userDetail = HttpUtils.getStringResponse(userDetailResponse);
usersInner.setDetails(userDetail);
return usersInner;
}
Aggregations