diff --git a/operator/src/main/java/org/keycloak/operator/crds/v2alpha1/realmimport/KeycloakRealmImport.java b/operator/src/main/java/org/keycloak/operator/crds/v2alpha1/realmimport/KeycloakRealmImport.java index 9aa04fca8d..a4a2c58fdc 100644 --- a/operator/src/main/java/org/keycloak/operator/crds/v2alpha1/realmimport/KeycloakRealmImport.java +++ b/operator/src/main/java/org/keycloak/operator/crds/v2alpha1/realmimport/KeycloakRealmImport.java @@ -44,8 +44,8 @@ import com.fasterxml.jackson.annotation.JsonIgnore; @BuildableReference(io.fabric8.kubernetes.client.CustomResource.class), @BuildableReference(KeycloakRealmImportSpec.class) }) -@SchemaSwap(originalType = GroupRepresentation.class, fieldName = "subGroups", targetType = org.keycloak.representations.overrides.NoSubGroupsGroupRepresentationList.class) -@SchemaSwap(originalType = ComponentExportRepresentation.class, fieldName = "subComponents", targetType = org.keycloak.representations.overrides.NoSubcomponentsComponentExportRepresentationMap.class) +@SchemaSwap(originalType = GroupRepresentation.class, fieldName = "subGroups", depth = 10) +@SchemaSwap(originalType = ComponentExportRepresentation.class, fieldName = "subComponents", depth = 10) @SchemaSwap(originalType = ScopeRepresentation.class, fieldName = "policies") @SchemaSwap(originalType = ScopeRepresentation.class, fieldName = "resources") public class KeycloakRealmImport extends CustomResource implements Namespaced { diff --git a/operator/src/main/java/org/keycloak/representations/overrides/NoSubGroupsGroupRepresentation.java b/operator/src/main/java/org/keycloak/representations/overrides/NoSubGroupsGroupRepresentation.java deleted file mode 100644 index d88533b8da..0000000000 --- a/operator/src/main/java/org/keycloak/representations/overrides/NoSubGroupsGroupRepresentation.java +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright 2016 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.keycloak.representations.overrides; - -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -public class NoSubGroupsGroupRepresentation { - protected String id; - protected String name; - protected String path; - protected Map> attributes; - protected List realmRoles; - protected Map> clientRoles; - // TODO: eventually generate code for Nth levels of depth - // protected List subGroups; - private Map access; - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getPath() { - return path; - } - - public void setPath(String path) { - this.path = path; - } - - public List getRealmRoles() { - return realmRoles; - } - - public void setRealmRoles(List realmRoles) { - this.realmRoles = realmRoles; - } - - public Map> getClientRoles() { - return clientRoles; - } - - public void setClientRoles(Map> clientRoles) { - this.clientRoles = clientRoles; - } - - - public Map> getAttributes() { - return attributes; - } - - public void setAttributes(Map> attributes) { - this.attributes = attributes; - } - - public NoSubGroupsGroupRepresentation singleAttribute(String name, String value) { - if (this.attributes == null) attributes = new HashMap<>(); - attributes.put(name, Arrays.asList(value)); - return this; - } - - public Map getAccess() { - return access; - } - - public void setAccess(Map access) { - this.access = access; - } -} diff --git a/operator/src/main/java/org/keycloak/representations/overrides/NoSubGroupsGroupRepresentationList.java b/operator/src/main/java/org/keycloak/representations/overrides/NoSubGroupsGroupRepresentationList.java deleted file mode 100644 index 75c53688a6..0000000000 --- a/operator/src/main/java/org/keycloak/representations/overrides/NoSubGroupsGroupRepresentationList.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright 2016 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.keycloak.representations.overrides; - -import java.util.ArrayList; - -public class NoSubGroupsGroupRepresentationList extends ArrayList { -} diff --git a/operator/src/main/java/org/keycloak/representations/overrides/NoSubcomponentsComponentExportRepresentation.java b/operator/src/main/java/org/keycloak/representations/overrides/NoSubcomponentsComponentExportRepresentation.java deleted file mode 100644 index 3e687f7a70..0000000000 --- a/operator/src/main/java/org/keycloak/representations/overrides/NoSubcomponentsComponentExportRepresentation.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright 2016 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.keycloak.representations.overrides; - -import org.keycloak.common.util.MultivaluedHashMap; - -public class NoSubcomponentsComponentExportRepresentation { - - private String id; - private String name; - private String providerId; - private String subType; - // TODO: eventually generate code for Nth levels of depth - // private MultivaluedHashMap subComponents = new MultivaluedHashMap<>(); - private MultivaluedHashMap config = new MultivaluedHashMap<>(); - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getProviderId() { - return providerId; - } - - public void setProviderId(String providerId) { - this.providerId = providerId; - } - - public String getSubType() { - return subType; - } - - public void setSubType(String subType) { - this.subType = subType; - } - - public MultivaluedHashMap getConfig() { - return config; - } - - public void setConfig(MultivaluedHashMap config) { - this.config = config; - } - -} diff --git a/operator/src/main/java/org/keycloak/representations/overrides/NoSubcomponentsComponentExportRepresentationMap.java b/operator/src/main/java/org/keycloak/representations/overrides/NoSubcomponentsComponentExportRepresentationMap.java deleted file mode 100644 index f7851cc5ca..0000000000 --- a/operator/src/main/java/org/keycloak/representations/overrides/NoSubcomponentsComponentExportRepresentationMap.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright 2016 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.keycloak.representations.overrides; - -import java.util.HashMap; -import java.util.List; - -public class NoSubcomponentsComponentExportRepresentationMap extends HashMap> { -} diff --git a/operator/src/test/resources/test-serialization-realmimport-cr.yml b/operator/src/test/resources/test-serialization-realmimport-cr.yml index 32e11e15e1..f6200734bd 100644 --- a/operator/src/test/resources/test-serialization-realmimport-cr.yml +++ b/operator/src/test/resources/test-serialization-realmimport-cr.yml @@ -1087,7 +1087,20 @@ spec: name: Consent Required providerId: consent-required subType: anonymous - subComponents: {} + subComponents: + level1: + - id: id1 + name: Consent Required + providerId: consent-required + subType: anonymous + subComponents: + level2: + - id: id2 + name: Consent Required + providerId: consent-required + subType: anonymous + config: {} + config: {} config: {} - id: 7063fa94-4f9e-48cd-9659-bb46ccc09764 name: Full Scope Disabled