From af105fd6f3de045f55081c0caab704a9854fa5af Mon Sep 17 00:00:00 2001 From: Valery Kharseko Date: Tue, 16 Jul 2024 15:39:46 +0300 Subject: [PATCH] [#148,#261,#282] FIX control-panel schema errors in remote mode (#359) --- .../guitools/controlpanel/datamodel/ServerDescriptor.java | 4 ++-- .../guitools/controlpanel/ui/CustomAttributePanel.java | 2 +- .../guitools/controlpanel/ui/CustomObjectClassPanel.java | 2 +- .../guitools/controlpanel/util/ConfigFromConnection.java | 2 +- .../guitools/controlpanel/util/RemoteSchemaLoader.java | 8 ++++---- .../main/java/org/opends/server/util/ServerConstants.java | 2 +- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/datamodel/ServerDescriptor.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/datamodel/ServerDescriptor.java index b7f8bd1061..154f8630d1 100644 --- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/datamodel/ServerDescriptor.java +++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/datamodel/ServerDescriptor.java @@ -537,8 +537,8 @@ else if (schema1 == null) return areAttributeTypesEqual(schema1, schema2) && areObjectClassesEqual(schema1, schema2) - && Objects.equals(schema1.getMatchingRules(), schema2.getMatchingRules()) - && Objects.equals(schema1.getSyntaxes(), schema2.getSyntaxes()); + && (schema1.getMatchingRules().size()==schema2.getMatchingRules().size() && schema1.getMatchingRules().containsAll(schema2.getMatchingRules())) + && (schema1.getSyntaxes().size()==schema2.getSyntaxes().size() && schema1.getSyntaxes().containsAll(schema2.getSyntaxes())); } private static boolean areAttributeTypesEqual(Schema schema1, Schema schema2) diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/CustomAttributePanel.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/CustomAttributePanel.java index 67780a055c..e16e6cc757 100644 --- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/CustomAttributePanel.java +++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/CustomAttributePanel.java @@ -1082,7 +1082,7 @@ private AttributeType getNewAttribute() .noUserModification(nonModifiable.isSelected()) .singleValue(singleValued.isSelected()) .extraProperties(getExtraProperties()) - .addToSchema() + .addToSchemaOverwrite() .toSchema() .getAttributeType(getOID()); } diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/CustomObjectClassPanel.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/CustomObjectClassPanel.java index ca1162c497..9f12d392f6 100644 --- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/CustomObjectClassPanel.java +++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/CustomObjectClassPanel.java @@ -973,7 +973,7 @@ private ObjectClass getNewObjectClass() .type(getObjectClassType()) .obsolete(obsolete.isSelected()) .extraProperties(getExtraProperties()) - .addToSchema() + .addToSchemaOverwrite() .toSchema() .getObjectClass(getOID()); } diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/util/ConfigFromConnection.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/util/ConfigFromConnection.java index 4a0b6b738e..7c49b13a66 100644 --- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/util/ConfigFromConnection.java +++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/util/ConfigFromConnection.java @@ -320,7 +320,7 @@ private void readSchemaIfNeeded(final ConnectionWrapper connWrapper, final List< } catch (OpenDsException oe) { - errors.add(oe); + //errors.add(oe); } } } diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/util/RemoteSchemaLoader.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/util/RemoteSchemaLoader.java index b353a5efb3..17bfc9dc9f 100644 --- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/util/RemoteSchemaLoader.java +++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/util/RemoteSchemaLoader.java @@ -81,17 +81,17 @@ public Schema readSchema(ConnectionWrapper connWrapper) throws LdapException, Di // Add missing matching rules and attribute syntaxes to base schema to allow read of remote server schema // (see OPENDJ-1122 for more details) - //SchemaHandler.addServerSyntaxesAndMatchingRules(schemaBuilder); + SchemaHandler.addServerSyntaxesAndMatchingRules(schemaBuilder); // Add remote schema entry final SearchRequest request = newSearchRequest( DN.valueOf(DN_DEFAULT_SCHEMA_ROOT), BASE_OBJECT, Filter.alwaysTrue(), ATTR_LDAP_SYNTAXES, ATTR_ATTRIBUTE_TYPES, ATTR_OBJECTCLASSES); final SearchResultEntry entry = connWrapper.getConnection().searchSingleEntry(request); - removeNonOpenDjOrOpenDsSyntaxes(entry); - new SchemaBuilder(getBaseSchema()).addSchema(entry, true); + //removeNonOpenDjOrOpenDsSyntaxes(entry); + schemaBuilder.addSchema(entry, true); - return buildSchema(schemaBuilder); + return schemaBuilder.toSchema(); } diff --git a/opendj-server-legacy/src/main/java/org/opends/server/util/ServerConstants.java b/opendj-server-legacy/src/main/java/org/opends/server/util/ServerConstants.java index 16fed10d97..42f8e43441 100644 --- a/opendj-server-legacy/src/main/java/org/opends/server/util/ServerConstants.java +++ b/opendj-server-legacy/src/main/java/org/opends/server/util/ServerConstants.java @@ -1981,7 +1981,7 @@ public final class ServerConstants /** * The value that will be used for the vendorName attribute in the root DSE. */ - public static final String SERVER_VENDOR_NAME = "ForgeRock AS."; + public static final String SERVER_VENDOR_NAME = "Open Identity Platform Community";