/** * Create LDAP attributes that represents group in LDAP context. * * @param group Group * @return LDAP attributes */ public final Attributes groupToAttributes(Group group) { BasicAttributes attrs = new BasicAttributes(); if (GROUP_LDAP_CLASSES == null) GROUP_LDAP_CLASSES = groupLDAPClasses.split(","); attrs.put(new ObjectClassAttribute(GROUP_LDAP_CLASSES)); attrs.put(groupNameAttr, group.getGroupName()); String desc = group.getDescription(); if (desc != null && desc.length() > 0) attrs.put(ldapDescriptionAttr, desc); String lbl = group.getLabel(); if (lbl != null && lbl.length() > 0) attrs.put(groupLabelAttr, lbl); return attrs; }
static public String getGroupDescription(String groupId) throws Exception { WebuiRequestContext context = WebuiRequestContext.getCurrentInstance(); ExoContainer container = context.getApplication().getApplicationServiceContainer(); OrganizationService orgService = (OrganizationService)container.getComponentInstanceOfType(OrganizationService.class); String description = ""; Group group = orgService.getGroupHandler().findGroupById(groupId); if (group != null) { description = group.getDescription(); } return description; }
private List<OrganizationConfig.Group> getAllGroups() throws Exception { List<OrganizationConfig.Group> allGroups = new ArrayList<OrganizationConfig.Group>(); try { @SuppressWarnings("unchecked") Collection<Group> groups = organizationService.getGroupHandler().getAllGroups(); for (Group group : groups) { OrganizationConfig.Group orgConfGroup = new OrganizationConfig.Group(); orgConfGroup.setDescription(group.getDescription()); orgConfGroup.setLabel(group.getLabel()); orgConfGroup.setName(group.getGroupName()); orgConfGroup.setParentId(group.getParentId()); allGroups.add(orgConfGroup); } } catch (Exception e) { LOG.error("Error when recovering of all groups ... ", e); return null; } return allGroups; }
String description = exoGroup.getDescription(); String label = exoGroup.getLabel();
ModificationItem mod = new ModificationItem(DirContext.REPLACE_ATTRIBUTE, new BasicAttribute( ldapAttrMapping.ldapDescriptionAttr, group.getDescription())); modifications.add(mod);