String shell = "";
if (elements.length > 6) {
shell = elements[6];
}
List<UNIXRole> userRolesList = new ArrayList<UNIXRole>();
UNIXRole primaryRole = getRoleByGID(gid);
if (primaryRole == null) {
LOG.warn("No primary group for user " + username);
} else {
userRolesList.add(primaryRole);
}
for (int i = 0; i < roles.length; i++) {
if (roles[i].containsMember(username)
&& !(primaryRole != null && roles[i].getPrincipalName().equals(
primaryRole.getPrincipalName()))) {
userRolesList.add(roles[i]);
}
}
UNIXRole[] userRoles = new UNIXRole[userRolesList.size()];
userRolesList.toArray(userRoles);