/** * Transform hibernate group to group name. * * @param hibernateGroup the hibernate group * @return the group name */ public static GroupName transformHibernateGroupToGroupName(HibernateGroup hibernateGroup) { if (hibernateGroup == null) { return null; } return new GroupName(hibernateGroup.getDomain(), hibernateGroup.getName()); }
NamingEnumeration<?> enumer = attr.getAll(); while (enumer.hasMore()) { groups.add(new GroupName( JoomlaLDAPConstants.DEFAULT_DOMAIN, (String) enumer.next()));
/** * Converts group DTO to userDb model. * @param source * @return {@link Group} */ protected static Group convertGroup(GroupDTO source) { Group result = new Group(); if (source.getName()!=null && source.getName().trim().length()>0) { String domain = (source.getDomain()!=null && source.getDomain().trim().length()>0)? source.getDomain():null; result.setGroupName(new GroupName(domain, source.getName())); } if (source.getRolesCSV()!=null && source.getRolesCSV().trim().length()>0) { result.setRoles(convertCSVToSet(source.getRolesCSV())); } return result; }
/** * Returns effective groups of given group (not including given group * itself). * * @param groupName the group name * @return the effective groups */ public Set<HibernateGroup> getEffectiveGroups(GroupName groupName) { Set<HibernateGroup> emptySet = Collections.emptySet(); try { HibernateGroup group = load(groupName); if (group.getParentGroup() != null) { GroupName parentGroupName = new GroupName(group.getParentGroup().getDomain(), group.getParentGroup() .getName()); HibernateGroup parentGroup = load(parentGroupName); Set<HibernateGroup> set = new HashSet<HibernateGroup>(); set.add(parentGroup); set.addAll(getEffectiveGroups(parentGroupName)); return set; } else { return emptySet; } } catch (Exception e) { return emptySet; } }
Set<GroupName> groups = new HashSet<GroupName>(); for (Element groupElement : groupsList) { GroupName groupName = new GroupName(domain, groupElement.getValue()); groups.add(groupName);
String domain = root.getChildText("domain", ns); String name = root.getChildText("name", ns); GroupName groupName = new GroupName(domain, name); group.setGroupName(groupName);
Iterator<String> it = groupsStr.iterator(); while(it.hasNext()) { groups.add(new GroupName( result.getUser().getDomain(), it.next()));