/** * Sets the LDAP values such as posix account properties of the given ldapGroup configured in the given xml string. * * @param ldapGroup * @param ldapValuesAsXml Posix account values as xml. */ public void setLdapValues(final LdapGroup ldapGroup, final String ldapValuesAsXml) { if (StringUtils.isBlank(ldapValuesAsXml) == true) { return; } final LdapConfig ldapConfig = ldapService.getLdapConfig(); final LdapPosixAccountsConfig posixAccountsConfig = ldapConfig != null ? ldapConfig.getPosixAccountsConfig() : null; if (posixAccountsConfig == null) { // No posix account default values configured return; } final LdapGroupValues values = readLdapGroupValues(ldapValuesAsXml); if (values == null) { return; } if (values.getGidNumber() != null) { ldapGroup.setGidNumber(values.getGidNumber()); } else { ldapGroup.setGidNumber(-1); } }
/** * @see org.projectforge.business.ldap.LdapDao#mapToObject(java.lang.String, javax.naming.directory.Attributes) */ @Override protected LdapGroup mapToObject(final String dn, final Attributes attributes) throws NamingException { final LdapGroup group = new LdapGroup(); group.setBusinessCategory(LdapUtils.getAttributeStringValue(attributes, "businessCategory")); group.setDescription(LdapUtils.getAttributeStringValue(attributes, "description")); group.setOrganization(LdapUtils.getAttributeStringValue(attributes, "o")); final String[] members = LdapUtils.getAttributeStringValues(attributes, "uniqueMember"); if (members != null) { for (final String member : members) { group.addMember(member, ldapConfig.getBaseDN()); } } final boolean posixAccountsConfigured = ldapUserDao.isPosixAccountsConfigured(); if (posixAccountsConfigured == true) { final String no = LdapUtils.getAttributeStringValue(attributes, "gidNumber"); group.setGidNumber(NumberHelper.parseInteger(no)); } return group; }