Unverified Commit e31e7ab3 authored by Radovan Semancik's avatar Radovan Semancik Committed by GitHub
Browse files

Merge pull request #18 from mwolf-rw/master

Handle multiple, unrelated structural object classes
parents 7abaad13 7acd78d5
......@@ -1058,15 +1058,27 @@ public abstract class AbstractSchemaTranslator<C extends AbstractLdapConfigurati
cob.setObjectClass(new ObjectClass(connIdStructuralObjectClassInfo.getType()));
List<ObjectClassInfo> connIdAuxiliaryObjectClassInfos = new ArrayList<>(ldapObjectClasses.getLdapAuxiliaryObjectClasses().size());
if (!ldapObjectClasses.getLdapAuxiliaryObjectClasses().isEmpty()) {
for (org.apache.directory.api.ldap.model.schema.ObjectClass ldapAuxiliaryObjectClass : ldapObjectClasses.getLdapAuxiliaryObjectClasses()) {
connIdAuxiliaryObjectClassInfos.add(connIdSchema.findObjectClassInfo(ldapAuxiliaryObjectClass.getName()));
}
for (org.apache.directory.api.ldap.model.schema.ObjectClass ldapStructuralObjectClass : ldapObjectClasses.getLdapStructuralObjectClasses()) {
ObjectClassInfo objectClassInfo = connIdSchema.findObjectClassInfo(ldapStructuralObjectClass.getName());
if ((!connIdStructuralObjectClassInfo.equals(objectClassInfo)) && (!hasSubclass(ldapStructuralObjectClass, ldapObjectClasses.getLdapStructuralObjectClasses()))) {
connIdAuxiliaryObjectClassInfos.add(objectClassInfo);
}
}
if (!connIdAuxiliaryObjectClassInfos.isEmpty()) {
AttributeBuilder auxAttrBuilder = new AttributeBuilder();
auxAttrBuilder.setName(PredefinedAttributes.AUXILIARY_OBJECT_CLASS_NAME);
for (org.apache.directory.api.ldap.model.schema.ObjectClass ldapAuxiliaryObjectClass: ldapObjectClasses.getLdapAuxiliaryObjectClasses()) {
auxAttrBuilder.addValue(ldapAuxiliaryObjectClass.getName());
ObjectClassInfo objectClassInfo = connIdSchema.findObjectClassInfo(ldapAuxiliaryObjectClass.getName());
// LOG.ok("ConnId object class info for auxiliary object class {0}:\n{1}", ldapAuxiliaryObjectClass.getName(), objectClassInfo);
connIdAuxiliaryObjectClassInfos.add(objectClassInfo);
for (ObjectClassInfo objectClassInfo : connIdAuxiliaryObjectClassInfos) {
auxAttrBuilder.addValue(objectClassInfo.getType());
}
cob.addAttribute(auxAttrBuilder.build());
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment