private String[] getUsersFromGroup(String groupName){
String[] userLogins = null;
Set retAttrs = new HashSet();
RoleManager roleManager = null;
Role role = null;
try {
roleManager = Platfomr.getService(RoleManager.class);
role = roleManager.getDetails(RoleManagerConstants.ROLE_NAME, groupName, retAttrs);
String roleKey = role.getEntityId();
List <User> listOfUsers = roleManager.getRoleMembers(roleKey, true);
int size = listOfUsers.size();
for (int i = 0; i < size; i++){
User user = listOfUsers.get(i);
String userLogin = user.getLogin();
userLogins = userLogin;
}
}catch(Exception e) {
e.printStackTrace();
}
return userLogins;
}
No comments:
Post a Comment