You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@syncope.apache.org by il...@apache.org on 2026/03/04 13:37:29 UTC
(syncope) branch master updated: [SYNCOPE-1951] Split Any/Realm sections and add dedicated Realm management UI (#1310)
This is an automated email from the ASF dual-hosted git repository.
ilgrosso pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/syncope.git
The following commit(s) were added to refs/heads/master by this push:
new 1f2221eb21 [SYNCOPE-1951] Split Any/Realm sections and add dedicated Realm management UI (#1310)
1f2221eb21 is described below
commit 1f2221eb21dba33c139b24285f90e33c2c5f334f
Author: Matteo Tatoni <ta...@gmail.com>
AuthorDate: Wed Mar 4 13:39:48 2026 +0100
[SYNCOPE-1951] Split Any/Realm sections and add dedicated Realm management UI (#1310)
---
...AnyDirectoryPanelAdditionalActionsProvider.java | 8 +-
.../panels/search/ConnObjectSearchPanel.java | 2 +-
.../markup/html/form/AbstractMultiPanel.java | 8 +-
.../commons/markup/html/form/MultiFieldPanel.java | 9 +
.../META-INF/resources/ui-commons/css/search.scss | 6 +
.../resources/ui-commons/css/syncopeUI.scss | 14 +-
.../syncope/client/console/PreferenceManager.java | 2 +
.../client/console/commons/IdRepoConstants.java | 8 +
.../apache/syncope/client/console/pages/Anys.java | 148 +++++
.../syncope/client/console/pages/BasePage.java | 55 +-
.../syncope/client/console/pages/Realms.java | 313 ++++------
.../console/panels/AbstractDisplayModalPanel.java | 128 +++++
.../client/console/panels/AnyDirectoryPanel.java | 12 +-
.../panels/AnyDisplayAttributesModalPanel.java | 84 +++
.../AnyObjectDisplayAttributesModalPanel.java | 2 +-
.../console/panels/{Realm.java => AnysPanel.java} | 112 +---
.../client/console/panels/DirectoryPanel.java | 2 +-
.../panels/DisplayAttributesModalPanel.java | 195 -------
.../panels/GroupDisplayAttributesModalPanel.java | 2 +-
.../client/console/panels/RealmChoicePanel.java | 6 +-
.../client/console/panels/RealmDetails.java | 92 ++-
.../client/console/panels/RealmDirectoryPanel.java | 627 +++++++++++++++++++++
.../panels/RealmDisplayAttributesModalPanel.java | 78 +++
.../client/console/panels/RealmWizardBuilder.java | 43 +-
.../panels/UserDisplayAttributesModalPanel.java | 2 +-
.../panels/search/AbstractAnySearchPanel.java | 117 ++++
.../console/panels/search/AbstractSearchPanel.java | 147 ++---
.../panels/search/AnyObjectSearchPanel.java | 2 +-
.../console/panels/search/GroupSearchPanel.java | 2 +-
.../console/panels/search/RealmSearchPanel.java | 309 ++++++++++
.../console/panels/search/SearchClausePanel.java | 333 +++++------
.../client/console/rest/TaskRestClient.java | 19 +
.../tasks/RealmPropagationTaskDirectoryPanel.java | 71 +++
.../console/tasks/RealmPropagationTasks.java | 62 ++
.../client/console/tasks/TemplatesTogglePanel.java | 5 +
.../client/console/widgets/NumberWidget.java | 33 +-
.../client/console/wizards/any/Details.java | 6 +-
.../META-INF/resources/css/syncopeConsole.scss | 79 ++-
.../console/pages/{Realms.html => Anys.html} | 5 +-
.../{Realms_pt_BR.properties => Anys.properties} | 7 +-
...alms_fr_CA.properties => Anys_fr_CA.properties} | 7 +-
.../{Realms_it.properties => Anys_it.properties} | 7 +-
.../{Realms.properties => Anys_ja.properties} | 11 +-
...alms_pt_BR.properties => Anys_pt_BR.properties} | 7 +-
...{Realms_pt_BR.properties => Anys_ru.properties} | 10 +-
.../syncope/client/console/pages/BasePage.html | 31 +-
.../client/console/pages/BasePage.properties | 3 +
.../client/console/pages/BasePage_fr_CA.properties | 3 +
.../client/console/pages/BasePage_it.properties | 3 +
.../client/console/pages/BasePage_ja.properties | 3 +
.../client/console/pages/BasePage_pt_BR.properties | 3 +
.../client/console/pages/BasePage_ru.properties | 3 +
.../syncope/client/console/pages/Realms.html | 14 +-
.../syncope/client/console/pages/Realms.properties | 9 +-
.../client/console/pages/Realms_fr_CA.properties | 7 +-
.../client/console/pages/Realms_it.properties | 13 +-
.../client/console/pages/Realms_ja.properties | 9 +-
.../client/console/pages/Realms_pt_BR.properties | 13 +-
.../client/console/pages/Realms_ru.properties | 8 +-
...AbstractDisplayAttributesModalPanel.properties} | 0
...ctDisplayAttributesModalPanel_fr_CA.properties} | 0
...tractDisplayAttributesModalPanel_it.properties} | 0
...tractDisplayAttributesModalPanel_ja.properties} | 0
...ctDisplayAttributesModalPanel_pt_BR.properties} | 0
...tractDisplayAttributesModalPanel_ru.properties} | 0
...alPanel.html => AbstractDisplayModalPanel.html} | 4 +-
...erties => AbstractDisplayModalPanel.properties} | 0
... => AbstractDisplayModalPanel_fr_CA.properties} | 0
...ies => AbstractDisplayModalPanel_it.properties} | 0
...ies => AbstractDisplayModalPanel_ja.properties} | 0
... => AbstractDisplayModalPanel_pt_BR.properties} | 0
...ies => AbstractDisplayModalPanel_ru.properties} | 0
.../console/panels/{Realm.html => AnysPanel.html} | 0
.../client/console/panels/RealmChoicePanel.html | 8 +-
.../client/console/panels/RealmDetails.html | 3 +
.../client/console/panels/RealmDetails.properties | 1 +
.../console/panels/RealmDetails_fr_CA.properties | 1 +
.../console/panels/RealmDetails_it.properties | 1 +
.../console/panels/RealmDetails_ja.properties | 1 +
.../console/panels/RealmDetails_pt_BR.properties | 1 +
.../console/panels/RealmDetails_ru.properties | 1 +
.../{Realm.html => RealmDirectoryPanel.html} | 3 +-
...R.properties => RealmDirectoryPanel.properties} | 23 +-
...erties => RealmDirectoryPanel_fr_CA.properties} | 25 +-
...roperties => RealmDirectoryPanel_it.properties} | 15 +-
...roperties => RealmDirectoryPanel_ja.properties} | 21 +-
...erties => RealmDirectoryPanel_pt_BR.properties} | 25 +-
.../panels/RealmDirectoryPanel_ru.properties | 32 ++
.../console/panels/search/SearchClausePanel.html | 4 +
.../markup/html/form/ActionsPanel_it.properties | 4 +
.../syncope/client/enduser/panels/Sidebar.html | 4 +-
.../search/RealmFiqlSearchConditionBuilder.java | 7 +
.../api/search/AnySearchCondVisitor.java | 1 -
.../api/search/RealmSearchCondVisitor.java | 4 +-
.../jpa/dao/AbstractJPARealmSearchDAO.java | 72 ++-
.../outer/{RealmTest.java => RealmSearchTest.java} | 136 ++---
.../core/persistence/jpa/outer/RealmTest.java | 130 -----
.../persistence/neo4j/dao/Neo4jRealmSearchDAO.java | 30 +
.../persistence/neo4j/outer/RealmSearchTest.java} | 142 +++--
.../core/persistence/neo4j/outer/RealmTest.java | 126 -----
.../elasticsearch/client/ElasticsearchUtils.java | 3 +
.../dao/ElasticsearchRealmSearchDAO.java | 21 +-
.../ext/opensearch/client/OpenSearchUtils.java | 3 +
.../opensearch/dao/OpenSearchRealmSearchDAO.java | 20 +
.../syncope/fit/console/AbstractConsoleITCase.java | 4 +
.../syncope/fit/console/AjaxBrowseITCase.java | 6 +-
.../syncope/fit/console/AnyObjectsITCase.java | 19 +-
.../apache/syncope/fit/console/AnyTypesITCase.java | 8 +-
.../apache/syncope/fit/console/BatchesITCase.java | 41 +-
.../fit/console/DisplayAttributesITCase.java | 8 +-
.../apache/syncope/fit/console/GroupsITCase.java | 19 +-
.../syncope/fit/console/LinkedAccountsITCase.java | 4 +-
.../apache/syncope/fit/console/PoliciesITCase.java | 34 +-
.../apache/syncope/fit/console/RealmsITCase.java | 255 +++++----
.../apache/syncope/fit/console/UsersITCase.java | 42 +-
.../org/apache/syncope/fit/core/RealmITCase.java | 19 +-
116 files changed, 3047 insertions(+), 1603 deletions(-)
diff --git a/client/idm/console/src/main/java/org/apache/syncope/client/console/commons/IdMAnyDirectoryPanelAdditionalActionsProvider.java b/client/idm/console/src/main/java/org/apache/syncope/client/console/commons/IdMAnyDirectoryPanelAdditionalActionsProvider.java
index 5b572914f7..1d8d9b7323 100644
--- a/client/idm/console/src/main/java/org/apache/syncope/client/console/commons/IdMAnyDirectoryPanelAdditionalActionsProvider.java
+++ b/client/idm/console/src/main/java/org/apache/syncope/client/console/commons/IdMAnyDirectoryPanelAdditionalActionsProvider.java
@@ -26,7 +26,7 @@ import org.apache.syncope.client.console.PreferenceManager;
import org.apache.syncope.client.console.SyncopeConsoleSession;
import org.apache.syncope.client.console.pages.BasePage;
import org.apache.syncope.client.console.panels.AnyDirectoryPanel;
-import org.apache.syncope.client.console.panels.DisplayAttributesModalPanel;
+import org.apache.syncope.client.console.panels.AnyDisplayAttributesModalPanel;
import org.apache.syncope.client.console.rest.BaseRestClient;
import org.apache.syncope.client.console.rest.ImplementationRestClient;
import org.apache.syncope.client.console.rest.ReconciliationRestClient;
@@ -195,11 +195,11 @@ public class IdMAnyDirectoryPanelAdditionalActionsProvider implements AnyDirecto
final List<String> dSchemaNames) {
return new CSVPushSpec.Builder(type).
- fields(PreferenceManager.getList(DisplayAttributesModalPanel.getPrefDetailView(type)).
+ fields(PreferenceManager.getList(AnyDisplayAttributesModalPanel.getPrefDetailView(type)).
stream().filter(name -> !Constants.KEY_FIELD_NAME.equalsIgnoreCase(name)).toList()).
- plainAttrs(PreferenceManager.getList(DisplayAttributesModalPanel.getPrefPlainAttributeView(type)).
+ plainAttrs(PreferenceManager.getList(AnyDisplayAttributesModalPanel.getPrefPlainAttributeView(type)).
stream().filter(pSchemaNames::contains).toList()).
- derAttrs(PreferenceManager.getList(DisplayAttributesModalPanel.getPrefPlainAttributeView(type)).
+ derAttrs(PreferenceManager.getList(AnyDisplayAttributesModalPanel.getPrefPlainAttributeView(type)).
stream().filter(dSchemaNames::contains).toList()).
build();
}
diff --git a/client/idm/console/src/main/java/org/apache/syncope/client/console/panels/search/ConnObjectSearchPanel.java b/client/idm/console/src/main/java/org/apache/syncope/client/console/panels/search/ConnObjectSearchPanel.java
index fcebeb5198..c06d26bbea 100644
--- a/client/idm/console/src/main/java/org/apache/syncope/client/console/panels/search/ConnObjectSearchPanel.java
+++ b/client/idm/console/src/main/java/org/apache/syncope/client/console/panels/search/ConnObjectSearchPanel.java
@@ -34,7 +34,7 @@ import org.apache.wicket.model.IModel;
import org.apache.wicket.model.LoadableDetachableModel;
import org.apache.wicket.spring.injection.annot.SpringBean;
-public class ConnObjectSearchPanel extends AbstractSearchPanel {
+public class ConnObjectSearchPanel extends AbstractAnySearchPanel {
private static final long serialVersionUID = 21020550706646L;
diff --git a/client/idrepo/common-ui/src/main/java/org/apache/syncope/client/ui/commons/markup/html/form/AbstractMultiPanel.java b/client/idrepo/common-ui/src/main/java/org/apache/syncope/client/ui/commons/markup/html/form/AbstractMultiPanel.java
index e403729c26..277a6aa758 100644
--- a/client/idrepo/common-ui/src/main/java/org/apache/syncope/client/ui/commons/markup/html/form/AbstractMultiPanel.java
+++ b/client/idrepo/common-ui/src/main/java/org/apache/syncope/client/ui/commons/markup/html/form/AbstractMultiPanel.java
@@ -194,7 +194,9 @@ public abstract class AbstractMultiPanel<INNER> extends AbstractFieldPanel<List<
item.add(panel.setRenderBodyOnly(true));
- item.add(getFragmentMinus(item, panel, label));
+ Fragment minus = getFragmentMinus(item, panel, label);
+ minus.setVisible(minus.isVisible() && isRemovable(item));
+ item.add(minus);
Fragment plus = item.getIndex() == model.getObject().size() - 1
? getFragmentPlus()
@@ -205,6 +207,10 @@ public abstract class AbstractMultiPanel<INNER> extends AbstractFieldPanel<List<
protected abstract Panel getItemPanel(ListItem<INNER> item);
+ protected boolean isRemovable(final ListItem<INNER> item) {
+ return true;
+ }
+
protected void clearInput(final Panel panel) {
// do nothing by default
}
diff --git a/client/idrepo/common-ui/src/main/java/org/apache/syncope/client/ui/commons/markup/html/form/MultiFieldPanel.java b/client/idrepo/common-ui/src/main/java/org/apache/syncope/client/ui/commons/markup/html/form/MultiFieldPanel.java
index bfa04ae685..0515991415 100644
--- a/client/idrepo/common-ui/src/main/java/org/apache/syncope/client/ui/commons/markup/html/form/MultiFieldPanel.java
+++ b/client/idrepo/common-ui/src/main/java/org/apache/syncope/client/ui/commons/markup/html/form/MultiFieldPanel.java
@@ -72,6 +72,10 @@ public abstract class MultiFieldPanel<E extends Serializable> extends AbstractMu
return null;
}
+ protected boolean isRemovable(final ListItem<E> item) {
+ return true;
+ }
+
public MultiFieldPanel<E> build(final String id, final String name, final FieldPanel<E> panelTemplate) {
return new MultiFieldPanel<>(id, name, model) {
@@ -82,6 +86,11 @@ public abstract class MultiFieldPanel<E extends Serializable> extends AbstractMu
return Builder.this.newModelObject();
}
+ @Override
+ protected boolean isRemovable(final ListItem<E> item) {
+ return Builder.this.isRemovable(item);
+ }
+
@Override
protected FieldPanel<? extends Serializable> getItemPanel(final ListItem<E> item) {
FieldPanel<? extends Serializable> fieldPanel = panelTemplate.clone();
diff --git a/client/idrepo/common-ui/src/main/resources/META-INF/resources/ui-commons/css/search.scss b/client/idrepo/common-ui/src/main/resources/META-INF/resources/ui-commons/css/search.scss
index d56d78f563..961eb3415b 100644
--- a/client/idrepo/common-ui/src/main/resources/META-INF/resources/ui-commons/css/search.scss
+++ b/client/idrepo/common-ui/src/main/resources/META-INF/resources/ui-commons/css/search.scss
@@ -99,3 +99,9 @@
.search-spinner span{
width: 70% !important;
}
+
+.placeholder {
+ min-width: 60px;
+ background: white !important;
+ cursor: auto !important;
+}
diff --git a/client/idrepo/common-ui/src/main/resources/META-INF/resources/ui-commons/css/syncopeUI.scss b/client/idrepo/common-ui/src/main/resources/META-INF/resources/ui-commons/css/syncopeUI.scss
index 45d1e214cc..398125b97c 100644
--- a/client/idrepo/common-ui/src/main/resources/META-INF/resources/ui-commons/css/syncopeUI.scss
+++ b/client/idrepo/common-ui/src/main/resources/META-INF/resources/ui-commons/css/syncopeUI.scss
@@ -76,6 +76,15 @@ body {
/* General
============================================================================= */
+.sidebar-brand{
+ border: none !important;
+ padding: 5px!important;
+}
+
+.brand-image{
+ max-height: 50px !important;
+}
+
.block-sidebar {
max-height: 100% !important;
overflow: auto !important;
@@ -107,8 +116,9 @@ body {
.realm-header {
width: 100%;
clear: both;
- display: inline-table;
- margin: 0 0 10px;
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
line-height: 25px;
}
diff --git a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/PreferenceManager.java b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/PreferenceManager.java
index 683c1914c2..56a002d185 100644
--- a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/PreferenceManager.java
+++ b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/PreferenceManager.java
@@ -23,6 +23,7 @@ import java.io.Serializable;
import java.io.StringWriter;
import java.util.ArrayList;
import java.util.Base64;
+import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -121,6 +122,7 @@ public final class PreferenceManager implements Serializable {
result.addAll(List.of(items));
}
+ Collections.sort(result);
return result;
}
diff --git a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/commons/IdRepoConstants.java b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/commons/IdRepoConstants.java
index 995a2c01c0..039d198f31 100644
--- a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/commons/IdRepoConstants.java
+++ b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/commons/IdRepoConstants.java
@@ -54,6 +54,14 @@ public final class IdRepoConstants {
public static final String PREF_APPLICATION_PAGINATOR_ROWS = "application.paginator.rows";
+ public static final String PREF_REALM_PAGINATOR_ROWS = "realm.paginator.rows";
+
+ public static final String PREF_REALM_DETAILS_VIEW = "realm.details.view";
+
+ public static final String PREF_REALM_PLAIN_ATTRS_VIEW = "realm.plain.attrs.view";
+
+ public static final String PREF_REALM_DER_ATTRS_VIEW = "realm.der.attrs.view";
+
public static final String PREF_ACCESS_TOKEN_PAGINATOR_ROWS = "accessToken.paginator.rows";
public static final String PREF_COMMAND_PAGINATOR_ROWS = "command.paginator.rows";
diff --git a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/pages/Anys.java b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/pages/Anys.java
new file mode 100644
index 0000000000..a9bbd097da
--- /dev/null
+++ b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/pages/Anys.java
@@ -0,0 +1,148 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.apache.syncope.client.console.pages;
+
+import com.fasterxml.jackson.databind.json.JsonMapper;
+import de.agilecoders.wicket.core.markup.html.bootstrap.dialog.Modal;
+import java.util.List;
+import org.apache.syncope.client.console.BookmarkablePageLinkBuilder;
+import org.apache.syncope.client.console.panels.AnysPanel;
+import org.apache.syncope.client.console.panels.RealmChoicePanel;
+import org.apache.syncope.client.console.panels.RealmChoicePanel.ChosenRealm;
+import org.apache.syncope.client.console.rest.AnyTypeRestClient;
+import org.apache.syncope.client.console.rest.AuditRestClient;
+import org.apache.syncope.client.console.rest.RealmRestClient;
+import org.apache.syncope.client.console.wicket.markup.html.bootstrap.dialog.BaseModal;
+import org.apache.syncope.client.console.wizards.any.ResultPanel;
+import org.apache.syncope.common.lib.to.AnyTypeTO;
+import org.apache.syncope.common.lib.to.ProvisioningResult;
+import org.apache.syncope.common.lib.to.RealmTO;
+import org.apache.wicket.PageReference;
+import org.apache.wicket.event.Broadcast;
+import org.apache.wicket.event.IEvent;
+import org.apache.wicket.markup.html.WebMarkupContainer;
+import org.apache.wicket.markup.html.basic.Label;
+import org.apache.wicket.model.Model;
+import org.apache.wicket.request.mapper.parameter.PageParameters;
+import org.apache.wicket.spring.injection.annot.SpringBean;
+
+public class Anys extends BasePage {
+
+ private static final long serialVersionUID = -1100228004207271270L;
+
+ protected static final JsonMapper MAPPER = JsonMapper.builder().findAndAddModules().build();
+
+ public static final String SELECTED_INDEX = "selectedIndex";
+
+ public static final String INITIAL_REALM = "initialRealm";
+
+ @SpringBean
+ protected RealmRestClient realmRestClient;
+
+ @SpringBean
+ protected AnyTypeRestClient anyTypeRestClient;
+
+ @SpringBean
+ protected AuditRestClient auditRestClient;
+
+ protected final RealmChoicePanel realmChoicePanel;
+
+ protected final WebMarkupContainer content;
+
+ protected final BaseModal<RealmTO> modal;
+
+ public Anys(final PageParameters parameters) {
+ super(parameters);
+
+ body.add(BookmarkablePageLinkBuilder.build("dashboard", "dashboardBr", Dashboard.class));
+
+ content = new WebMarkupContainer("content");
+ body.add(content.setOutputMarkupId(true));
+
+ realmChoicePanel = buildRealmChoicePanel(parameters.get(INITIAL_REALM).toOptionalString(), getPageReference());
+ content.add(realmChoicePanel);
+
+ content.add(new Label("body", "Root realm"));
+
+ modal = new BaseModal<>("modal");
+ modal.size(Modal.Size.Large);
+ content.add(modal);
+
+ modal.setWindowClosedCallback(target -> {
+ target.add(realmChoicePanel.reloadRealmTree(target));
+ target.add(content);
+ modal.show(false);
+ });
+
+ updateRealmContent(realmChoicePanel.getCurrentRealm(), parameters.get(SELECTED_INDEX).toInt(0));
+ }
+
+ protected RealmChoicePanel buildRealmChoicePanel(final String initialRealm, final PageReference pageRef) {
+ RealmChoicePanel panel = new RealmChoicePanel("realmChoicePanel", initialRealm, realmRestClient, pageRef);
+ panel.setOutputMarkupId(true);
+ return panel;
+ }
+
+ public RealmChoicePanel getRealmChoicePanel() {
+ return realmChoicePanel;
+ }
+
+ @Override
+ public void onEvent(final IEvent<?> event) {
+ super.onEvent(event);
+
+ if (event.getPayload() instanceof ChosenRealm choosenRealm) {
+ updateRealmContent(choosenRealm.obj(), 0);
+ choosenRealm.target().add(content);
+ }
+ }
+
+ protected WebMarkupContainer updateRealmContent(final RealmTO realmTO, final int selectedIndex) {
+ if (realmTO != null) {
+ content.addOrReplace(new Content(realmTO, anyTypeRestClient.listAnyTypes(), selectedIndex));
+ }
+ return content;
+ }
+
+ protected class Content extends AnysPanel {
+
+ private static final long serialVersionUID = 8221398624379357183L;
+
+ protected Content(final RealmTO realmTO, final List<AnyTypeTO> anyTypes, final int selectedIndex) {
+ super("body", realmTO, anyTypes, selectedIndex, Anys.this.getPageReference());
+ }
+
+ @Override
+ protected void setWindowClosedReloadCallback(final BaseModal<?> modal) {
+ modal.setWindowClosedCallback(target -> {
+ if (modal.getContent() instanceof ResultPanel<?, ?> rp) {
+ RealmTO newRealmTO = RealmTO.class.cast(ProvisioningResult.class.cast(rp.getResult()).getEntity());
+ // reload realmChoicePanel label too - SYNCOPE-1151
+ target.add(realmChoicePanel.reloadRealmTree(target, Model.of(newRealmTO)));
+ realmChoicePanel.setCurrentRealm(newRealmTO);
+ send(Anys.this, Broadcast.DEPTH, new ChosenRealm(newRealmTO, target));
+ } else {
+ target.add(realmChoicePanel.reloadRealmTree(target));
+ }
+ target.add(content);
+ modal.show(false);
+ });
+ }
+ }
+}
diff --git a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/pages/BasePage.java b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/pages/BasePage.java
index a2ceee3406..cc93e9196c 100644
--- a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/pages/BasePage.java
+++ b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/pages/BasePage.java
@@ -153,12 +153,22 @@ public class BasePage extends BaseWebPage {
body.add(liContainer);
liContainer.add(BookmarkablePageLinkBuilder.build("dashboard", Dashboard.class));
- liContainer = new WebMarkupContainer(getLIContainerId("realms"));
- body.add(liContainer);
+ WebMarkupContainer directoryLIContainer = new WebMarkupContainer(getLIContainerId("directory"));
+ body.add(directoryLIContainer);
+ WebMarkupContainer directoryULContainer = new WebMarkupContainer(getULContainerId("directory"));
+ directoryLIContainer.add(directoryULContainer);
- BookmarkablePageLink<? extends BasePage> link = BookmarkablePageLinkBuilder.build("realms", Realms.class);
+ liContainer = new WebMarkupContainer(getLIContainerId("realms"));
+ directoryULContainer.add(liContainer);
+ BookmarkablePageLink<? extends BasePage> link =
+ BookmarkablePageLinkBuilder.build("realms", Realms.class);
MetaDataRoleAuthorizationStrategy.authorize(link, WebPage.RENDER, IdRepoEntitlement.REALM_SEARCH);
+ liContainer.add(link);
+ liContainer = new WebMarkupContainer(getLIContainerId("anys"));
+ directoryULContainer.add(liContainer);
+ link = BookmarkablePageLinkBuilder.build("anys", Anys.class);
+ MetaDataRoleAuthorizationStrategy.authorize(link, WebPage.RENDER, IdRepoEntitlement.REALM_SEARCH);
liContainer.add(link);
liContainer = new WebMarkupContainer(getLIContainerId("engagements"));
@@ -401,17 +411,22 @@ public class BasePage extends BaseWebPage {
// 1. check if current class is set to top-level menu
WebMarkupContainer containingLI = (WebMarkupContainer) body.get(
getLIContainerId(getClass().getSimpleName().toLowerCase()));
- // 2. if not, check if it is under 'Keymaster'
+ // 2. if not, check if it is under 'Directory'
+ if (containingLI == null) {
+ containingLI = (WebMarkupContainer) directoryULContainer.get(
+ getLIContainerId(getClass().getSimpleName().toLowerCase()));
+ }
+ // 3. if not, check if it is under 'Keymaster'
if (containingLI == null) {
containingLI = (WebMarkupContainer) keymasterULContainer.get(
getLIContainerId(getClass().getSimpleName().toLowerCase()));
}
- // 3. if not, check if it is under 'Configuration'
+ // 4. if not, check if it is under 'Configuration'
if (containingLI == null) {
containingLI = (WebMarkupContainer) confULContainer.get(
getLIContainerId(getClass().getSimpleName().toLowerCase()));
}
- // 4. when found, set CSS coordinates for menu
+ // 5. when found, set CSS coordinates for menu
if (containingLI != null) {
StreamSupport.stream(containingLI.spliterator(), false).filter(Link.class::isInstance).
forEach(child -> child.add(new Behavior() {
@@ -424,7 +439,33 @@ public class BasePage extends BaseWebPage {
}
}));
- if (keymasterULContainer.getId().equals(containingLI.getParent().getId())) {
+ if (directoryULContainer.getId().equals(containingLI.getParent().getId())) {
+ directoryULContainer.add(new Behavior() {
+
+ private static final long serialVersionUID = -5775607340182293596L;
+
+ @Override
+ public void renderHead(final Component component, final IHeaderResponse response) {
+ response.render(OnDomReadyHeaderItem.forScript("$('#domainLink').addClass('active')"));
+ }
+
+ @Override
+ public void onComponentTag(final Component component, final ComponentTag tag) {
+ tag.put("class", "nav nav-treeview");
+ tag.put("style", "display: block;");
+ }
+ });
+
+ directoryLIContainer.add(new Behavior() {
+
+ private static final long serialVersionUID = -5775607340182293596L;
+
+ @Override
+ public void onComponentTag(final Component component, final ComponentTag tag) {
+ tag.put("class", "nav-item has-treeview menu-open");
+ }
+ });
+ } else if (keymasterULContainer.getId().equals(containingLI.getParent().getId())) {
keymasterULContainer.add(new Behavior() {
private static final long serialVersionUID = -5775607340182293596L;
diff --git a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/pages/Realms.java b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/pages/Realms.java
index 2307193aa9..126c51ab26 100644
--- a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/pages/Realms.java
+++ b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/pages/Realms.java
@@ -18,77 +18,101 @@
*/
package org.apache.syncope.client.console.pages;
-import com.fasterxml.jackson.databind.json.JsonMapper;
import de.agilecoders.wicket.core.markup.html.bootstrap.dialog.Modal;
import java.io.Serializable;
+import java.util.ArrayList;
import java.util.List;
+import java.util.Optional;
+import org.apache.commons.lang3.StringUtils;
import org.apache.syncope.client.console.BookmarkablePageLinkBuilder;
import org.apache.syncope.client.console.SyncopeConsoleSession;
-import org.apache.syncope.client.console.audit.AuditHistoryModal;
-import org.apache.syncope.client.console.panels.Realm;
-import org.apache.syncope.client.console.panels.RealmChoicePanel;
-import org.apache.syncope.client.console.panels.RealmChoicePanel.ChosenRealm;
-import org.apache.syncope.client.console.rest.AnyTypeRestClient;
-import org.apache.syncope.client.console.rest.AuditRestClient;
+import org.apache.syncope.client.console.panels.RealmDirectoryPanel;
+import org.apache.syncope.client.console.panels.search.RealmSearchPanel;
+import org.apache.syncope.client.console.panels.search.SearchClause;
+import org.apache.syncope.client.console.panels.search.SearchClausePanel;
+import org.apache.syncope.client.console.panels.search.SearchUtils;
import org.apache.syncope.client.console.rest.RealmRestClient;
import org.apache.syncope.client.console.tasks.TemplatesTogglePanel;
import org.apache.syncope.client.console.wicket.markup.html.bootstrap.dialog.BaseModal;
-import org.apache.syncope.client.console.wizards.any.ResultPanel;
+import org.apache.syncope.client.lib.SyncopeClient;
import org.apache.syncope.client.ui.commons.Constants;
-import org.apache.syncope.client.ui.commons.pages.BaseWebPage;
import org.apache.syncope.client.ui.commons.panels.WizardModalPanel;
+import org.apache.syncope.client.ui.commons.wicket.markup.html.bootstrap.tabs.Accordion;
import org.apache.syncope.client.ui.commons.wizards.AjaxWizard;
import org.apache.syncope.common.lib.to.AnyTO;
-import org.apache.syncope.common.lib.to.AnyTypeTO;
-import org.apache.syncope.common.lib.to.ProvisioningResult;
import org.apache.syncope.common.lib.to.RealmTO;
import org.apache.syncope.common.lib.to.TemplatableTO;
-import org.apache.syncope.common.lib.types.IdRepoEntitlement;
-import org.apache.syncope.common.lib.types.OpEvent;
-import org.apache.wicket.PageReference;
+import org.apache.wicket.Component;
import org.apache.wicket.ajax.AjaxRequestTarget;
-import org.apache.wicket.event.Broadcast;
+import org.apache.wicket.ajax.markup.html.AjaxLink;
import org.apache.wicket.event.IEvent;
+import org.apache.wicket.extensions.markup.html.tabs.AbstractTab;
+import org.apache.wicket.extensions.markup.html.tabs.ITab;
import org.apache.wicket.markup.html.WebMarkupContainer;
-import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.model.CompoundPropertyModel;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.Model;
+import org.apache.wicket.model.ResourceModel;
+import org.apache.wicket.model.util.ListModel;
import org.apache.wicket.request.mapper.parameter.PageParameters;
import org.apache.wicket.spring.injection.annot.SpringBean;
public class Realms extends BasePage {
- private static final long serialVersionUID = -1100228004207271270L;
-
- protected static final JsonMapper MAPPER = JsonMapper.builder().findAndAddModules().build();
-
- public static final String SELECTED_INDEX = "selectedIndex";
-
- public static final String INITIAL_REALM = "initialRealm";
+ private static final long serialVersionUID = -810612679853772333L;
@SpringBean
protected RealmRestClient realmRestClient;
- @SpringBean
- protected AnyTypeRestClient anyTypeRestClient;
+ protected final RealmDirectoryPanel realmDirectoryPanel;
- @SpringBean
- protected AuditRestClient auditRestClient;
+ protected RealmSearchPanel searchPanel;
protected final TemplatesTogglePanel templates;
- protected final RealmChoicePanel realmChoicePanel;
-
- protected final WebMarkupContainer content;
-
- protected final BaseModal<RealmTO> modal;
-
protected final BaseModal<Serializable> templateModal;
public Realms(final PageParameters parameters) {
super(parameters);
+ body.add(BookmarkablePageLinkBuilder.build("dashboard", "dashboardBr", Dashboard.class));
+
+ List<SearchClause> clauses = new ArrayList<>();
+
+ Model<Integer> model = Model.of(-1);
+ body.add(new Accordion("accordionPanel",
+ List.of(new AbstractTab(new ResourceModel("search.result")) {
+
+ private static final long serialVersionUID = 1037272333056449377L;
+
+ @Override
+ public WebMarkupContainer getPanel(final String panelId) {
+ searchPanel = new RealmSearchPanel.Builder(new ListModel<>(clauses), getPageReference()).
+ required(true).enableSearch().build(panelId);
+ return searchPanel;
+ }
+ }), model) {
+
+ private static final long serialVersionUID = -3056452800492734900L;
+
+ @Override
+ protected Component newTitle(final String markupId, final ITab tab, final Accordion.State state) {
+ return new AjaxLink<Integer>(markupId) {
+
+ private static final long serialVersionUID = 6250423506463465679L;
+
+ @Override
+ public void onClick(final AjaxRequestTarget target) {
+ model.setObject(model.getObject() == 0 ? -1 : 0);
+ }
+ }.setBody(tab.getTitle()).setEscapeModelStrings(false);
+ }
+ });
+
+ realmDirectoryPanel = new RealmDirectoryPanel("directoryPanel", realmRestClient, getPageReference());
+ realmDirectoryPanel.setOutputMarkupId(true);
+ body.add(realmDirectoryPanel);
+
templates = new TemplatesTogglePanel(BaseModal.CONTENT_ID, this, getPageReference()) {
private static final long serialVersionUID = 4828350561653999922L;
@@ -102,22 +126,7 @@ public class Realms extends BasePage {
return targetObject;
}
};
-
- body.add(BookmarkablePageLinkBuilder.build("dashboard", "dashboardBr", Dashboard.class));
-
- content = new WebMarkupContainer("content");
- body.add(content.setOutputMarkupId(true));
-
- realmChoicePanel = buildRealmChoicePanel(parameters.get(INITIAL_REALM).toOptionalString(), getPageReference());
- content.add(realmChoicePanel);
-
- content.add(new Label("body", "Root realm"));
-
- modal = new BaseModal<>("modal");
- modal.size(Modal.Size.Large);
- content.add(modal);
-
- content.add(templates);
+ body.add(templates);
templateModal = new BaseModal<>("templateModal") {
@@ -130,176 +139,62 @@ public class Realms extends BasePage {
}
};
templateModal.size(Modal.Size.Extra_large);
- content.add(templateModal);
-
- modal.setWindowClosedCallback(target -> {
- target.add(realmChoicePanel.reloadRealmTree(target));
- target.add(content);
- modal.show(false);
- });
+ body.add(templateModal);
- templateModal.setWindowClosedCallback(target -> {
- target.add(content);
- templateModal.show(false);
- });
-
- updateRealmContent(realmChoicePanel.getCurrentRealm(), parameters.get(SELECTED_INDEX).toInt(0));
- }
-
- protected RealmChoicePanel buildRealmChoicePanel(final String initialRealm, final PageReference pageRef) {
- RealmChoicePanel panel = new RealmChoicePanel("realmChoicePanel", initialRealm, realmRestClient, pageRef);
- panel.setOutputMarkupId(true);
- return panel;
- }
-
- public RealmChoicePanel getRealmChoicePanel() {
- return realmChoicePanel;
+ templateModal.setWindowClosedCallback(target -> templateModal.show(false));
}
@Override
public void onEvent(final IEvent<?> event) {
- super.onEvent(event);
-
- switch (event.getPayload()) {
- case ChosenRealm chosenRealm -> {
- updateRealmContent(chosenRealm.obj(), 0);
- chosenRealm.target().add(content);
- }
- case AjaxWizard.NewItemEvent<?> newItemEvent -> {
- WizardModalPanel<?> modalPanel = newItemEvent.getModalPanel();
-
- if (event.getPayload() instanceof AjaxWizard.NewItemActionEvent && modalPanel != null) {
- final IModel<Serializable> model = new CompoundPropertyModel<>(modalPanel.getItem());
- templateModal.setFormModel(model);
- templateModal.header(newItemEvent.getTitleModel());
- newItemEvent.getTarget().ifPresent(t -> t.add(templateModal.setContent(modalPanel)));
- templateModal.show(true);
- } else if (event.getPayload() instanceof AjaxWizard.NewItemCancelEvent) {
- newItemEvent.getTarget().ifPresent(templateModal::close);
- } else if (event.getPayload() instanceof AjaxWizard.NewItemFinishEvent) {
- SyncopeConsoleSession.get().success(getString(Constants.OPERATION_SUCCEEDED));
- newItemEvent.getTarget().ifPresent(t -> {
- ((BasePage) getPage()).getNotificationPanel().refresh(t);
- templateModal.close(t);
- });
- }
- }
- default -> {
+ if (event.getPayload() instanceof SearchClausePanel.SearchEvent payload && searchPanel != null) {
+ List<SearchClause> clauses = searchPanel.getModel().getObject();
+ String base = clauses.stream().
+ filter(Realms::isBaseClause).
+ map(SearchClause::getValue).
+ filter(StringUtils::isNotBlank).
+ findFirst().
+ orElse(StringUtils.EMPTY);
+
+ List<SearchClause> fiqlClauses = clauses.stream()
+ .filter(clause -> !isBaseClause(clause))
+ .filter(Realms::isValid)
+ .toList();
+
+ realmDirectoryPanel.search(base, Optional.ofNullable(SearchUtils.buildFIQL(
+ fiqlClauses,
+ SyncopeClient.getRealmFiqlSearchConditionBuilder())).orElse(StringUtils.EMPTY),
+ payload.getTarget());
+ } else if (event.getPayload() instanceof AjaxWizard.NewItemEvent<?> newItemEvent) {
+ WizardModalPanel<?> modalPanel = newItemEvent.getModalPanel();
+
+ if (event.getPayload() instanceof AjaxWizard.NewItemActionEvent && modalPanel != null) {
+ final IModel<Serializable> model = new CompoundPropertyModel<>(modalPanel.getItem());
+ templateModal.setFormModel(model);
+ templateModal.header(newItemEvent.getTitleModel());
+ newItemEvent.getTarget().ifPresent(t -> t.add(templateModal.setContent(modalPanel)));
+ templateModal.show(true);
+ } else if (event.getPayload() instanceof AjaxWizard.NewItemCancelEvent) {
+ newItemEvent.getTarget().ifPresent(templateModal::close);
+ } else if (event.getPayload() instanceof AjaxWizard.NewItemFinishEvent) {
+ SyncopeConsoleSession.get().success(getString(Constants.OPERATION_SUCCEEDED));
+ newItemEvent.getTarget().ifPresent(t -> {
+ ((BasePage) getPage()).getNotificationPanel().refresh(t);
+ templateModal.close(t);
+ });
}
+ } else if (event.getPayload() instanceof TemplatesTogglePanel.ShowTemplatesTogglePanelEvent action) {
+ templates.setTargetObject(action.realmTO());
+ templates.toggle(action.target(), true);
+ } else {
+ super.onEvent(event);
}
}
- protected WebMarkupContainer updateRealmContent(final RealmTO realmTO, final int selectedIndex) {
- if (realmTO != null) {
- content.addOrReplace(new Content(realmTO, anyTypeRestClient.listAnyTypes(), selectedIndex));
- }
- return content;
+ private static boolean isBaseClause(final SearchClause clause) {
+ return clause.getType() == SearchClause.Type.CUSTOM && "fullPath".equalsIgnoreCase(clause.getProperty());
}
- protected class Content extends Realm {
-
- private static final long serialVersionUID = 8221398624379357183L;
-
- protected Content(final RealmTO realmTO, final List<AnyTypeTO> anyTypes, final int selectedIndex) {
- super("body", realmTO, anyTypes, selectedIndex, Realms.this.getPageReference());
- }
-
- @Override
- protected void setWindowClosedReloadCallback(final BaseModal<?> modal) {
- modal.setWindowClosedCallback(target -> {
- if (modal.getContent() instanceof final ResultPanel<?, ?> rp) {
- RealmTO newRealmTO = RealmTO.class.cast(ProvisioningResult.class.cast(rp.getResult()).getEntity());
- // reload realmChoicePanel label too - SYNCOPE-1151
- target.add(realmChoicePanel.reloadRealmTree(target, Model.of(newRealmTO)));
- realmChoicePanel.setCurrentRealm(newRealmTO);
- send(Realms.this, Broadcast.DEPTH, new ChosenRealm(newRealmTO, target));
- } else {
- target.add(realmChoicePanel.reloadRealmTree(target));
- }
- target.add(content);
- modal.show(false);
- });
- }
-
- @Override
- protected void onClickTemplate(final AjaxRequestTarget target) {
- templates.setTargetObject(realmTO);
- templates.toggle(target, true);
- }
-
- @Override
- protected void onClickCreate(final AjaxRequestTarget target) {
- this.wizardBuilder.setParent(realmChoicePanel.getCurrentRealm());
- send(this, Broadcast.EXACT, new AjaxWizard.NewItemActionEvent<RealmTO>(new RealmTO(), target) {
-
- @Override
- public String getEventDescription() {
- return "realm.new";
- }
- });
- }
-
- @Override
- protected void onClickEdit(final AjaxRequestTarget target, final RealmTO realmTO) {
- send(this, Broadcast.EXACT, new AjaxWizard.EditItemActionEvent<RealmTO>(realmTO, target) {
-
- @Override
- public String getEventDescription() {
- return "realm.edit";
- }
- });
- }
-
- @Override
- protected void onClickAudit(final AjaxRequestTarget target, final RealmTO realmTO) {
- target.add(templateModal.setContent(new AuditHistoryModal<>(
- OpEvent.CategoryType.LOGIC,
- "RealmLogic",
- realmTO,
- IdRepoEntitlement.REALM_UPDATE,
- auditRestClient) {
-
- private static final long serialVersionUID = -5819724478921691835L;
-
- @Override
- protected void restore(final String json, final AjaxRequestTarget target) {
- try {
- RealmTO updated = MAPPER.readValue(json, RealmTO.class);
- realmRestClient.update(updated);
-
- SyncopeConsoleSession.get().success(getString(Constants.OPERATION_SUCCEEDED));
- target.add(realmChoicePanel.reloadRealmTree(target));
- } catch (Exception e) {
- LOG.error("While restoring realm {}", realmTO.getKey(), e);
- SyncopeConsoleSession.get().onException(e);
- }
- ((BasePage) pageRef.getPage()).getNotificationPanel().refresh(target);
- }
- }));
-
- templateModal.header(new Model<>(getString("realm.auditHistory.title", new Model<>(realmTO))));
-
- templateModal.show(true);
- }
-
- @Override
- protected void onClickDelete(final AjaxRequestTarget target, final RealmTO realmTO) {
- try {
- if (realmTO.getKey() == null) {
- throw new Exception("Root realm cannot be deleted");
- }
- realmRestClient.delete(realmTO.getFullPath());
- RealmTO parent = realmChoicePanel.moveToParentRealm(realmTO.getKey());
- target.add(realmChoicePanel.reloadRealmTree(target));
-
- SyncopeConsoleSession.get().success(getString(Constants.OPERATION_SUCCEEDED));
- updateRealmContent(parent, selectedIndex);
- target.add(content);
- } catch (Exception e) {
- LOG.error("While deleting realm", e);
- SyncopeConsoleSession.get().onException(e);
- }
- ((BaseWebPage) Realms.this.getPage()).getNotificationPanel().refresh(target);
- }
+ private static boolean isValid(final SearchClause clause) {
+ return clause.getProperty() != null && clause.getComparator() != null;
}
}
diff --git a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/AbstractDisplayModalPanel.java b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/AbstractDisplayModalPanel.java
new file mode 100644
index 0000000000..050c3251d6
--- /dev/null
+++ b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/AbstractDisplayModalPanel.java
@@ -0,0 +1,128 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.apache.syncope.client.console.panels;
+
+import java.io.Serializable;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import org.apache.syncope.client.console.PreferenceManager;
+import org.apache.syncope.client.console.SyncopeConsoleSession;
+import org.apache.syncope.client.console.pages.BasePage;
+import org.apache.syncope.client.console.wicket.markup.html.bootstrap.dialog.BaseModal;
+import org.apache.syncope.client.ui.commons.Constants;
+import org.apache.syncope.client.ui.commons.markup.html.form.AjaxPalettePanel;
+import org.apache.wicket.PageReference;
+import org.apache.wicket.ajax.AjaxRequestTarget;
+import org.apache.wicket.markup.html.WebMarkupContainer;
+import org.apache.wicket.model.PropertyModel;
+import org.apache.wicket.model.util.ListModel;
+
+public abstract class AbstractDisplayModalPanel<T extends Serializable> extends AbstractModalPanel<T> {
+
+ private static final long serialVersionUID = 4692227252045461088L;
+
+ private static final int MAX_SELECTIONS = 9;
+
+ private final String detailsPreferenceKey;
+
+ private final String plainAttrsPreferenceKey;
+
+ private final String derAttrsPreferenceKey;
+
+ protected final List<String> selectedDetails;
+
+ protected final List<String> selectedPlainSchemas;
+
+ protected final List<String> selectedDerSchemas;
+
+ protected AbstractDisplayModalPanel(
+ final BaseModal<T> modal,
+ final PageReference pageRef,
+ final List<String> availableDetails,
+ final List<String> availablePlainSchemas,
+ final List<String> availableDerSchemas,
+ final String detailsPreferenceKey,
+ final String plainAttrsPreferenceKey,
+ final String derAttrsPreferenceKey) {
+
+ super(modal, pageRef);
+
+ this.detailsPreferenceKey = detailsPreferenceKey;
+ this.plainAttrsPreferenceKey = plainAttrsPreferenceKey;
+ this.derAttrsPreferenceKey = derAttrsPreferenceKey;
+
+ selectedDetails = PreferenceManager.getList(this.detailsPreferenceKey);
+ selectedDetails.retainAll(availableDetails);
+
+ selectedPlainSchemas = PreferenceManager.getList(this.plainAttrsPreferenceKey);
+ selectedPlainSchemas.retainAll(availablePlainSchemas);
+
+ selectedDerSchemas = PreferenceManager.getList(this.derAttrsPreferenceKey);
+ selectedDerSchemas.retainAll(availableDerSchemas);
+
+ WebMarkupContainer container = new WebMarkupContainer("container");
+ container.setOutputMarkupId(true);
+ add(container);
+
+ AjaxPalettePanel<String> details = new AjaxPalettePanel.Builder<String>().
+ setAllowOrder(true).
+ setAllowMoveAll(true).
+ build("details", new PropertyModel<>(this, "selectedDetails"), new ListModel<>(availableDetails));
+ details.hideLabel();
+ details.setOutputMarkupId(true);
+ container.add(details);
+
+ AjaxPalettePanel<String> plainSchemas = new AjaxPalettePanel.Builder<String>().
+ setAllowOrder(true).
+ setAllowMoveAll(true).
+ build("plainSchemas", new PropertyModel<>(this, "selectedPlainSchemas"),
+ new ListModel<>(availablePlainSchemas));
+ plainSchemas.hideLabel();
+ plainSchemas.setOutputMarkupId(true);
+ container.add(plainSchemas);
+
+ AjaxPalettePanel<String> derSchemas = new AjaxPalettePanel.Builder<String>().
+ setAllowOrder(true).
+ setAllowMoveAll(true).
+ build("derSchemas", new PropertyModel<>(this, "selectedDerSchemas"),
+ new ListModel<>(availableDerSchemas));
+ derSchemas.hideLabel();
+ derSchemas.setOutputMarkupId(true);
+ container.add(derSchemas);
+ }
+
+ @Override
+ public void onSubmit(final AjaxRequestTarget target) {
+ if (selectedDetails.size() + selectedPlainSchemas.size() + selectedDerSchemas.size() > MAX_SELECTIONS) {
+ SyncopeConsoleSession.get().error(getString("tooManySelections"));
+ onError(target);
+ } else {
+ Map<String, List<String>> prefs = new HashMap<>();
+ prefs.put(detailsPreferenceKey, selectedDetails);
+ prefs.put(plainAttrsPreferenceKey, selectedPlainSchemas);
+ prefs.put(derAttrsPreferenceKey, selectedDerSchemas);
+ PreferenceManager.setList(prefs);
+
+ SyncopeConsoleSession.get().success(getString(Constants.OPERATION_SUCCEEDED));
+ modal.close(target);
+ ((BasePage) pageRef.getPage()).getNotificationPanel().refresh(target);
+ }
+ }
+}
diff --git a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/AnyDirectoryPanel.java b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/AnyDirectoryPanel.java
index 6cd3e3c010..45f5d16e2e 100644
--- a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/AnyDirectoryPanel.java
+++ b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/AnyDirectoryPanel.java
@@ -176,20 +176,20 @@ public abstract class AnyDirectoryPanel<A extends AnyTO, E extends AbstractAnyRe
new ResourceModel(Constants.KEY_FIELD_NAME, Constants.KEY_FIELD_NAME), Constants.KEY_FIELD_NAME));
List<IColumn<A, String>> prefcolumns = new ArrayList<>();
- PreferenceManager.getList(DisplayAttributesModalPanel.getPrefDetailView(type)).stream().
+ PreferenceManager.getList(AnyDisplayAttributesModalPanel.getPrefDetailView(type)).stream().
filter(name -> !Constants.KEY_FIELD_NAME.equalsIgnoreCase(name)).
forEach(name -> addPropertyColumn(
name,
- ReflectionUtils.findField(DisplayAttributesModalPanel.getTOClass(type), name),
+ ReflectionUtils.findField(AnyDisplayAttributesModalPanel.getTOClass(type), name),
prefcolumns));
- PreferenceManager.getList(DisplayAttributesModalPanel.getPrefPlainAttributeView(type)).stream().
+ PreferenceManager.getList(AnyDisplayAttributesModalPanel.getPrefPlainAttributeView(type)).stream().
map(a -> plainSchemas.stream().filter(p -> p.getKey().equals(a)).findFirst()).
flatMap(Optional::stream).
forEach(s -> prefcolumns.add(new AttrColumn<>(
s.getKey(), s.getLabel(SyncopeConsoleSession.get().getLocale()), SchemaType.PLAIN)));
- PreferenceManager.getList(DisplayAttributesModalPanel.getPrefDerivedAttributeView(type)).stream().
+ PreferenceManager.getList(AnyDisplayAttributesModalPanel.getPrefDerivedAttributeView(type)).stream().
map(a -> derSchemas.stream().filter(p -> p.getKey().equals(a)).findFirst()).
flatMap(Optional::stream).
forEach(s -> prefcolumns.add(new AttrColumn<>(
@@ -200,12 +200,12 @@ public abstract class AnyDirectoryPanel<A extends AnyTO, E extends AbstractAnyRe
for (String name : getDefaultAttributeSelection()) {
addPropertyColumn(
name,
- ReflectionUtils.findField(DisplayAttributesModalPanel.getTOClass(type), name),
+ ReflectionUtils.findField(AnyDisplayAttributesModalPanel.getTOClass(type), name),
prefcolumns);
}
PreferenceManager.setList(
- DisplayAttributesModalPanel.getPrefDetailView(type),
+ AnyDisplayAttributesModalPanel.getPrefDetailView(type),
List.of(getDefaultAttributeSelection()));
}
diff --git a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/AnyDisplayAttributesModalPanel.java b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/AnyDisplayAttributesModalPanel.java
new file mode 100644
index 0000000000..3d62cce046
--- /dev/null
+++ b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/AnyDisplayAttributesModalPanel.java
@@ -0,0 +1,84 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.apache.syncope.client.console.panels;
+
+import java.io.Serializable;
+import java.util.List;
+import org.apache.syncope.client.console.wicket.markup.html.bootstrap.dialog.BaseModal;
+import org.apache.syncope.client.ui.commons.Constants;
+import org.apache.syncope.common.lib.search.SearchableFields;
+import org.apache.syncope.common.lib.to.AnyObjectTO;
+import org.apache.syncope.common.lib.to.AnyTO;
+import org.apache.syncope.common.lib.to.GroupTO;
+import org.apache.syncope.common.lib.to.UserTO;
+import org.apache.syncope.common.lib.types.AnyTypeKind;
+import org.apache.wicket.PageReference;
+
+/**
+ * Modal window with Display attributes form.
+ *
+ * @param <T> can be {@link AnyTO} or {@link org.apache.syncope.client.ui.commons.wizards.any.AnyWrapper}
+ */
+public abstract class AnyDisplayAttributesModalPanel<T extends Serializable> extends AbstractDisplayModalPanel<T> {
+
+ private static final long serialVersionUID = -4274117450918385110L;
+
+ protected final String type;
+
+ protected AnyDisplayAttributesModalPanel(
+ final BaseModal<T> modal,
+ final PageReference pageRef,
+ final List<String> pSchemaNames,
+ final List<String> dSchemaNames,
+ final String type) {
+
+ super(
+ modal,
+ pageRef,
+ SearchableFields.get(getTOClass(type)).keySet().stream().toList(),
+ pSchemaNames,
+ dSchemaNames,
+ getPrefDetailView(type),
+ getPrefPlainAttributeView(type),
+ getPrefDerivedAttributeView(type));
+ this.type = type;
+ }
+
+ public static String getPrefDetailView(final String type) {
+ return String.format(Constants.PREF_ANY_DETAILS_VIEW, type);
+ }
+
+ public static String getPrefPlainAttributeView(final String type) {
+ return String.format(Constants.PREF_ANY_PLAIN_ATTRS_VIEW, type);
+ }
+
+ public static String getPrefDerivedAttributeView(final String type) {
+ return String.format(Constants.PREF_ANY_DER_ATTRS_VIEW, type);
+ }
+
+ public static Class<? extends AnyTO> getTOClass(final String type) {
+ if (type.equalsIgnoreCase(AnyTypeKind.USER.name())) {
+ return UserTO.class;
+ }
+ if (type.equalsIgnoreCase(AnyTypeKind.GROUP.name())) {
+ return GroupTO.class;
+ }
+ return AnyObjectTO.class;
+ }
+}
diff --git a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/AnyObjectDisplayAttributesModalPanel.java b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/AnyObjectDisplayAttributesModalPanel.java
index 4f619f337a..3801713fb8 100644
--- a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/AnyObjectDisplayAttributesModalPanel.java
+++ b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/AnyObjectDisplayAttributesModalPanel.java
@@ -29,7 +29,7 @@ import org.apache.wicket.PageReference;
* @param <T> can be {@link org.apache.syncope.common.lib.to.AnyTO} or
* {@link org.apache.syncope.client.ui.commons.wizards.any.AnyWrapper}
*/
-public class AnyObjectDisplayAttributesModalPanel<T extends Serializable> extends DisplayAttributesModalPanel<T> {
+public class AnyObjectDisplayAttributesModalPanel<T extends Serializable> extends AnyDisplayAttributesModalPanel<T> {
private static final long serialVersionUID = 5194630813773543054L;
diff --git a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/Realm.java b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/AnysPanel.java
similarity index 67%
rename from client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/Realm.java
rename to client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/AnysPanel.java
index fe9e6d21e8..5461c07c31 100644
--- a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/Realm.java
+++ b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/AnysPanel.java
@@ -24,10 +24,8 @@ import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
-import java.util.Set;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.tuple.Pair;
-import org.apache.syncope.client.console.SyncopeConsoleSession;
import org.apache.syncope.client.console.SyncopeWebApplication;
import org.apache.syncope.client.console.commons.ITabComponent;
import org.apache.syncope.client.console.commons.StatusProvider;
@@ -36,7 +34,6 @@ import org.apache.syncope.client.console.layout.AnyLayoutUtils;
import org.apache.syncope.client.console.rest.RealmRestClient;
import org.apache.syncope.client.console.rest.RoleRestClient;
import org.apache.syncope.client.console.wicket.markup.html.form.ActionLink;
-import org.apache.syncope.client.console.wicket.markup.html.form.ActionsPanel;
import org.apache.syncope.client.console.wizards.WizardMgtPanel;
import org.apache.syncope.client.console.wizards.any.ConnObjectPanel;
import org.apache.syncope.client.ui.commons.ConnIdSpecialName;
@@ -47,7 +44,6 @@ import org.apache.syncope.common.lib.to.PropagationStatus;
import org.apache.syncope.common.lib.to.ProvisioningResult;
import org.apache.syncope.common.lib.to.RealmTO;
import org.apache.syncope.common.lib.types.ExecStatus;
-import org.apache.syncope.common.lib.types.IdRepoEntitlement;
import org.apache.wicket.Component;
import org.apache.wicket.PageReference;
import org.apache.wicket.ajax.AjaxRequestTarget;
@@ -60,11 +56,11 @@ import org.apache.wicket.spring.injection.annot.SpringBean;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-public abstract class Realm extends WizardMgtPanel<RealmTO> {
+public abstract class AnysPanel extends WizardMgtPanel<RealmTO> {
private static final long serialVersionUID = -1100228004207271270L;
- protected static final Logger LOG = LoggerFactory.getLogger(Realm.class);
+ protected static final Logger LOG = LoggerFactory.getLogger(AnysPanel.class);
@SpringBean
protected RoleRestClient roleRestClient;
@@ -80,7 +76,7 @@ public abstract class Realm extends WizardMgtPanel<RealmTO> {
protected final RealmWizardBuilder wizardBuilder;
- public Realm(
+ public AnysPanel(
final String id,
final RealmTO realmTO,
final List<AnyTypeTO> anyTypes,
@@ -117,8 +113,6 @@ public abstract class Realm extends WizardMgtPanel<RealmTO> {
protected List<ITab> buildTabList(final PageReference pageRef) {
List<ITab> tabs = new ArrayList<>();
- tabs.add(new RealmDetailsTabPanel());
-
AnyLayout anyLayout = AnyLayoutUtils.fetch(roleRestClient, anyTypes.stream().map(AnyTypeTO::getKey).toList());
anyTypes.forEach(anyType -> {
tabs.add(new ITabComponent(
@@ -228,16 +222,6 @@ public abstract class Realm extends WizardMgtPanel<RealmTO> {
return mlp;
}
- protected abstract void onClickTemplate(AjaxRequestTarget target);
-
- protected abstract void onClickCreate(AjaxRequestTarget target);
-
- protected abstract void onClickEdit(AjaxRequestTarget target, RealmTO realmTO);
-
- protected abstract void onClickAudit(AjaxRequestTarget target, RealmTO realmTO);
-
- protected abstract void onClickDelete(AjaxRequestTarget target, RealmTO realmTO);
-
protected static class RemoteRealmPanel extends RemoteObjectPanel {
private static final long serialVersionUID = 4303365227411467563L;
@@ -258,94 +242,4 @@ public abstract class Realm extends WizardMgtPanel<RealmTO> {
return new StatusProvider.Info(bean.getBeforeObj(), bean.getAfterObj());
}
}
-
- protected class RealmDetailsTabPanel extends ITabComponent {
-
- private static final long serialVersionUID = -5861786415855103549L;
-
- protected RealmDetailsTabPanel() {
- super(new ResourceModel("realm.details", "DETAILS"),
- IdRepoEntitlement.REALM_CREATE, IdRepoEntitlement.REALM_UPDATE, IdRepoEntitlement.REALM_DELETE);
- }
-
- @Override
- public Panel getPanel(final String panelId) {
- ActionsPanel<RealmTO> actionPanel = new ActionsPanel<>("actions", null);
-
- if (securityCheck(Set.of(IdRepoEntitlement.REALM_CREATE))) {
- actionPanel.add(new ActionLink<>(realmTO) {
-
- private static final long serialVersionUID = 2802988981431379827L;
-
- @Override
- public void onClick(final AjaxRequestTarget target, final RealmTO ignore) {
- onClickCreate(target);
- }
- }, ActionLink.ActionType.CREATE, IdRepoEntitlement.REALM_CREATE).hideLabel();
- }
-
- if (securityCheck(Set.of(IdRepoEntitlement.REALM_UPDATE))) {
- actionPanel.add(new ActionLink<>(realmTO) {
-
- private static final long serialVersionUID = 2802988981431379828L;
-
- @Override
- public void onClick(final AjaxRequestTarget target, final RealmTO ignore) {
- onClickEdit(target, realmTO);
- }
- }, ActionLink.ActionType.EDIT, IdRepoEntitlement.REALM_UPDATE).hideLabel();
- }
-
- if (securityCheck(Set.of(IdRepoEntitlement.REALM_UPDATE))) {
- actionPanel.add(new ActionLink<>(realmTO) {
-
- private static final long serialVersionUID = 2802988981431379827L;
-
- @Override
- public void onClick(final AjaxRequestTarget target, final RealmTO ignore) {
- onClickTemplate(target);
- }
- }, ActionLink.ActionType.TEMPLATE, IdRepoEntitlement.REALM_UPDATE).hideLabel();
- }
-
- if (securityCheck(Set.of(IdRepoEntitlement.AUDIT_LIST))) {
- actionPanel.add(new ActionLink<>(realmTO) {
-
- private static final long serialVersionUID = 2802988981431379827L;
-
- @Override
- public void onClick(final AjaxRequestTarget target, final RealmTO ignore) {
- onClickAudit(target, realmTO);
- }
- }, ActionLink.ActionType.VIEW_AUDIT_HISTORY, IdRepoEntitlement.AUDIT_LIST).hideLabel();
- }
-
- if (securityCheck(Set.of(IdRepoEntitlement.REALM_DELETE))) {
- actionPanel.add(new ActionLink<>(realmTO) {
-
- private static final long serialVersionUID = 2802988981431379829L;
-
- @Override
- public void onClick(final AjaxRequestTarget target, final RealmTO ignore) {
- onClickDelete(target, realmTO);
- }
- }, ActionLink.ActionType.DELETE, IdRepoEntitlement.REALM_DELETE, true).hideLabel();
- }
-
- RealmDetails panel = new RealmDetails(panelId, realmTO, actionPanel, false);
- panel.setContentEnabled(false);
- actionPanel.setEnabled(true);
- return panel;
- }
-
- @Override
- public boolean isVisible() {
- return SyncopeWebApplication.get().getSecuritySettings().
- getAuthorizationStrategy().isActionAuthorized(this, RENDER);
- }
-
- private boolean securityCheck(final Set<String> entitlements) {
- return entitlements.stream().anyMatch(e -> SyncopeConsoleSession.get().owns(e, realmTO.getFullPath()));
- }
- }
}
diff --git a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/DirectoryPanel.java b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/DirectoryPanel.java
index 6ca58a9b1f..aac79c6e4d 100644
--- a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/DirectoryPanel.java
+++ b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/DirectoryPanel.java
@@ -180,7 +180,7 @@ public abstract class DirectoryPanel<
setWindowClosedReloadCallback(modal);
- altDefaultModal.size(Modal.Size.Default);
+ altDefaultModal.size(Modal.Size.Large);
setWindowClosedReloadCallback(altDefaultModal);
displayAttributeModal.size(Modal.Size.Default);
diff --git a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/DisplayAttributesModalPanel.java b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/DisplayAttributesModalPanel.java
deleted file mode 100644
index f8d057cdcd..0000000000
--- a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/DisplayAttributesModalPanel.java
+++ /dev/null
@@ -1,195 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.apache.syncope.client.console.panels;
-
-import java.io.Serializable;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.stream.Collectors;
-import org.apache.syncope.client.console.PreferenceManager;
-import org.apache.syncope.client.console.SyncopeConsoleSession;
-import org.apache.syncope.client.console.pages.BasePage;
-import org.apache.syncope.client.console.wicket.markup.html.bootstrap.dialog.BaseModal;
-import org.apache.syncope.client.ui.commons.Constants;
-import org.apache.syncope.client.ui.commons.markup.html.form.AjaxPalettePanel;
-import org.apache.syncope.common.lib.search.SearchableFields;
-import org.apache.syncope.common.lib.to.AnyObjectTO;
-import org.apache.syncope.common.lib.to.AnyTO;
-import org.apache.syncope.common.lib.to.GroupTO;
-import org.apache.syncope.common.lib.to.UserTO;
-import org.apache.syncope.common.lib.types.AnyTypeKind;
-import org.apache.wicket.PageReference;
-import org.apache.wicket.ajax.AjaxRequestTarget;
-import org.apache.wicket.markup.html.WebMarkupContainer;
-import org.apache.wicket.model.IModel;
-import org.apache.wicket.model.LoadableDetachableModel;
-import org.apache.wicket.model.PropertyModel;
-import org.apache.wicket.model.util.ListModel;
-
-/**
- * Modal window with Display attributes form.
- *
- * @param <T> can be {@link AnyTO} or {@link org.apache.syncope.client.ui.commons.wizards.any.AnyWrapper}
- */
-public abstract class DisplayAttributesModalPanel<T extends Serializable> extends AbstractModalPanel<T> {
-
- private static final long serialVersionUID = -4274117450918385110L;
-
- /**
- * Max allowed selections.
- */
- private static final int MAX_SELECTIONS = 9;
-
- private final List<String> selectedDetails;
-
- private final List<String> selectedPlainSchemas;
-
- private final List<String> selectedDerSchemas;
-
- protected final String type;
-
- public DisplayAttributesModalPanel(
- final BaseModal<T> modal,
- final PageReference pageRef,
- final List<String> pSchemaNames,
- final List<String> dSchemaNames,
- final String type) {
-
- super(modal, pageRef);
- this.type = type;
-
- Collections.sort(pSchemaNames);
- Collections.sort(dSchemaNames);
-
- final IModel<List<String>> fnames = new LoadableDetachableModel<>() {
-
- private static final long serialVersionUID = 5275935387613157437L;
-
- @Override
- protected List<String> load() {
- return SearchableFields.get(DisplayAttributesModalPanel.getTOClass(type))
- .keySet().stream().sorted().collect(Collectors.toList());
- }
- };
-
- IModel<List<String>> psnames = new LoadableDetachableModel<>() {
-
- private static final long serialVersionUID = 5275935387613157437L;
-
- @Override
- protected List<String> load() {
- return pSchemaNames;
- }
- };
-
- IModel<List<String>> dsnames = new LoadableDetachableModel<>() {
-
- private static final long serialVersionUID = 5275935387613157437L;
-
- @Override
- protected List<String> load() {
- return dSchemaNames;
- }
- };
-
- selectedDetails = PreferenceManager.getList(DisplayAttributesModalPanel.getPrefDetailView(type));
- selectedPlainSchemas = PreferenceManager.getList(DisplayAttributesModalPanel.getPrefPlainAttributeView(type));
- selectedDerSchemas = PreferenceManager.getList(DisplayAttributesModalPanel.getPrefDerivedAttributeView(type));
-
- // remove old schemas from selected lists
- selectedPlainSchemas.retainAll(pSchemaNames);
- selectedDerSchemas.retainAll(dSchemaNames);
-
- WebMarkupContainer container = new WebMarkupContainer("container");
- container.setOutputMarkupId(true);
- add(container);
-
- AjaxPalettePanel<String> details = new AjaxPalettePanel.Builder<String>().
- setAllowOrder(true).
- setAllowMoveAll(true).
- build("details",
- new PropertyModel<>(this, "selectedDetails"),
- new ListModel<>(fnames.getObject()));
- details.hideLabel();
- details.setOutputMarkupId(true);
- container.add(details);
-
- AjaxPalettePanel<String> plainSchemas = new AjaxPalettePanel.Builder<String>().
- setAllowOrder(true).
- setAllowMoveAll(true).
- build("plainSchemas",
- new PropertyModel<>(this, "selectedPlainSchemas"),
- new ListModel<>(psnames.getObject()));
- plainSchemas.hideLabel();
- plainSchemas.setOutputMarkupId(true);
- container.add(plainSchemas);
-
- AjaxPalettePanel<String> derSchemas = new AjaxPalettePanel.Builder<String>().
- setAllowOrder(true).
- setAllowMoveAll(true).
- build("derSchemas",
- new PropertyModel<>(this, "selectedDerSchemas"),
- new ListModel<>(dsnames.getObject()));
- derSchemas.hideLabel();
- derSchemas.setOutputMarkupId(true);
- container.add(derSchemas);
- }
-
- @Override
- public void onSubmit(final AjaxRequestTarget target) {
- if (selectedDetails.size() + selectedPlainSchemas.size() + selectedDerSchemas.size() > MAX_SELECTIONS) {
- SyncopeConsoleSession.get().error(getString("tooManySelections"));
- onError(target);
- } else {
- Map<String, List<String>> prefs = new HashMap<>();
- prefs.put(DisplayAttributesModalPanel.getPrefDetailView(type), selectedDetails);
- prefs.put(DisplayAttributesModalPanel.getPrefPlainAttributeView(type), selectedPlainSchemas);
- prefs.put(DisplayAttributesModalPanel.getPrefDerivedAttributeView(type), selectedDerSchemas);
- PreferenceManager.setList(prefs);
-
- SyncopeConsoleSession.get().success(getString(Constants.OPERATION_SUCCEEDED));
- modal.close(target);
- ((BasePage) pageRef.getPage()).getNotificationPanel().refresh(target);
- }
- }
-
- public static final String getPrefDetailView(final String type) {
- return String.format(Constants.PREF_ANY_DETAILS_VIEW, type);
- }
-
- public static final String getPrefPlainAttributeView(final String type) {
- return String.format(Constants.PREF_ANY_PLAIN_ATTRS_VIEW, type);
- }
-
- public static final String getPrefDerivedAttributeView(final String type) {
- return String.format(Constants.PREF_ANY_DER_ATTRS_VIEW, type);
- }
-
- public static final Class<? extends AnyTO> getTOClass(final String type) {
- if (type.equalsIgnoreCase(AnyTypeKind.USER.name())) {
- return UserTO.class;
- }
- if (type.equalsIgnoreCase(AnyTypeKind.GROUP.name())) {
- return GroupTO.class;
- }
- return AnyObjectTO.class;
- }
-}
diff --git a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/GroupDisplayAttributesModalPanel.java b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/GroupDisplayAttributesModalPanel.java
index 50771e0b3c..e6a0472d73 100644
--- a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/GroupDisplayAttributesModalPanel.java
+++ b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/GroupDisplayAttributesModalPanel.java
@@ -30,7 +30,7 @@ import org.apache.wicket.PageReference;
* @param <T> can be {@link org.apache.syncope.common.lib.to.AnyTO} or
* {@link org.apache.syncope.client.ui.commons.wizards.any.AnyWrapper}
*/
-public class GroupDisplayAttributesModalPanel<T extends Serializable> extends DisplayAttributesModalPanel<T> {
+public class GroupDisplayAttributesModalPanel<T extends Serializable> extends AnyDisplayAttributesModalPanel<T> {
private static final long serialVersionUID = 5194630813773543054L;
diff --git a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/RealmChoicePanel.java b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/RealmChoicePanel.java
index f0c88378dc..fb923999ff 100644
--- a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/RealmChoicePanel.java
+++ b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/RealmChoicePanel.java
@@ -47,7 +47,6 @@ import org.apache.syncope.common.lib.SyncopeConstants;
import org.apache.syncope.common.lib.to.RealmTO;
import org.apache.syncope.common.lib.types.IdRepoEntitlement;
import org.apache.syncope.common.rest.api.beans.RealmQuery;
-import org.apache.wicket.AttributeModifier;
import org.apache.wicket.PageReference;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.ajax.markup.html.AjaxLink;
@@ -177,10 +176,7 @@ public class RealmChoicePanel extends Panel {
@Override
protected void onInitialize() {
super.onInitialize();
- String fullPath = RealmsUtils.getFullPath(item.getModelObject());
- if (!SyncopeConstants.ROOT_REALM.equals(fullPath) && fullPath.lastIndexOf("/") == 0) {
- item.add(new AttributeModifier("class", "breadcrumb-item no-separator"));
- }
+ // MUI style breadcrumb doesn't need special separator handling
}
@Override
diff --git a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/RealmDetails.java b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/RealmDetails.java
index ef92135c97..2ec42d3f01 100644
--- a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/RealmDetails.java
+++ b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/RealmDetails.java
@@ -26,7 +26,6 @@ import org.apache.syncope.client.console.SyncopeWebApplication;
import org.apache.syncope.client.console.commons.RealmPolicyProvider;
import org.apache.syncope.client.console.rest.AnyTypeClassRestClient;
import org.apache.syncope.client.console.rest.ImplementationRestClient;
-import org.apache.syncope.client.console.wicket.markup.html.form.ActionsPanel;
import org.apache.syncope.client.ui.commons.Constants;
import org.apache.syncope.client.ui.commons.markup.html.form.AjaxGridFieldPanel;
import org.apache.syncope.client.ui.commons.markup.html.form.AjaxPalettePanel;
@@ -44,7 +43,6 @@ import org.apache.wicket.markup.html.panel.Panel;
import org.apache.wicket.markup.repeater.RepeatingView;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.LoadableDetachableModel;
-import org.apache.wicket.model.Model;
import org.apache.wicket.model.PropertyModel;
import org.apache.wicket.model.util.ListModel;
import org.apache.wicket.model.util.MapModel;
@@ -101,21 +99,16 @@ public class RealmDetails extends Panel {
protected final WebMarkupContainer container;
- public RealmDetails(final String id, final RealmTO realmTO) {
- this(id, realmTO, null, true);
- }
-
public RealmDetails(
final String id,
final RealmTO realmTO,
- final ActionsPanel<RealmTO> actionsPanel,
- final boolean unwrapped) {
+ final IModel<String> createParentPathModel) {
super(id);
container = new WebMarkupContainer("container");
container.setOutputMarkupId(true);
- container.setRenderBodyOnly(unwrapped);
+ container.setRenderBodyOnly(true);
add(container);
WebMarkupContainer generics = new WebMarkupContainer("generics");
@@ -124,23 +117,28 @@ public class RealmDetails extends Panel {
FieldPanel<String> name = new AjaxTextFieldPanel(
Constants.NAME_FIELD_NAME, Constants.NAME_FIELD_NAME,
new PropertyModel<>(realmTO, Constants.NAME_FIELD_NAME), false);
- generics.add(name.addRequiredLabel().setVisible(unwrapped));
+ generics.add(name.addRequiredLabel().setVisible(true));
+
+ IModel<String> parentModel = realmTO.getKey() == null && createParentPathModel != null
+ ? createParentPathModel
+ : new PropertyModel<>(realmTO, "parent");
+ FieldPanel<String> parent = new AjaxTextFieldPanel("parent", "parent", parentModel, false);
+ parent.setEnabled(realmTO.getKey() == null);
+ if (realmTO.getKey() == null) {
+ parent.addRequiredLabel();
+ }
+ generics.add(parent.setVisible(realmTO.getKey() == null));
FieldPanel<String> fullPath = new AjaxTextFieldPanel(
"fullPath", "fullPath", new PropertyModel<>(realmTO, "fullPath"), false);
fullPath.setEnabled(false);
- generics.add(fullPath.setVisible(unwrapped));
-
- if (unwrapped) {
- generics.add(new AjaxPalettePanel.Builder<String>().
- setAllowOrder(true).build(
- "anyTypeClasses",
- new PropertyModel<>(realmTO, "anyTypeClasses"),
- new ListModel<>(availableAnyTypeClasses.getObject())).setOutputMarkupId(true));
- } else {
- generics.add(new AjaxTextFieldPanel(
- "anyTypeClasses", "anyTypeClasses", Model.of(realmTO.getAnyTypeClasses().toString())));
- }
+ generics.add(fullPath.setVisible(realmTO.getKey() != null));
+
+ generics.add(new AjaxPalettePanel.Builder<String>().
+ setAllowOrder(true).build(
+ "anyTypeClasses",
+ new PropertyModel<>(realmTO, "anyTypeClasses"),
+ new ListModel<>(availableAnyTypeClasses.getObject())).setOutputMarkupId(true));
Map<String, String> attrs = realmTO.getPlainAttrs().stream().
sorted(Comparator.comparing(Attr::getSchema)).
@@ -149,44 +147,28 @@ public class RealmDetails extends Panel {
"plainAttrs",
"plainAttrs",
new MapModel<>(attrs),
- true).setOutputMarkupPlaceholderTag(true).setVisible(!unwrapped));
+ true).setOutputMarkupPlaceholderTag(true).setVisible(false));
RepeatingView policies = new RepeatingView("policies");
realmPolicyProvider.add(realmTO, policies);
container.add(policies);
- if (unwrapped) {
- container.add(new AjaxPalettePanel.Builder<String>().
- setAllowMoveAll(true).setAllowOrder(true).build(
- "actions",
- new PropertyModel<>(realmTO, "actions"),
- new ListModel<>(logicActions.getObject())).
- setOutputMarkupId(true));
- } else {
- container.add(new AjaxTextFieldPanel(
- "actions", "actions", Model.of(realmTO.getActions().toString())));
- }
-
- if (unwrapped) {
- container.add(new AjaxPalettePanel.Builder<String>().build(
- "resources",
- new PropertyModel<>(realmTO, "resources"),
- new ListModel<>(resources.getObject())).
- setOutputMarkupId(true).
- setEnabled(!SyncopeConstants.ROOT_REALM.equals(realmTO.getName())).
- setVisible(!SyncopeConstants.ROOT_REALM.equals(realmTO.getName())));
- } else {
- container.add(new AjaxTextFieldPanel(
- "resources", "resources", Model.of(realmTO.getResources().toString())));
- }
-
- if (actionsPanel == null) {
- add(new Fragment("actionsPanel", "emptyFragment", this).setRenderBodyOnly(true));
- } else {
- Fragment fragment = new Fragment("actionsPanel", "actionsFragment", this);
- fragment.add(actionsPanel);
- add(fragment.setRenderBodyOnly(true));
- }
+ container.add(new AjaxPalettePanel.Builder<String>().
+ setAllowMoveAll(true).setAllowOrder(true).build(
+ "actions",
+ new PropertyModel<>(realmTO, "actions"),
+ new ListModel<>(logicActions.getObject())).
+ setOutputMarkupId(true));
+
+ container.add(new AjaxPalettePanel.Builder<String>().build(
+ "resources",
+ new PropertyModel<>(realmTO, "resources"),
+ new ListModel<>(resources.getObject())).
+ setOutputMarkupId(true).
+ setEnabled(!SyncopeConstants.ROOT_REALM.equals(realmTO.getName())).
+ setVisible(!SyncopeConstants.ROOT_REALM.equals(realmTO.getName())));
+
+ add(new Fragment("actionsPanel", "emptyFragment", this).setRenderBodyOnly(true));
}
public RealmDetails setContentEnabled(final boolean enable) {
diff --git a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/RealmDirectoryPanel.java b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/RealmDirectoryPanel.java
new file mode 100644
index 0000000000..35803257ab
--- /dev/null
+++ b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/RealmDirectoryPanel.java
@@ -0,0 +1,627 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.apache.syncope.client.console.panels;
+
+import de.agilecoders.wicket.core.markup.html.bootstrap.dialog.Modal;
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Optional;
+import org.apache.commons.lang3.SerializationUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.lang3.tuple.Pair;
+import org.apache.syncope.client.console.PreferenceManager;
+import org.apache.syncope.client.console.SyncopeConsoleSession;
+import org.apache.syncope.client.console.SyncopeWebApplication;
+import org.apache.syncope.client.console.audit.AuditHistoryModal;
+import org.apache.syncope.client.console.commons.DirectoryDataProvider;
+import org.apache.syncope.client.console.commons.IdRepoConstants;
+import org.apache.syncope.client.console.commons.RealmsUtils;
+import org.apache.syncope.client.console.commons.StatusProvider;
+import org.apache.syncope.client.console.pages.Anys;
+import org.apache.syncope.client.console.pages.BasePage;
+import org.apache.syncope.client.console.rest.AuditRestClient;
+import org.apache.syncope.client.console.rest.RealmRestClient;
+import org.apache.syncope.client.console.rest.SchemaRestClient;
+import org.apache.syncope.client.console.tasks.RealmPropagationTasks;
+import org.apache.syncope.client.console.tasks.TemplatesTogglePanel;
+import org.apache.syncope.client.console.wicket.extensions.markup.html.repeater.data.table.AttrColumn;
+import org.apache.syncope.client.console.wicket.extensions.markup.html.repeater.data.table.KeyPropertyColumn;
+import org.apache.syncope.client.console.wicket.markup.html.bootstrap.dialog.BaseModal;
+import org.apache.syncope.client.console.wicket.markup.html.form.ActionLink;
+import org.apache.syncope.client.console.wicket.markup.html.form.ActionsPanel;
+import org.apache.syncope.client.console.wizards.any.ConnObjectPanel;
+import org.apache.syncope.client.ui.commons.ConnIdSpecialName;
+import org.apache.syncope.client.ui.commons.Constants;
+import org.apache.syncope.client.ui.commons.status.StatusUtils;
+import org.apache.syncope.client.ui.commons.wizards.AjaxWizard;
+import org.apache.syncope.common.lib.SyncopeConstants;
+import org.apache.syncope.common.lib.to.DerSchemaTO;
+import org.apache.syncope.common.lib.to.PlainSchemaTO;
+import org.apache.syncope.common.lib.to.PropagationStatus;
+import org.apache.syncope.common.lib.to.ProvisioningResult;
+import org.apache.syncope.common.lib.to.RealmTO;
+import org.apache.syncope.common.lib.types.ExecStatus;
+import org.apache.syncope.common.lib.types.IdRepoEntitlement;
+import org.apache.syncope.common.lib.types.OpEvent;
+import org.apache.syncope.common.lib.types.SchemaType;
+import org.apache.syncope.common.rest.api.beans.RealmQuery;
+import org.apache.wicket.Component;
+import org.apache.wicket.PageReference;
+import org.apache.wicket.ajax.AjaxRequestTarget;
+import org.apache.wicket.authroles.authorization.strategies.role.metadata.MetaDataRoleAuthorizationStrategy;
+import org.apache.wicket.event.Broadcast;
+import org.apache.wicket.event.IEvent;
+import org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn;
+import org.apache.wicket.extensions.markup.html.repeater.data.table.PropertyColumn;
+import org.apache.wicket.markup.html.basic.Label;
+import org.apache.wicket.markup.html.panel.Panel;
+import org.apache.wicket.model.CompoundPropertyModel;
+import org.apache.wicket.model.IModel;
+import org.apache.wicket.model.Model;
+import org.apache.wicket.model.ResourceModel;
+import org.apache.wicket.model.StringResourceModel;
+import org.apache.wicket.request.cycle.RequestCycle;
+import org.apache.wicket.request.mapper.parameter.PageParameters;
+import org.apache.wicket.spring.injection.annot.SpringBean;
+
+public class RealmDirectoryPanel
+ extends DirectoryPanel<RealmTO, RealmTO, RealmDirectoryPanel.RealmDataProvider, RealmRestClient> {
+
+ private static final long serialVersionUID = -619348700593732362L;
+
+ @SpringBean
+ protected SchemaRestClient schemaRestClient;
+
+ @SpringBean
+ protected AuditRestClient auditRestClient;
+
+ protected final List<PlainSchemaTO> plainSchemas = new ArrayList<>();
+
+ protected final List<DerSchemaTO> derSchemas = new ArrayList<>();
+
+ protected final BaseModal<Serializable> utilityModal = new BaseModal<>(Constants.OUTER);
+
+ protected final RealmWizardBuilder wizardBuilder;
+
+ protected final Model<String> base = Model.of(StringUtils.EMPTY);
+
+ protected final Model<String> fiql = Model.of(StringUtils.EMPTY);
+
+ public RealmDirectoryPanel(final String id, final RealmRestClient restClient, final PageReference pageRef) {
+ super(id, restClient, pageRef, true, true);
+
+ plainSchemas.addAll(schemaRestClient.getSchemas(SchemaType.PLAIN, null, new String[0]));
+ derSchemas.addAll(schemaRestClient.getSchemas(SchemaType.DERIVED, null, new String[0]));
+
+ disableCheckBoxes();
+ setShowResultPanel(true);
+
+ utilityModal.size(Modal.Size.Large);
+ addOuterObject(utilityModal);
+ setWindowClosedReloadCallback(utilityModal);
+
+ modal.size(Modal.Size.Large);
+ wizardBuilder = new RealmWizardBuilder(restClient, pageRef);
+ addNewItemPanelBuilder(wizardBuilder, true);
+ MetaDataRoleAuthorizationStrategy.authorize(addAjaxLink, RENDER, IdRepoEntitlement.REALM_CREATE);
+
+ initResultTable();
+ }
+
+ @Override
+ protected RealmDataProvider dataProvider() {
+ return new RealmDataProvider(rows);
+ }
+
+ public void search(final String base, final String fiql, final AjaxRequestTarget target) {
+ this.base.setObject(StringUtils.trimToEmpty(base));
+ this.fiql.setObject(StringUtils.trimToEmpty(fiql));
+ if (dataProvider != null) {
+ dataProvider.setBase(this.base.getObject());
+ dataProvider.setFIQL(this.fiql.getObject());
+ }
+ super.search(target);
+ }
+
+ public void search(final String fiql, final AjaxRequestTarget target) {
+ search(StringUtils.EMPTY, fiql, target);
+ }
+
+ @Override
+ protected String paginatorRowsKey() {
+ return IdRepoConstants.PREF_REALM_PAGINATOR_ROWS;
+ }
+
+ @Override
+ protected List<IColumn<RealmTO, String>> getColumns() {
+ List<String> selectedColumns = PreferenceManager.getList(IdRepoConstants.PREF_REALM_DETAILS_VIEW);
+ selectedColumns.retainAll(RealmDisplayAttributesModalPanel.AVAILABLE_COLUMNS);
+ if (selectedColumns.isEmpty()) {
+ selectedColumns = new ArrayList<>(RealmDisplayAttributesModalPanel.DEFAULT_COLUMNS);
+ PreferenceManager.setList(IdRepoConstants.PREF_REALM_DETAILS_VIEW, selectedColumns);
+ }
+ List<String> selectedPlainSchemas = PreferenceManager.getList(IdRepoConstants.PREF_REALM_PLAIN_ATTRS_VIEW);
+ selectedPlainSchemas.retainAll(plainSchemas.stream().map(PlainSchemaTO::getKey).toList());
+
+ List<String> selectedDerSchemas = PreferenceManager.getList(IdRepoConstants.PREF_REALM_DER_ATTRS_VIEW);
+ selectedDerSchemas.retainAll(derSchemas.stream().map(DerSchemaTO::getKey).toList());
+
+ List<IColumn<RealmTO, String>> columns = new ArrayList<>();
+ selectedColumns.forEach(column -> addPropertyColumn(column, columns));
+ plainSchemas.stream().
+ filter(schema -> selectedPlainSchemas.contains(schema.getKey())).
+ forEach(schema -> columns.add(new AttrColumn<>(
+ schema.getKey(), schema.getLabel(getLocale()), SchemaType.PLAIN)));
+
+ derSchemas.stream().
+ filter(schema -> selectedDerSchemas.contains(schema.getKey())).
+ forEach(schema -> columns.add(new AttrColumn<>(
+ schema.getKey(), schema.getLabel(getLocale()), SchemaType.DERIVED)));
+ return columns;
+ }
+
+ protected void addPropertyColumn(final String name, final List<IColumn<RealmTO, String>> columns) {
+ if (Constants.KEY_FIELD_NAME.equalsIgnoreCase(name)) {
+ columns.add(new KeyPropertyColumn<>(new StringResourceModel(Constants.KEY_FIELD_NAME, this), name));
+ } else {
+ columns.add(new PropertyColumn<>(new ResourceModel(name, name), name, name));
+ }
+ }
+
+ @Override
+ public ActionsPanel<Serializable> getHeader(final String componentId) {
+ final ActionsPanel<Serializable> panel = super.getHeader(componentId);
+ panel.add(new ActionLink<>() {
+
+ private static final long serialVersionUID = -8740543624521405980L;
+
+ @Override
+ public void onClick(final AjaxRequestTarget target, final Serializable ignore) {
+ target.add(displayAttributeModal.setContent(new RealmDisplayAttributesModalPanel<>(
+ displayAttributeModal,
+ page.getPageReference(),
+ RealmDisplayAttributesModalPanel.AVAILABLE_COLUMNS,
+ plainSchemas.stream().map(PlainSchemaTO::getKey).toList(),
+ derSchemas.stream().map(DerSchemaTO::getKey).toList())));
+ displayAttributeModal.header(new ResourceModel("any.attr.display"));
+ displayAttributeModal.show(true);
+ }
+ }, ActionLink.ActionType.CHANGE_VIEW, IdRepoEntitlement.REALM_SEARCH).hideLabel();
+ return panel;
+ }
+
+ @Override
+ protected Collection<ActionLink.ActionType> getBatches() {
+ return List.of();
+ }
+
+ @Override
+ public ActionsPanel<RealmTO> getActions(final IModel<RealmTO> model) {
+ ActionsPanel<RealmTO> panel = super.getActions(model);
+
+ panel.add(new ActionLink<>() {
+
+ private static final long serialVersionUID = 6459651989453003611L;
+
+ @Override
+ public void onClick(final AjaxRequestTarget target, final RealmTO realmTO) {
+ PageParameters parameters = new PageParameters();
+ parameters.add(Anys.INITIAL_REALM, realmTO.getFullPath());
+ setResponsePage(Anys.class, parameters);
+ }
+ }, ActionLink.ActionType.ZOOM_IN, IdRepoEntitlement.REALM_SEARCH, false).
+ setRealm(model.getObject().getFullPath());
+
+ panel.add(new ActionLink<>() {
+
+ private static final long serialVersionUID = 7596172676990094774L;
+
+ @Override
+ public void onClick(final AjaxRequestTarget target, final RealmTO realmTO) {
+ send(RealmDirectoryPanel.this, Broadcast.EXACT, new AjaxWizard.EditItemActionEvent<>(realmTO, target) {
+
+ @Override
+ public String getEventDescription() {
+ return "realm.edit";
+ }
+ });
+ }
+ }, ActionLink.ActionType.EDIT, IdRepoEntitlement.REALM_UPDATE, false).setRealm(model.getObject().getFullPath());
+
+ panel.add(new ActionLink<>() {
+
+ private static final long serialVersionUID = -4956983251621530095L;
+
+ @Override
+ public void onClick(final AjaxRequestTarget target, final RealmTO realmTO) {
+ wizardBuilder.setParentPath(realmTO.getFullPath());
+
+ send(RealmDirectoryPanel.this,
+ Broadcast.EXACT,
+ new AjaxWizard.NewItemActionEvent<>(new RealmTO(), target) {
+
+ @Override
+ public String getEventDescription() {
+ return "realm.new";
+ }
+ });
+ }
+
+ @Override
+ protected boolean statusCondition(final RealmTO realmTO) {
+ return StringUtils.isNotBlank(realmTO.getKey());
+ }
+ }, ActionLink.ActionType.CREATE, IdRepoEntitlement.REALM_CREATE, false)
+ .setRealm(model.getObject().getFullPath());
+
+ panel.add(new ActionLink<>() {
+
+ private static final long serialVersionUID = -6115685745909501940L;
+
+ @Override
+ public void onClick(final AjaxRequestTarget target, final RealmTO realmTO) {
+ target.add(utilityModal.setContent(new RealmPropagationTasks(
+ utilityModal, realmTO.getKey(), pageRef)));
+ utilityModal.header(new StringResourceModel("realm.propagation.tasks", model));
+ utilityModal.show(true);
+ }
+
+ @Override
+ protected boolean statusCondition(final RealmTO realmTO) {
+ return StringUtils.isNotBlank(realmTO.getKey());
+ }
+ }, ActionLink.ActionType.PROPAGATION_TASKS, IdRepoEntitlement.TASK_LIST)
+ .setRealm(model.getObject().getFullPath());
+
+ panel.add(new ActionLink<>() {
+
+ private static final long serialVersionUID = 6267403882972164669L;
+
+ @Override
+ public void onClick(final AjaxRequestTarget target, final RealmTO ignore) {
+ target.add(altDefaultModal.setContent(new AuditHistoryModal<>(
+ OpEvent.CategoryType.LOGIC,
+ "RealmLogic",
+ model.getObject(),
+ IdRepoEntitlement.REALM_UPDATE,
+ auditRestClient) {
+
+ private static final long serialVersionUID = -2209244156234833875L;
+
+ @Override
+ protected void restore(final String json, final AjaxRequestTarget target) {
+ try {
+ RealmTO updated = MAPPER.readValue(json, RealmTO.class);
+ ProvisioningResult<RealmTO> result = restClient.update(updated);
+ model.getObject().setFullPath(result.getEntity().getFullPath());
+ SyncopeConsoleSession.get().success(getString(Constants.OPERATION_SUCCEEDED));
+ target.add(container);
+ } catch (Exception e) {
+ LOG.error("While restoring realm {}", model.getObject().getKey(), e);
+ SyncopeConsoleSession.get().onException(e);
+ }
+ ((BasePage) pageRef.getPage()).getNotificationPanel().refresh(target);
+ }
+ }));
+
+ altDefaultModal.header(new StringResourceModel("realm.auditHistory.title", model));
+ altDefaultModal.show(true);
+ }
+ }, ActionLink.ActionType.VIEW_AUDIT_HISTORY,
+ String.format("%s,%s", IdRepoEntitlement.REALM_UPDATE, IdRepoEntitlement.AUDIT_LIST)).
+ setRealm(model.getObject().getFullPath());
+
+ panel.add(new ActionLink<>() {
+
+ private static final long serialVersionUID = 6267403882972164669L;
+
+ @Override
+ public void onClick(final AjaxRequestTarget target, final RealmTO realmTO) {
+ actionTogglePanel.close(target);
+ send(RealmDirectoryPanel.this, Broadcast.BUBBLE,
+ new TemplatesTogglePanel.ShowTemplatesTogglePanelEvent(realmTO, target));
+ }
+ }, ActionLink.ActionType.TEMPLATE, IdRepoEntitlement.REALM_UPDATE).setRealm(model.getObject().getFullPath());
+
+ panel.add(new ActionLink<>() {
+
+ private static final long serialVersionUID = -8998343172643697605L;
+
+ @Override
+ public void onClick(final AjaxRequestTarget target, final RealmTO realmTO) {
+ RealmTO clone = SerializationUtils.clone(realmTO);
+ clone.setKey(null);
+ clone.setFullPath(null);
+ clone.setName(realmTO.getName() + "_clone");
+ clone.getActions().clear();
+
+ String parentPath = StringUtils.substringBeforeLast(
+ StringUtils.defaultString(realmTO.getFullPath()), "/");
+ wizardBuilder.setParentPath(StringUtils.isBlank(parentPath) ? "/" : parentPath);
+ send(RealmDirectoryPanel.this, Broadcast.EXACT, new AjaxWizard.NewItemActionEvent<>(clone, target) {
+
+ @Override
+ public String getEventDescription() {
+ return "realm.new";
+ }
+ });
+ }
+
+ @Override
+ protected boolean statusCondition(final RealmTO realmTO) {
+ return StringUtils.isNotBlank(realmTO.getKey()) && StringUtils.isNotBlank(realmTO.getFullPath());
+ }
+ }, ActionLink.ActionType.CLONE, IdRepoEntitlement.REALM_CREATE).setRealm(model.getObject().getFullPath());
+
+ panel.add(new ActionLink<>() {
+
+ private static final long serialVersionUID = 5649072994971851604L;
+
+ @Override
+ public void onClick(final AjaxRequestTarget target, final RealmTO realmTO) {
+ try {
+ restClient.delete(realmTO.getFullPath());
+ SyncopeConsoleSession.get().success(getString(Constants.OPERATION_SUCCEEDED));
+ target.add(container);
+ } catch (Exception e) {
+ LOG.error("While deleting realm {}", realmTO.getFullPath(), e);
+ SyncopeConsoleSession.get().onException(e);
+ }
+ ((BasePage) pageRef.getPage()).getNotificationPanel().refresh(target);
+ }
+
+ @Override
+ protected boolean statusCondition(final RealmTO realmTO) {
+ return StringUtils.isNotBlank(realmTO.getKey());
+ }
+ }, ActionLink.ActionType.DELETE, IdRepoEntitlement.REALM_DELETE, true)
+ .setRealm(model.getObject().getFullPath());
+
+ return panel;
+ }
+
+ @Override
+ protected Panel customResultBody(final String panelId, final RealmTO item, final Serializable result) {
+ if (!(result instanceof ProvisioningResult<?> provisioningResult)) {
+ throw new IllegalStateException("Unsupported result type");
+ }
+
+ MultilevelPanel mlp = new MultilevelPanel(panelId);
+ add(mlp);
+
+ PropagationStatus syncope = new PropagationStatus();
+ syncope.setStatus(ExecStatus.SUCCESS);
+ syncope.setResource(Constants.SYNCOPE);
+
+ List<PropagationStatus> propagations = new ArrayList<>();
+ propagations.add(syncope);
+ propagations.addAll(provisioningResult.getPropagationStatuses());
+
+ ListViewPanel.Builder<PropagationStatus> builder =
+ new ListViewPanel.Builder<>(PropagationStatus.class, pageRef) {
+
+ private static final long serialVersionUID = -6809736686861678498L;
+
+ @Override
+ protected Component getValueComponent(final String key, final PropagationStatus bean) {
+ if ("objectLink".equalsIgnoreCase(key)) {
+ String remoteId = Optional.ofNullable(bean.getAfterObj()).
+ flatMap(afterObj -> afterObj.getAttr(ConnIdSpecialName.NAME).
+ filter(s -> !s.getValues().isEmpty()).map(s -> s.getValues().getFirst())).
+ orElse(StringUtils.EMPTY);
+
+ return new Label("field", remoteId);
+ }
+
+ if ("status".equalsIgnoreCase(key)) {
+ return StatusUtils.getStatusImagePanel("field", bean.getStatus());
+ }
+
+ return super.getValueComponent(key, bean);
+ }
+ };
+
+ builder.setItems(propagations);
+
+ builder.includes("resource", "objectLink", "status");
+ builder.withChecks(ListViewPanel.CheckAvailability.NONE);
+ builder.setReuseItem(false);
+
+ ActionLink<PropagationStatus> connObjectLink = new ActionLink<>() {
+
+ private static final long serialVersionUID = -3722207913631435501L;
+
+ @Override
+ protected boolean statusCondition(final PropagationStatus bean) {
+ return !Constants.SYNCOPE.equals(bean.getResource())
+ && (ExecStatus.CREATED == bean.getStatus()
+ || ExecStatus.SUCCESS == bean.getStatus());
+ }
+
+ @Override
+ public void onClick(final AjaxRequestTarget target, final PropagationStatus status) {
+ mlp.next(status.getResource(), new RemoteRealmPanel(status), target);
+ }
+ };
+ SyncopeWebApplication.get().getStatusProvider().addConnObjectLink(builder, connObjectLink);
+
+ builder.addAction(new ActionLink<>() {
+
+ private static final long serialVersionUID = -3722207913631435501L;
+
+ @Override
+ protected boolean statusCondition(final PropagationStatus status) {
+ return StringUtils.isNotBlank(status.getFailureReason());
+ }
+
+ @Override
+ public void onClick(final AjaxRequestTarget target, final PropagationStatus status) {
+ mlp.next(status.getResource(), new PropagationErrorPanel(status.getFailureReason()), target);
+ }
+ }, ActionLink.ActionType.PROPAGATION_TASKS, StringUtils.EMPTY);
+
+ mlp.setFirstLevel(builder.build(MultilevelPanel.FIRST_LEVEL_ID));
+ return mlp;
+ }
+
+ protected static class RemoteRealmPanel extends RemoteObjectPanel {
+
+ private static final long serialVersionUID = 4303365227411467563L;
+
+ protected final PropagationStatus bean;
+
+ protected RemoteRealmPanel(final PropagationStatus bean) {
+ this.bean = bean;
+ add(new ConnObjectPanel(
+ REMOTE_OBJECT_PANEL_ID,
+ Pair.of(new ResourceModel("before"), new ResourceModel("after")),
+ getStatusProviderInfo(),
+ false));
+ }
+
+ @Override
+ protected StatusProvider.Info getStatusProviderInfo() {
+ return new StatusProvider.Info(bean.getBeforeObj(), bean.getAfterObj());
+ }
+ }
+
+ @Override
+ public void onEvent(final IEvent<?> event) {
+ if (event.getPayload() instanceof AjaxWizard.NewItemActionEvent<?> actionEvent
+ && actionEvent.getItem() == null) {
+ actionEvent.getTarget().ifPresent(target -> {
+ wizardBuilder.setParent(null);
+ wizardBuilder.setParentPath(StringUtils.isBlank(base.getObject())
+ ? SyncopeConstants.ROOT_REALM
+ : StringUtils.trim(base.getObject()));
+
+ send(this, Broadcast.EXACT, new AjaxWizard.NewItemActionEvent<RealmTO>(new RealmTO(), target) {
+
+ @Override
+ public String getEventDescription() {
+ return "realm.new";
+ }
+ });
+ });
+ return;
+ }
+
+ super.onEvent(event);
+ }
+
+ protected class RealmDataProvider extends DirectoryDataProvider<RealmTO> {
+
+ private static final long serialVersionUID = 2400683093229736283L;
+
+ protected String base;
+
+ protected String fiql;
+
+ protected int currentPage;
+
+ protected boolean searchErrorNotified;
+
+ RealmDataProvider(final int paginatorRows) {
+ super(paginatorRows);
+ base = RealmDirectoryPanel.this.base.getObject();
+ fiql = RealmDirectoryPanel.this.fiql.getObject();
+ }
+
+ void setBase(final String base) {
+ this.base = base;
+ this.searchErrorNotified = false;
+ }
+
+ void setFIQL(final String fiql) {
+ this.fiql = fiql;
+ this.searchErrorNotified = false;
+ }
+
+ @Override
+ public Iterator<RealmTO> iterator(final long first, final long count) {
+ try {
+ currentPage = ((int) first / paginatorRows);
+ if (currentPage < 0) {
+ currentPage = 0;
+ }
+
+ RealmQuery query = buildQuery();
+ query.setPage(currentPage + 1);
+ query.setSize((int) count);
+ if (getSort() != null && StringUtils.isNotBlank(getSort().getProperty())) {
+ query.setOrderBy(getSort().getProperty() + (getSort().isAscending() ? " ASC" : " DESC"));
+ }
+
+ Iterator<RealmTO> iterator = restClient.search(query).getResult().iterator();
+ searchErrorNotified = false;
+ return iterator;
+ } catch (Exception e) {
+ handleSearchException(e);
+ return Collections.emptyIterator();
+ }
+ }
+
+ @Override
+ public long size() {
+ try {
+ RealmQuery query = buildQuery();
+ query.setPage(1);
+ query.setSize(1);
+ long totalCount = restClient.search(query).getTotalCount();
+ searchErrorNotified = false;
+ return totalCount;
+ } catch (Exception e) {
+ handleSearchException(e);
+ return 0;
+ }
+ }
+
+ @Override
+ public IModel<RealmTO> model(final RealmTO object) {
+ return new CompoundPropertyModel<>(object);
+ }
+
+ protected RealmQuery buildQuery() {
+ RealmQuery query;
+ if (StringUtils.isBlank(base)) {
+ query = RealmsUtils.buildBaseQuery();
+ } else {
+ query = new RealmQuery.Builder().base(StringUtils.trim(base)).build();
+ }
+ if (StringUtils.isNotBlank(fiql)) {
+ query.setFiql(StringUtils.trim(fiql));
+ }
+ return query;
+ }
+
+ protected void handleSearchException(final Exception e) {
+ LOG.error("While searching realms with base {} and FIQL {}", base, fiql, e);
+ if (!searchErrorNotified) {
+ searchErrorNotified = true;
+ SyncopeConsoleSession.get().error(e.getMessage());
+ RequestCycle.get().find(AjaxRequestTarget.class)
+ .ifPresent(target -> ((BasePage) pageRef.getPage()).getNotificationPanel().refresh(target));
+ }
+ }
+ }
+}
diff --git a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/RealmDisplayAttributesModalPanel.java b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/RealmDisplayAttributesModalPanel.java
new file mode 100644
index 0000000000..018b9cc668
--- /dev/null
+++ b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/RealmDisplayAttributesModalPanel.java
@@ -0,0 +1,78 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.apache.syncope.client.console.panels;
+
+import java.io.Serializable;
+import java.lang.reflect.Field;
+import java.lang.reflect.Modifier;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Set;
+import org.apache.syncope.client.console.commons.IdRepoConstants;
+import org.apache.syncope.client.console.wicket.markup.html.bootstrap.dialog.BaseModal;
+import org.apache.syncope.client.ui.commons.Constants;
+import org.apache.syncope.common.lib.to.RealmTO;
+import org.apache.wicket.PageReference;
+
+public class RealmDisplayAttributesModalPanel<T extends Serializable> extends AbstractDisplayModalPanel<T> {
+
+ protected static final Set<String> EXCLUDED_COLUMNS = Set.of(
+ "parent",
+ "plainAttrs",
+ "derAttrs",
+ "templates",
+ "accountPolicy",
+ "passwordPolicy",
+ "authPolicy",
+ "accessPolicy",
+ "attrReleasePolicy",
+ "ticketExpirationPolicy");
+
+ protected static final List<String> DEFAULT_COLUMNS = List.of(
+ Constants.KEY_FIELD_NAME,
+ Constants.NAME_FIELD_NAME,
+ "fullPath",
+ "anyTypeClasses");
+
+ protected static final List<String> AVAILABLE_COLUMNS = Arrays.stream(RealmTO.class.getDeclaredFields()).
+ filter(field -> !Modifier.isStatic(field.getModifiers())).
+ map(Field::getName).
+ filter(fieldName -> !EXCLUDED_COLUMNS.contains(fieldName)).
+ toList();
+
+ private static final long serialVersionUID = 4055453846383559861L;
+
+ public RealmDisplayAttributesModalPanel(
+ final BaseModal<T> modal,
+ final PageReference pageRef,
+ final List<String> availableDetails,
+ final List<String> availablePlainSchemas,
+ final List<String> availableDerSchemas) {
+
+ super(
+ modal,
+ pageRef,
+ availableDetails,
+ availablePlainSchemas,
+ availableDerSchemas,
+ IdRepoConstants.PREF_REALM_DETAILS_VIEW,
+ IdRepoConstants.PREF_REALM_PLAIN_ATTRS_VIEW,
+ IdRepoConstants.PREF_REALM_DER_ATTRS_VIEW);
+ }
+}
diff --git a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/RealmWizardBuilder.java b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/RealmWizardBuilder.java
index 4639589d00..f442aec41b 100644
--- a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/RealmWizardBuilder.java
+++ b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/RealmWizardBuilder.java
@@ -21,17 +21,20 @@ package org.apache.syncope.client.console.panels;
import java.io.Serializable;
import java.util.List;
import java.util.Optional;
+import org.apache.commons.lang3.StringUtils;
import org.apache.syncope.client.console.rest.RealmRestClient;
import org.apache.syncope.client.console.wizards.BaseAjaxWizardBuilder;
import org.apache.syncope.client.console.wizards.any.DerAttrs;
import org.apache.syncope.client.console.wizards.any.PlainAttrs;
import org.apache.syncope.client.ui.commons.wizards.any.AnyWrapper;
+import org.apache.syncope.common.lib.SyncopeConstants;
import org.apache.syncope.common.lib.to.RealmTO;
import org.apache.wicket.PageReference;
import org.apache.wicket.behavior.AttributeAppender;
import org.apache.wicket.extensions.wizard.WizardModel;
import org.apache.wicket.extensions.wizard.WizardModel.ICondition;
import org.apache.wicket.extensions.wizard.WizardStep;
+import org.apache.wicket.model.PropertyModel;
import org.apache.wicket.model.ResourceModel;
public class RealmWizardBuilder extends BaseAjaxWizardBuilder<RealmTO> {
@@ -51,6 +54,8 @@ public class RealmWizardBuilder extends BaseAjaxWizardBuilder<RealmTO> {
protected RealmTO parent;
+ protected String parentPath;
+
public RealmWizardBuilder(final RealmRestClient realmRestClient, final PageReference pageRef) {
super(new RealmTO(), pageRef);
this.realmRestClient = realmRestClient;
@@ -60,18 +65,48 @@ public class RealmWizardBuilder extends BaseAjaxWizardBuilder<RealmTO> {
this.parent = parent;
}
+ public String getParentPath() {
+ return parentPath;
+ }
+
+ public void setParentPath(final String parentPath) {
+ this.parentPath = parentPath;
+ }
+
@Override
protected Serializable onApplyInternal(final RealmTO modelObject) {
- return parent == null
- ? realmRestClient.update(modelObject)
- : realmRestClient.create(parent.getFullPath(), modelObject);
+ if (modelObject.getKey() == null) {
+ String effectiveParentPath = StringUtils.trimToNull(parentPath);
+ if (effectiveParentPath == null && parent != null) {
+ effectiveParentPath = parent.getFullPath();
+ }
+ if (effectiveParentPath == null) {
+ effectiveParentPath = SyncopeConstants.ROOT_REALM;
+ }
+ return realmRestClient.create(effectiveParentPath, modelObject);
+ }
+
+ return realmRestClient.update(modelObject);
}
@Override
protected WizardModel buildModelSteps(final RealmTO modelObject, final WizardModel wizardModel) {
+ if (modelObject.getKey() == null && StringUtils.isBlank(parentPath)) {
+ if (parent != null && StringUtils.isNotBlank(parent.getFullPath())) {
+ parentPath = parent.getFullPath();
+ } else {
+ parentPath = SyncopeConstants.ROOT_REALM;
+ }
+ }
+
Optional.ofNullable(parent).ifPresent(p -> modelObject.getAnyTypeClasses().addAll(p.getAnyTypeClasses()));
- RealmDetails details = new RealmDetails("details", modelObject);
+ RealmDetails details = new RealmDetails(
+ "details",
+ modelObject,
+ modelObject.getKey() == null
+ ? new PropertyModel<>(this, "parentPath")
+ : null);
details.add(new AttributeAppender("style", "overflow-x:hidden;"));
wizardModel.add(new Realm(details));
diff --git a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/UserDisplayAttributesModalPanel.java b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/UserDisplayAttributesModalPanel.java
index 5e5f01dd3d..7863e292f0 100644
--- a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/UserDisplayAttributesModalPanel.java
+++ b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/UserDisplayAttributesModalPanel.java
@@ -30,7 +30,7 @@ import org.apache.wicket.PageReference;
* @param <T> can be {@link org.apache.syncope.common.lib.to.AnyTO} or
* {@link org.apache.syncope.client.ui.commons.wizards.any.AnyWrapper}
*/
-public class UserDisplayAttributesModalPanel<T extends Serializable> extends DisplayAttributesModalPanel<T> {
+public class UserDisplayAttributesModalPanel<T extends Serializable> extends AnyDisplayAttributesModalPanel<T> {
private static final long serialVersionUID = 5194630813773543054L;
diff --git a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/search/AbstractAnySearchPanel.java b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/search/AbstractAnySearchPanel.java
new file mode 100644
index 0000000000..708d6574b8
--- /dev/null
+++ b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/search/AbstractAnySearchPanel.java
@@ -0,0 +1,117 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.apache.syncope.client.console.panels.search;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import org.apache.commons.lang3.tuple.Pair;
+import org.apache.syncope.client.console.SyncopeConsoleSession;
+import org.apache.syncope.client.console.SyncopeWebApplication;
+import org.apache.syncope.client.console.rest.GroupRestClient;
+import org.apache.syncope.common.lib.SyncopeConstants;
+import org.apache.syncope.common.lib.search.SearchableFields;
+import org.apache.syncope.common.lib.to.PlainSchemaTO;
+import org.apache.syncope.common.lib.types.AnyTypeKind;
+import org.apache.syncope.common.lib.types.IdRepoEntitlement;
+import org.apache.wicket.model.IModel;
+import org.apache.wicket.model.LoadableDetachableModel;
+import org.apache.wicket.model.Model;
+import org.apache.wicket.spring.injection.annot.SpringBean;
+
+abstract class AbstractAnySearchPanel extends AbstractSearchPanel {
+
+ private static final long serialVersionUID = 5922413053568696414L;
+
+ @SpringBean
+ protected GroupRestClient groupRestClient;
+
+ protected final AnyTypeKind typeKind;
+
+ protected final String anyType;
+
+ protected AbstractAnySearchPanel(final String id, final AnyTypeKind kind, final Builder<?> builder) {
+ this(id, kind, kind.name(), builder);
+ }
+
+ protected AbstractAnySearchPanel(
+ final String id, final AnyTypeKind kind, final String type, final Builder<?> builder) {
+
+ super(id);
+ this.typeKind = kind;
+ this.anyType = type;
+ init(builder);
+ }
+
+ @Override
+ protected void populate() {
+ super.populate();
+
+ dnames = new LoadableDetachableModel<>() {
+
+ private static final long serialVersionUID = 5275935387613157437L;
+
+ @Override
+ protected Map<String, PlainSchemaTO> load() {
+ Map<String, PlainSchemaTO> dSchemaNames = new HashMap<>();
+ SearchableFields.get(typeKind.getTOClass()).forEach((key, type) -> {
+ PlainSchemaTO plainSchema = new PlainSchemaTO();
+ plainSchema.setType(type);
+ plainSchema.setKey(key);
+ dSchemaNames.put(key, plainSchema);
+ });
+ return dSchemaNames;
+ }
+ };
+
+ resourceNames = new LoadableDetachableModel<>() {
+
+ private static final long serialVersionUID = 5275935387613157437L;
+
+ @Override
+ protected List<String> load() {
+ return SyncopeWebApplication.get().getResourceProvider().get(anyType);
+ }
+ };
+ }
+
+ @Override
+ protected Pair<IModel<List<String>>, IModel<Long>> getGroupInfo() {
+ return typeKind != AnyTypeKind.GROUP && SyncopeConsoleSession.get().owns(IdRepoEntitlement.GROUP_SEARCH)
+ ? Pair.of(groupNames, new LoadableDetachableModel<>() {
+
+ private static final long serialVersionUID = 7362833782319137329L;
+
+ @Override
+ protected Long load() {
+ return groupRestClient.count(SyncopeConstants.ROOT_REALM, null);
+ }
+ })
+ : Pair.of(groupNames, Model.of(0L));
+ }
+
+ @Override
+ protected String sanitizeFIQL(final String fiql) {
+ return fiql.replaceAll(SearchUtils.getTypeConditionPattern(anyType).pattern(), "");
+ }
+
+ public String getAnyType() {
+ return anyType;
+ }
+}
diff --git a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/search/AbstractSearchPanel.java b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/search/AbstractSearchPanel.java
index 2fb724fba5..c854dfd153 100644
--- a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/search/AbstractSearchPanel.java
+++ b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/search/AbstractSearchPanel.java
@@ -19,7 +19,6 @@
package org.apache.syncope.client.console.panels.search;
import java.io.Serializable;
-import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
@@ -30,21 +29,17 @@ import org.apache.syncope.client.console.SyncopeConsoleSession;
import org.apache.syncope.client.console.SyncopeWebApplication;
import org.apache.syncope.client.console.rest.AnyTypeClassRestClient;
import org.apache.syncope.client.console.rest.FIQLQueryRestClient;
-import org.apache.syncope.client.console.rest.GroupRestClient;
import org.apache.syncope.client.console.wicket.markup.html.form.ActionLink;
import org.apache.syncope.client.console.wicket.markup.html.form.ActionsPanel;
import org.apache.syncope.client.ui.commons.markup.html.form.MultiFieldPanel;
-import org.apache.syncope.common.lib.SyncopeConstants;
import org.apache.syncope.common.lib.search.AbstractFiqlSearchConditionBuilder;
-import org.apache.syncope.common.lib.search.SearchableFields;
import org.apache.syncope.common.lib.to.AnyTypeClassTO;
import org.apache.syncope.common.lib.to.PlainSchemaTO;
-import org.apache.syncope.common.lib.types.AnyTypeKind;
-import org.apache.syncope.common.lib.types.IdRepoEntitlement;
import org.apache.wicket.PageReference;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.event.IEventSink;
import org.apache.wicket.markup.html.WebMarkupContainer;
+import org.apache.wicket.markup.html.list.ListItem;
import org.apache.wicket.markup.html.panel.Panel;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.LoadableDetachableModel;
@@ -65,9 +60,6 @@ public abstract class AbstractSearchPanel extends Panel {
@SpringBean
protected FIQLQueryRestClient fiqlQueryRestClient;
- @SpringBean
- protected GroupRestClient groupRestClient;
-
protected IModel<Map<String, PlainSchemaTO>> dnames;
protected IModel<Map<String, PlainSchemaTO>> anames;
@@ -86,10 +78,6 @@ public abstract class AbstractSearchPanel extends Panel {
protected WebMarkupContainer searchFormContainer;
- protected final AnyTypeKind typeKind;
-
- protected final String anyType;
-
public abstract static class Builder<T extends AbstractSearchPanel> implements Serializable {
private static final long serialVersionUID = 6308997285778809578L;
@@ -138,20 +126,14 @@ public abstract class AbstractSearchPanel extends Panel {
public abstract T build(String id);
}
- protected AbstractSearchPanel(final String id, final AnyTypeKind kind, final Builder<?> builder) {
- this(id, kind, kind.name(), builder);
- }
-
- protected AbstractSearchPanel(
- final String id, final AnyTypeKind kind, final String type, final Builder<?> builder) {
-
+ protected AbstractSearchPanel(final String id) {
super(id);
+ }
+ protected final void init(final Builder<?> builder) {
populate();
this.model = builder.model;
- this.typeKind = kind;
- this.anyType = type;
setOutputMarkupId(true);
@@ -159,18 +141,7 @@ public abstract class AbstractSearchPanel extends Panel {
searchFormContainer.setOutputMarkupId(true);
add(searchFormContainer);
- Pair<IModel<List<String>>, IModel<Long>> groupInfo =
- typeKind != AnyTypeKind.GROUP && SyncopeConsoleSession.get().owns(IdRepoEntitlement.GROUP_SEARCH)
- ? Pair.of(groupNames, new LoadableDetachableModel<>() {
-
- private static final long serialVersionUID = 7362833782319137329L;
-
- @Override
- protected Long load() {
- return groupRestClient.count(SyncopeConstants.ROOT_REALM, null);
- }
- })
- : Pair.of(groupNames, Model.of(0L));
+ Pair<IModel<List<String>>, IModel<Long>> groupInfo = getGroupInfo();
SearchClausePanel searchClausePanel = new SearchClausePanel("panel", "panel",
Model.of(new SearchClause()),
builder.required,
@@ -189,6 +160,11 @@ public abstract class AbstractSearchPanel extends Panel {
protected SearchClause newModelObject() {
return new SearchClause();
}
+
+ @Override
+ protected boolean isRemovable(final ListItem<SearchClause> item) {
+ return AbstractSearchPanel.this.isRemovable(item.getModelObject(), item.getIndex());
+ }
}.build("search", "search", searchClausePanel).hideLabel().setOutputMarkupId(true));
FIQLQueries fiqlQueries = new FIQLQueries(
@@ -199,21 +175,8 @@ public abstract class AbstractSearchPanel extends Panel {
add(saveFIQLQuery);
ActionsPanel<Serializable> fiqlQueryActionsPanel = new ActionsPanel<>("fiqlQueryActionsPanel", null);
- fiqlQueryActionsPanel.add(new ActionLink<>() {
-
- private static final long serialVersionUID = 2041211756396714619L;
-
- @Override
- public void onClick(final AjaxRequestTarget target, final Serializable ignore) {
- Optional.ofNullable(SearchUtils.buildFIQL(
- AbstractSearchPanel.this.getModel().getObject(), getSearchConditionBuilder())).
- ifPresentOrElse(
- fiql -> saveFIQLQuery.setFiql(
- fiql.replaceAll(SearchUtils.getTypeConditionPattern(type).pattern(), "")),
- () -> saveFIQLQuery.setFiql(null));
- saveFIQLQuery.toggle(target, true);
- }
- }, ActionLink.ActionType.EXPORT, StringUtils.EMPTY).hideLabel();
+ fiqlQueryActionsPanel.add(saveAction(saveFIQLQuery), ActionLink.ActionType.EXPORT, StringUtils.EMPTY).
+ hideLabel();
fiqlQueryActionsPanel.add(new ActionLink<>() {
private static final long serialVersionUID = -7978723352517770644L;
@@ -236,26 +199,58 @@ public abstract class AbstractSearchPanel extends Panel {
protected abstract String getFIQLQueryTarget();
protected void updateFIQL(final AjaxRequestTarget target, final String fiql) {
- model.setObject(SearchUtils.getSearchClauses(fiql.replaceAll(SearchUtils.getTypeConditionPattern(anyType).
- pattern(), "")));
+ model.setObject(SearchUtils.getSearchClauses(sanitizeFIQL(fiql)));
target.add(searchFormContainer);
}
protected void populate() {
+ types = new LoadableDetachableModel<>() {
+
+ private static final long serialVersionUID = 5275935387613157437L;
+
+ @Override
+ protected List<SearchClause.Type> load() {
+ return List.of();
+ }
+ };
+
+ groupNames = new LoadableDetachableModel<>() {
+
+ private static final long serialVersionUID = 5275935387613157437L;
+
+ @Override
+ protected List<String> load() {
+ return List.of();
+ }
+ };
+
+ roleNames = new LoadableDetachableModel<>() {
+
+ private static final long serialVersionUID = 5275935387613157437L;
+
+ @Override
+ protected List<String> load() {
+ return List.of();
+ }
+ };
+
+ anames = new LoadableDetachableModel<>() {
+
+ private static final long serialVersionUID = 5275935387613157437L;
+
+ @Override
+ protected Map<String, PlainSchemaTO> load() {
+ return Map.of();
+ }
+ };
+
dnames = new LoadableDetachableModel<>() {
private static final long serialVersionUID = 5275935387613157437L;
@Override
protected Map<String, PlainSchemaTO> load() {
- Map<String, PlainSchemaTO> dSchemaNames = new HashMap<>();
- SearchableFields.get(typeKind.getTOClass()).forEach((key, type) -> {
- PlainSchemaTO plainSchema = new PlainSchemaTO();
- plainSchema.setType(type);
- plainSchema.setKey(key);
- dSchemaNames.put(key, plainSchema);
- });
- return dSchemaNames;
+ return Map.of();
}
};
@@ -278,17 +273,41 @@ public abstract class AbstractSearchPanel extends Panel {
@Override
protected List<String> load() {
- return SyncopeWebApplication.get().getResourceProvider().get(anyType);
+ return List.of();
}
};
}
- public IModel<List<SearchClause>> getModel() {
- return model;
+ protected ActionLink<Serializable> saveAction(final SaveFIQLQuery saveFIQLQuery) {
+ return new ActionLink<>() {
+
+ private static final long serialVersionUID = 2041211756396714619L;
+
+ @Override
+ public void onClick(final AjaxRequestTarget target, final Serializable ignore) {
+ Optional.ofNullable(SearchUtils.buildFIQL(
+ getModel().getObject(), getSearchConditionBuilder())).ifPresentOrElse(
+ fiql -> saveFIQLQuery.setFiql(sanitizeFIQL(fiql)),
+ () -> saveFIQLQuery.setFiql(null));
+ saveFIQLQuery.toggle(target, true);
+ }
+ };
+ }
+
+ protected Pair<IModel<List<String>>, IModel<Long>> getGroupInfo() {
+ return Pair.of(groupNames, Model.of(0L));
+ }
+
+ protected String sanitizeFIQL(final String fiql) {
+ return fiql;
}
- public String getAnyType() {
- return anyType;
+ protected boolean isRemovable(final SearchClause clause, final int index) {
+ return true;
+ }
+
+ public IModel<List<SearchClause>> getModel() {
+ return model;
}
public Map<String, PlainSchemaTO> getAvailableSchemaTypes() {
diff --git a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/search/AnyObjectSearchPanel.java b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/search/AnyObjectSearchPanel.java
index 95e1a9e457..15c9e5b7f7 100644
--- a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/search/AnyObjectSearchPanel.java
+++ b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/search/AnyObjectSearchPanel.java
@@ -41,7 +41,7 @@ import org.apache.wicket.model.IModel;
import org.apache.wicket.model.LoadableDetachableModel;
import org.apache.wicket.spring.injection.annot.SpringBean;
-public class AnyObjectSearchPanel extends AbstractSearchPanel {
+public class AnyObjectSearchPanel extends AbstractAnySearchPanel {
private static final long serialVersionUID = -1769527800450203738L;
diff --git a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/search/GroupSearchPanel.java b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/search/GroupSearchPanel.java
index 22da0fad1a..a22b9c01af 100644
--- a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/search/GroupSearchPanel.java
+++ b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/search/GroupSearchPanel.java
@@ -36,7 +36,7 @@ import org.apache.wicket.model.IModel;
import org.apache.wicket.model.LoadableDetachableModel;
import org.apache.wicket.spring.injection.annot.SpringBean;
-public class GroupSearchPanel extends AbstractSearchPanel {
+public class GroupSearchPanel extends AbstractAnySearchPanel {
private static final long serialVersionUID = 5757183539269316263L;
diff --git a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/search/RealmSearchPanel.java b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/search/RealmSearchPanel.java
new file mode 100644
index 0000000000..e3e00f9e47
--- /dev/null
+++ b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/search/RealmSearchPanel.java
@@ -0,0 +1,309 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.apache.syncope.client.console.panels.search;
+
+import java.io.Serializable;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+import java.util.function.Function;
+import java.util.stream.Collectors;
+import org.apache.commons.lang3.tuple.Pair;
+import org.apache.cxf.jaxrs.ext.search.client.CompleteCondition;
+import org.apache.syncope.client.console.SyncopeWebApplication;
+import org.apache.syncope.client.console.rest.SchemaRestClient;
+import org.apache.syncope.client.console.wicket.markup.html.form.ActionLink;
+import org.apache.syncope.client.lib.SyncopeClient;
+import org.apache.syncope.client.ui.commons.markup.html.form.AjaxTextFieldPanel;
+import org.apache.syncope.client.ui.commons.markup.html.form.FieldPanel;
+import org.apache.syncope.common.lib.SyncopeConstants;
+import org.apache.syncope.common.lib.search.AbstractFiqlSearchConditionBuilder;
+import org.apache.syncope.common.lib.to.AnyTypeClassTO;
+import org.apache.syncope.common.lib.to.PlainSchemaTO;
+import org.apache.syncope.common.lib.to.SchemaTO;
+import org.apache.syncope.common.lib.types.AttrSchemaType;
+import org.apache.syncope.common.lib.types.SchemaType;
+import org.apache.wicket.PageReference;
+import org.apache.wicket.markup.html.form.IChoiceRenderer;
+import org.apache.wicket.model.IModel;
+import org.apache.wicket.model.LoadableDetachableModel;
+import org.apache.wicket.spring.injection.annot.SpringBean;
+
+public class RealmSearchPanel extends AbstractSearchPanel {
+
+ private static final long serialVersionUID = 4313349068728035055L;
+
+ private static final String REALM = "REALM";
+
+ private static final String BASE = "BASE";
+
+ private static final String FULLPATH = "fullPath";
+
+ private static final List<String> ATTRIBUTES_INCLUDED = List.of("name", "key");
+
+ @SpringBean
+ protected SchemaRestClient schemaRestClient;
+
+ public static class Builder extends AbstractSearchPanel.Builder<RealmSearchPanel> {
+
+ private static final long serialVersionUID = 6308997285778809578L;
+
+ public Builder(final IModel<List<SearchClause>> model, final PageReference pageRef) {
+ super(model, pageRef);
+ customizer(new SearchClausePanel.Customizer() {
+
+ private static final long serialVersionUID = -8826680744097357141L;
+
+ @Override
+ public IChoiceRenderer<SearchClause.Type> typeRenderer() {
+ return new IChoiceRenderer<>() {
+
+ private static final long serialVersionUID = 656585115269883745L;
+
+ @Override
+ public Object getDisplayValue(final SearchClause.Type object) {
+ return object == SearchClause.Type.CUSTOM ? BASE : object;
+ }
+
+ @Override
+ public String getIdValue(final SearchClause.Type object, final int index) {
+ return object.name();
+ }
+
+ @Override
+ public SearchClause.Type getObject(
+ final String id,
+ final IModel<? extends List<? extends SearchClause.Type>> choices) {
+ return SearchClause.Type.valueOf(id);
+ }
+ };
+ }
+
+ @Override
+ public List<SearchClause.Type> types(
+ final List<SearchClause.Type> available,
+ final int index,
+ final SearchClause currentClause) {
+ return currentClause != null && currentClause.getType() == SearchClause.Type.CUSTOM
+ ? available
+ : available.stream().filter(type -> type != SearchClause.Type.CUSTOM).toList();
+ }
+
+ @Override
+ public boolean typeEnabled(final int index, final SearchClause currentClause) {
+ return !(currentClause != null && currentClause.getType() == SearchClause.Type.CUSTOM);
+ }
+
+ @Override
+ public List<SearchClause.Comparator> comparators() {
+ return List.of(SearchClause.Comparator.EQUALS);
+ }
+
+ @Override
+ public List<String> properties() {
+ return List.of(FULLPATH);
+ }
+
+ @Override
+ public void adjust(
+ final SearchClause.Type type,
+ final AjaxTextFieldPanel property,
+ final FieldPanel<SearchClause.Comparator> comparator,
+ final FieldPanel<?> value,
+ final LoadableDetachableModel<List<Pair<String, String>>> properties) {
+
+ property.setEnabled(false);
+ property.setReadOnly(true);
+ property.setModelObject(FULLPATH);
+ comparator.setModelObject(SearchClause.Comparator.EQUALS);
+ comparator.setEnabled(false);
+ value.setEnabled(true);
+ }
+
+ @Override
+ public boolean showOperator(final int index, final SearchClause currentClause) {
+ return isNotBaseClause(currentClause, index);
+ }
+ });
+ }
+
+ @Override
+ public RealmSearchPanel build(final String id) {
+ return new RealmSearchPanel(id, this);
+ }
+ }
+
+ protected RealmSearchPanel(final String id, final Builder builder) {
+ super(id);
+ if (builder.model.getObject().isEmpty()) {
+ SearchClause baseClause = createBaseClause(SyncopeConstants.ROOT_REALM);
+ builder.model.getObject().add(baseClause);
+ }
+ init(builder);
+ }
+
+ @Override
+ protected AbstractFiqlSearchConditionBuilder<?, ?, ?> getSearchConditionBuilder() {
+ return SyncopeClient.getRealmFiqlSearchConditionBuilder();
+ }
+
+ @Override
+ protected String getFIQLQueryTarget() {
+ return REALM;
+ }
+
+ @Override
+ protected boolean isRemovable(final SearchClause clause, final int index) {
+ return isNotBaseClause(clause, index);
+ }
+
+ @Override
+ protected void populate() {
+ super.populate();
+
+ this.types = new LoadableDetachableModel<>() {
+
+ private static final long serialVersionUID = -5329135110865860544L;
+
+ @Override
+ protected List<SearchClause.Type> load() {
+ return List.of(
+ SearchClause.Type.ATTRIBUTE,
+ SearchClause.Type.RESOURCE,
+ SearchClause.Type.AUX_CLASS,
+ SearchClause.Type.CUSTOM);
+ }
+ };
+
+ this.anames = new LoadableDetachableModel<>() {
+
+ private static final long serialVersionUID = 5275935387613157437L;
+
+ @Override
+ protected Map<String, PlainSchemaTO> load() {
+ return schemaRestClient.<PlainSchemaTO>getSchemas(SchemaType.PLAIN, null, new String[0]).
+ stream().collect(Collectors.toMap(SchemaTO::getKey, Function.identity()));
+ }
+ };
+
+ this.auxClassNames = new LoadableDetachableModel<>() {
+
+ private static final long serialVersionUID = 4082537432455696478L;
+
+ @Override
+ protected List<String> load() {
+ return anyTypeClassRestClient.list().stream().map(AnyTypeClassTO::getKey).collect(Collectors.toList());
+ }
+ };
+
+ this.resourceNames = new LoadableDetachableModel<>() {
+
+ private static final long serialVersionUID = 2392986851268987236L;
+
+ @Override
+ protected List<String> load() {
+ return SyncopeWebApplication.get().getResourceProvider().getForRealms();
+ }
+ };
+
+ this.dnames = new LoadableDetachableModel<>() {
+
+ private static final long serialVersionUID = 1727353134876260253L;
+
+ @Override
+ protected Map<String, PlainSchemaTO> load() {
+ Map<String, PlainSchemaTO> dSchemaNames = new HashMap<>();
+
+ for (String field : ATTRIBUTES_INCLUDED) {
+ PlainSchemaTO plainSchema = new PlainSchemaTO();
+ plainSchema.setType(AttrSchemaType.String);
+ plainSchema.setKey(field);
+ dSchemaNames.put(field, plainSchema);
+ }
+
+ return dSchemaNames;
+ }
+ };
+ }
+
+ @Override
+ protected ActionLink<Serializable> saveAction(final SaveFIQLQuery saveFIQLQuery) {
+ return new ActionLink<>() {
+
+ private static final long serialVersionUID = -7354640433272022003L;
+
+ @Override
+ public void onClick(final org.apache.wicket.ajax.AjaxRequestTarget target, final Serializable ignore) {
+ Function<SearchClause, CompleteCondition> fullPathHandler = clause -> {
+ if (clause.getType() == SearchClause.Type.CUSTOM && FULLPATH.equals(clause.getProperty())) {
+ return getSearchConditionBuilder().is(FULLPATH).equalTo(clause.getValue());
+ }
+ return null;
+ };
+
+ Optional.ofNullable(SearchUtils.buildFIQL(
+ getModel().getObject(),
+ getSearchConditionBuilder(),
+ getAvailableSchemaTypes(),
+ fullPathHandler))
+ .ifPresentOrElse(
+ fiql -> saveFIQLQuery.setFiql(sanitizeFIQL(fiql)),
+ () -> saveFIQLQuery.setFiql(null));
+
+ saveFIQLQuery.toggle(target, true);
+ }
+ };
+ }
+
+ @Override
+ protected void updateFIQL(final org.apache.wicket.ajax.AjaxRequestTarget target, final String fiql) {
+ List<SearchClause> clauses = SearchUtils.getSearchClauses(sanitizeFIQL(fiql));
+
+ String baseValue = clauses.stream()
+ .filter(cl -> FULLPATH.equals(cl.getProperty()))
+ .map(SearchClause::getValue)
+ .findFirst()
+ .orElse(SyncopeConstants.ROOT_REALM);
+
+ SearchClause baseClause = createBaseClause(baseValue);
+
+ clauses.removeIf(cl -> FULLPATH.equals(cl.getProperty()));
+ clauses.addFirst(baseClause);
+
+ model.setObject(clauses);
+ target.add(searchFormContainer);
+ }
+
+ protected SearchClause createBaseClause(final String value) {
+ SearchClause baseClause = new SearchClause();
+ baseClause.setType(SearchClause.Type.CUSTOM);
+ baseClause.setProperty(FULLPATH);
+ baseClause.setComparator(SearchClause.Comparator.EQUALS);
+ baseClause.setValue(value);
+ return baseClause;
+ }
+
+ protected static boolean isNotBaseClause(final SearchClause clause, final int index) {
+ return clause == null
+ || clause.getType() != SearchClause.Type.CUSTOM
+ || !FULLPATH.equals(clause.getProperty())
+ || index > 1;
+ }
+}
diff --git a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/search/SearchClausePanel.java b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/search/SearchClausePanel.java
index 2581fdc431..b45c4ced15 100644
--- a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/search/SearchClausePanel.java
+++ b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/search/SearchClausePanel.java
@@ -106,6 +106,18 @@ public class SearchClausePanel extends FieldPanel<SearchClause> {
return new ChoiceRenderer<>();
}
+ default List<SearchClause.Type> types(
+ final List<SearchClause.Type> available,
+ final int index,
+ final SearchClause currentClause) {
+
+ return available;
+ }
+
+ default boolean typeEnabled(final int index, final SearchClause currentClause) {
+ return true;
+ }
+
default List<Comparator> comparators() {
return List.of();
}
@@ -122,6 +134,10 @@ public class SearchClausePanel extends FieldPanel<SearchClause> {
return List.of();
}
+ default boolean showOperator(final int index, final SearchClause currentClause) {
+ return index > 0;
+ }
+
default void adjust(
Type type,
AjaxTextFieldPanel property,
@@ -149,126 +165,69 @@ public class SearchClausePanel extends FieldPanel<SearchClause> {
return object.toString();
}
- String display;
-
- switch (clause.getObject().getType()) {
- case ATTRIBUTE:
+ return switch (clause.getObject().getType()) {
+ case ATTRIBUTE ->
switch (object) {
- case IS_NULL:
- display = "NULL";
- break;
-
- case IS_NOT_NULL:
- display = "NOT NULL";
- break;
-
- case EQUALS:
- display = "==";
- break;
-
- case NOT_EQUALS:
- display = "!=";
- break;
-
- case LESS_THAN:
- display = "<";
- break;
-
- case LESS_OR_EQUALS:
- display = "<=";
- break;
-
- case GREATER_THAN:
- display = ">";
- break;
-
- case GREATER_OR_EQUALS:
- display = ">=";
- break;
-
- default:
- display = StringUtils.EMPTY;
- }
- break;
-
- case GROUP_MEMBERSHIP:
+ case IS_NULL ->
+ "NULL";
+ case IS_NOT_NULL ->
+ "NOT NULL";
+ case EQUALS ->
+ "==";
+ case NOT_EQUALS ->
+ "!=";
+ case LESS_THAN ->
+ "<";
+ case LESS_OR_EQUALS ->
+ "<=";
+ case GREATER_THAN ->
+ ">";
+ case GREATER_OR_EQUALS ->
+ ">=";
+ };
+ case GROUP_MEMBERSHIP ->
switch (object) {
- case EQUALS:
- display = "IN";
- break;
-
- case NOT_EQUALS:
- display = "NOT IN";
- break;
-
- default:
- display = StringUtils.EMPTY;
- }
- break;
-
- case GROUP_MEMBER:
+ case EQUALS ->
+ "IN";
+ case NOT_EQUALS ->
+ "NOT IN";
+ default ->
+ StringUtils.EMPTY;
+ };
+ case GROUP_MEMBER ->
switch (object) {
- case EQUALS:
- display = "WITH";
- break;
-
- case NOT_EQUALS:
- display = "WITHOUT";
- break;
-
- default:
- display = StringUtils.EMPTY;
- }
- break;
-
- case AUX_CLASS:
- case ROLE_MEMBERSHIP:
- case RESOURCE:
+ case EQUALS ->
+ "WITH";
+ case NOT_EQUALS ->
+ "WITHOUT";
+ default ->
+ StringUtils.EMPTY;
+ };
+ case AUX_CLASS, ROLE_MEMBERSHIP, RESOURCE ->
switch (object) {
- case EQUALS:
- display = "HAS";
- break;
-
- case NOT_EQUALS:
- display = "HAS NOT";
- break;
-
- default:
- display = StringUtils.EMPTY;
- }
- break;
-
- case RELATIONSHIP:
+ case EQUALS ->
+ "HAS";
+ case NOT_EQUALS ->
+ "HAS NOT";
+ default ->
+ StringUtils.EMPTY;
+ };
+ case RELATIONSHIP ->
switch (object) {
- case IS_NOT_NULL:
- display = "EXIST";
- break;
-
- case IS_NULL:
- display = "NOT EXIST";
- break;
-
- case EQUALS:
- display = "WITH";
- break;
-
- case NOT_EQUALS:
- display = "WITHOUT";
- break;
-
- default:
- display = StringUtils.EMPTY;
- }
- break;
-
- case CUSTOM:
- display = customizer.comparatorDisplayValue(object);
- break;
-
- default:
- display = object.toString();
- }
- return display;
+ case IS_NOT_NULL ->
+ "EXIST";
+ case IS_NULL ->
+ "NOT EXIST";
+ case EQUALS ->
+ "WITH";
+ case NOT_EQUALS ->
+ "WITHOUT";
+ default ->
+ StringUtils.EMPTY;
+ };
+ case CUSTOM ->
+ customizer.comparatorDisplayValue(object);
+ };
}
@Override
@@ -284,61 +243,27 @@ public class SearchClausePanel extends FieldPanel<SearchClause> {
return SearchClause.Comparator.EQUALS;
}
- final SearchClause.Comparator comparator;
- switch (id) {
- case "HAS":
- case "IN":
- case "WITH":
- comparator = SearchClause.Comparator.EQUALS;
- break;
-
- case "HAS NOT":
- case "NOT IN":
- case "WITHOUT":
- comparator = SearchClause.Comparator.NOT_EQUALS;
- break;
-
- case "NULL":
- case "NOT EXIST":
- comparator = SearchClause.Comparator.IS_NULL;
- break;
-
- case "NOT NULL":
- case "EXIST":
- comparator = SearchClause.Comparator.IS_NOT_NULL;
- break;
-
- case "==":
- comparator = SearchClause.Comparator.EQUALS;
- break;
-
- case "!=":
- comparator = SearchClause.Comparator.NOT_EQUALS;
- break;
-
- case "<":
- comparator = SearchClause.Comparator.LESS_THAN;
- break;
-
- case "<=":
- comparator = SearchClause.Comparator.LESS_OR_EQUALS;
- break;
-
- case ">":
- comparator = SearchClause.Comparator.GREATER_THAN;
- break;
-
- case ">=":
- comparator = SearchClause.Comparator.GREATER_OR_EQUALS;
- break;
-
- default:
+ return switch (id) {
+ case "HAS", "IN", "WITH", "==" ->
+ Comparator.EQUALS;
+ case "HAS NOT", "NOT IN", "WITHOUT", "!=" ->
+ Comparator.NOT_EQUALS;
+ case "NULL", "NOT EXIST" ->
+ Comparator.IS_NULL;
+ case "NOT NULL", "EXIST" ->
+ Comparator.IS_NOT_NULL;
+ case "<" ->
+ Comparator.LESS_THAN;
+ case "<=" ->
+ Comparator.LESS_OR_EQUALS;
+ case ">" ->
+ Comparator.GREATER_THAN;
+ case ">=" ->
+ Comparator.GREATER_OR_EQUALS;
+ default ->
// EQUALS to be used as default value
- comparator = customizer.comparatorGetObject(id).orElse(SearchClause.Comparator.EQUALS);
- break;
- }
-
- return comparator;
+ customizer.comparatorGetObject(id).orElse(Comparator.EQUALS);
+ };
}
}
@@ -376,6 +301,8 @@ public class SearchClausePanel extends FieldPanel<SearchClause> {
protected final Fragment searchButtonFragment;
+ protected final Fragment placeholderFragment;
+
protected final AjaxLink<Void> searchButton;
protected IEventSink resultContainer;
@@ -427,6 +354,8 @@ public class SearchClausePanel extends FieldPanel<SearchClause> {
operatorFragment = new Fragment("operator", "operatorFragment", this);
+ placeholderFragment = new Fragment("operator", "placeholderFragment", this);
+
field = new FormComponent<>("container", this.clause) {
private static final long serialVersionUID = -8204140666393922700L;
@@ -651,10 +580,13 @@ public class SearchClausePanel extends FieldPanel<SearchClause> {
}
}.setOutputMarkupPlaceholderTag(true));
- if (getIndex() > 0) {
+ // Use customizer to decide whether to show the AND/OR operator for this clause
+ if (customizer.showOperator(getIndex(), searchClause)) {
operatorContainer.add(operatorFragment);
- } else {
+ } else if (getIndex() == 0) {
operatorContainer.add(searchButtonFragment);
+ } else {
+ operatorContainer.add(placeholderFragment);
}
AjaxTextFieldPanel property = new AjaxTextFieldPanel(
@@ -664,7 +596,7 @@ public class SearchClausePanel extends FieldPanel<SearchClause> {
@Override
protected Optional<IConverter<String>> getConverter() {
- return Optional.of(new IConverter<String>() {
+ return Optional.of(new IConverter<>() {
private static final long serialVersionUID = -2754107934642211828L;
@@ -779,9 +711,11 @@ public class SearchClausePanel extends FieldPanel<SearchClause> {
AjaxDropDownChoicePanel<SearchClause.Type> type = new AjaxDropDownChoicePanel<>(
"type", "type", new PropertyModel<>(searchClause, "type"));
- type.setChoices(types).setChoiceRenderer(customizer.typeRenderer()).
+ type.setChoices(customizer.types(types.getObject(), getIndex(), searchClause)).
+ setChoiceRenderer(customizer.typeRenderer()).
hideLabel().setRequired(required).setOutputMarkupId(true);
type.setNullValid(false);
+ type.setEnabled(customizer.typeEnabled(getIndex(), searchClause));
type.getField().add(new IndicatorAjaxFormComponentUpdatingBehavior(Constants.ON_CHANGE) {
private static final long serialVersionUID = -1107858522700306810L;
@@ -794,10 +728,10 @@ public class SearchClausePanel extends FieldPanel<SearchClause> {
}
SearchClausePanel.this.clause.setObject(searchClause);
- adjust(searchClause.getType(), property, comparator);
-
// reset property value in case and just in case of change of type
property.setModelObject(StringUtils.EMPTY);
+
+ adjust(searchClause.getType(), property, comparator);
target.add(property);
target.add(comparator);
@@ -842,7 +776,6 @@ public class SearchClausePanel extends FieldPanel<SearchClause> {
return this;
}
- @SuppressWarnings("unchecked")
protected void adjust(final Type type, final AjaxTextFieldPanel property, final FieldPanel<Comparator> comparator) {
if (type == null) {
return;
@@ -1023,21 +956,65 @@ public class SearchClausePanel extends FieldPanel<SearchClause> {
break;
case Long:
+ PropertyModel<Long> longModel = new PropertyModel<>(searchClause, "value") {
+
+ private static final long serialVersionUID = -3833062746549144382L;
+
+ @Override
+ public Long getObject() {
+ try {
+ return StringUtils.isBlank(searchClause.getValue())
+ ? null
+ : Long.valueOf(searchClause.getValue());
+ } catch (NumberFormatException e) {
+ LOG.debug("Unparsable long value: {}", searchClause.getValue(), e);
+ return null;
+ }
+ }
+
+ @Override
+ public void setObject(final Long object) {
+ searchClause.setValue(object == null ? null : object.toString());
+ }
+ };
+
result = new AjaxNumberFieldPanel.Builder<Long>().enableOnChange().build(
"value",
"Value",
Long.class,
- new PropertyModel<>(searchClause, "value"));
+ longModel);
result.add(new AttributeModifier("class", "field value search-spinner"));
break;
case Double:
+ PropertyModel<Double> doubleModel = new PropertyModel<>(searchClause, "value") {
+
+ private static final long serialVersionUID = 6005517697668894899L;
+
+ @Override
+ public Double getObject() {
+ try {
+ return StringUtils.isBlank(searchClause.getValue())
+ ? null
+ : Double.valueOf(searchClause.getValue());
+ } catch (NumberFormatException e) {
+ LOG.debug("Unparsable double value: {}", searchClause.getValue(), e);
+ return null;
+ }
+ }
+
+ @Override
+ public void setObject(final Double object) {
+ searchClause.setValue(object == null ? null : object.toString());
+ }
+ };
+
result = new AjaxNumberFieldPanel.Builder<Double>().enableOnChange().step(0.1).build(
"value",
"value",
Double.class,
- new PropertyModel<>(searchClause, "value"));
+ doubleModel);
result.add(new AttributeModifier("class", "field value search-spinner"));
break;
diff --git a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/rest/TaskRestClient.java b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/rest/TaskRestClient.java
index 8da0fda7a4..a08c415d43 100644
--- a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/rest/TaskRestClient.java
+++ b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/rest/TaskRestClient.java
@@ -82,6 +82,11 @@ public class TaskRestClient extends BaseRestClient implements ExecutionRestClien
getTotalCount();
}
+ public long countByEntityKey(final String entityKey, final TaskType kind) {
+ return getService(TaskService.class).search(
+ new TaskQuery.Builder(kind).entityKey(entityKey).page(1).size(0).build()).getTotalCount();
+ }
+
public long count(final AnyTypeKind anyTypeKind, final String entityKey, final String notification) {
return getService(TaskService.class).search(
new TaskQuery.Builder(TaskType.NOTIFICATION).notification(notification).
@@ -118,6 +123,20 @@ public class TaskRestClient extends BaseRestClient implements ExecutionRestClien
getResult();
}
+ public List<PropagationTaskTO> listPropagationTasksByEntityKey(
+ final String entityKey,
+ final int page,
+ final int size,
+ final SortParam<String> sort) {
+
+ return getService(TaskService.class).
+ <PropagationTaskTO>search(new TaskQuery.Builder(TaskType.PROPAGATION).
+ entityKey(entityKey).
+ page(page).size(size).
+ orderBy(toOrderBy(sort)).build()).
+ getResult();
+ }
+
public List<NotificationTaskTO> listNotificationTasks(
final String notification,
final AnyTypeKind anyTypeKind,
diff --git a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/tasks/RealmPropagationTaskDirectoryPanel.java b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/tasks/RealmPropagationTaskDirectoryPanel.java
new file mode 100644
index 0000000000..93d92dfa33
--- /dev/null
+++ b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/tasks/RealmPropagationTaskDirectoryPanel.java
@@ -0,0 +1,71 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.apache.syncope.client.console.tasks;
+
+import java.util.Iterator;
+import org.apache.syncope.client.console.panels.MultilevelPanel;
+import org.apache.syncope.client.console.rest.TaskRestClient;
+import org.apache.syncope.client.console.wicket.markup.html.bootstrap.dialog.BaseModal;
+import org.apache.syncope.common.lib.to.PropagationTaskTO;
+import org.apache.wicket.PageReference;
+
+public abstract class RealmPropagationTaskDirectoryPanel extends PropagationTaskDirectoryPanel {
+
+ private static final long serialVersionUID = -4444871419156645874L;
+
+ private final String entityKey;
+
+ protected RealmPropagationTaskDirectoryPanel(
+ final TaskRestClient restClient,
+ final BaseModal<?> baseModal,
+ final MultilevelPanel multiLevelPanelRef,
+ final String entityKey,
+ final PageReference pageRef) {
+
+ super(restClient, baseModal, multiLevelPanelRef, null, pageRef);
+ this.entityKey = entityKey;
+ }
+
+ @Override
+ protected PropagationTasksProvider dataProvider() {
+ return new RealmPropagationTasksProvider(rows);
+ }
+
+ protected class RealmPropagationTasksProvider extends PropagationTasksProvider {
+
+ private static final long serialVersionUID = -5844380869819837012L;
+
+ RealmPropagationTasksProvider(final int paginatorRows) {
+ super(paginatorRows);
+ }
+
+ @Override
+ public long size() {
+ return restClient.countByEntityKey(entityKey, taskType);
+ }
+
+ @Override
+ public Iterator<PropagationTaskTO> iterator(final long first, final long count) {
+ int page = ((int) first / paginatorRows);
+ return restClient.listPropagationTasksByEntityKey(
+ entityKey, (page < 0 ? 0 : page) + 1, paginatorRows, getSort()).
+ iterator();
+ }
+ }
+}
diff --git a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/tasks/RealmPropagationTasks.java b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/tasks/RealmPropagationTasks.java
new file mode 100644
index 0000000000..dae7b41a05
--- /dev/null
+++ b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/tasks/RealmPropagationTasks.java
@@ -0,0 +1,62 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.apache.syncope.client.console.tasks;
+
+import org.apache.commons.lang3.tuple.Pair;
+import org.apache.syncope.client.console.panels.MultilevelPanel;
+import org.apache.syncope.client.console.wicket.markup.html.bootstrap.dialog.BaseModal;
+import org.apache.syncope.common.lib.to.PropagationTaskTO;
+import org.apache.wicket.PageReference;
+import org.apache.wicket.ajax.AjaxRequestTarget;
+import org.apache.wicket.model.Model;
+import org.apache.wicket.model.StringResourceModel;
+
+public class RealmPropagationTasks extends AbstractPropagationTasks {
+
+ private static final long serialVersionUID = 6384023473496365348L;
+
+ public RealmPropagationTasks(final BaseModal<?> baseModal, final String entityKey, final PageReference pageRef) {
+ super(BaseModal.CONTENT_ID);
+
+ MultilevelPanel mlp = new MultilevelPanel("tasks");
+ mlp.setFirstLevel(new RealmPropagationTaskDirectoryPanel(
+ taskRestClient, baseModal, mlp, entityKey, pageRef) {
+
+ private static final long serialVersionUID = 1045407235404316382L;
+
+ @Override
+ protected void viewTaskExecs(final PropagationTaskTO taskTO, final AjaxRequestTarget target) {
+ mlp.next(
+ new StringResourceModel("task.view", this, new Model<>(Pair.of(null, taskTO))).getObject(),
+ new TaskExecutionDetails<>(taskTO, pageRef),
+ target);
+ }
+
+ @Override
+ protected void viewTaskDetails(final PropagationTaskTO taskTO, final AjaxRequestTarget target) {
+ mlp.next(
+ new StringResourceModel("task.view.details", this, new Model<>(Pair.of(null, taskTO))).
+ getObject(),
+ new PropagationDataView(taskTO),
+ target);
+ }
+ });
+ add(mlp);
+ }
+}
diff --git a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/tasks/TemplatesTogglePanel.java b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/tasks/TemplatesTogglePanel.java
index 6ddad78d57..c4666a98af 100644
--- a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/tasks/TemplatesTogglePanel.java
+++ b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/tasks/TemplatesTogglePanel.java
@@ -44,6 +44,7 @@ import org.apache.syncope.common.lib.SyncopeClientException;
import org.apache.syncope.common.lib.to.AnyObjectTO;
import org.apache.syncope.common.lib.to.AnyTO;
import org.apache.syncope.common.lib.to.GroupTO;
+import org.apache.syncope.common.lib.to.RealmTO;
import org.apache.syncope.common.lib.to.TemplatableTO;
import org.apache.syncope.common.lib.to.UserTO;
import org.apache.wicket.MarkupContainer;
@@ -197,4 +198,8 @@ public abstract class TemplatesTogglePanel extends TogglePanel<Serializable> {
public void setTargetObject(final TemplatableTO targetObject) {
this.targetObject = targetObject;
}
+
+ public record ShowTemplatesTogglePanelEvent(RealmTO realmTO, AjaxRequestTarget target) {
+
+ }
}
diff --git a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/widgets/NumberWidget.java b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/widgets/NumberWidget.java
index 0960cf7231..151b1dd8b5 100644
--- a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/widgets/NumberWidget.java
+++ b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/widgets/NumberWidget.java
@@ -22,8 +22,8 @@ import java.text.NumberFormat;
import java.util.List;
import org.apache.syncope.client.console.SyncopeConsoleSession;
import org.apache.syncope.client.console.SyncopeWebApplication;
+import org.apache.syncope.client.console.pages.Anys;
import org.apache.syncope.client.console.pages.BasePage;
-import org.apache.syncope.client.console.pages.Realms;
import org.apache.syncope.client.console.pages.Security;
import org.apache.syncope.client.console.rest.AnyTypeRestClient;
import org.apache.syncope.common.lib.types.IdRepoEntitlement;
@@ -55,10 +55,9 @@ public class NumberWidget extends BaseWidget {
box.add(new AttributeAppender("class", ' ' + bg));
@SuppressWarnings("unchecked")
- Class<? extends BasePage> realmsPage =
- (Class<? extends BasePage>) SyncopeWebApplication.get().getPageClass("realms");
- if (realmsPage == null) {
- realmsPage = Realms.class;
+ Class<? extends BasePage> realms = SyncopeWebApplication.get().getPageClass("anys");
+ if (realms == null) {
+ realms = Anys.class;
}
boolean isAuthorized = true;
@@ -67,14 +66,14 @@ public class NumberWidget extends BaseWidget {
List<String> anyTypes = anyTypeRestClient.list();
switch (id) {
case "totalUsers":
- pageParameters.add(Realms.SELECTED_INDEX, 1);
- responsePage = realmsPage;
+ pageParameters.add(Anys.SELECTED_INDEX, 0);
+ responsePage = realms;
isAuthorized = SyncopeConsoleSession.get().owns(IdRepoEntitlement.USER_SEARCH);
break;
case "totalGroups":
- pageParameters.add(Realms.SELECTED_INDEX, 2);
- responsePage = realmsPage;
+ pageParameters.add(Anys.SELECTED_INDEX, 1);
+ responsePage = realms;
isAuthorized = SyncopeConsoleSession.get().owns(IdRepoEntitlement.GROUP_SEARCH);
break;
@@ -83,11 +82,11 @@ public class NumberWidget extends BaseWidget {
Integer selectedIndex = null;
for (int i = 0; i < anyTypes.size() && selectedIndex == null; i++) {
if (anyTypes.get(i).equals(label)) {
- selectedIndex = i + 1;
- pageParameters.add(Realms.SELECTED_INDEX, selectedIndex);
+ selectedIndex = i;
+ pageParameters.add(Anys.SELECTED_INDEX, selectedIndex);
}
}
- responsePage = realmsPage;
+ responsePage = realms;
isAuthorized = SyncopeConsoleSession.get().owns(label + "_SEARCH");
} else {
responsePage = Security.class;
@@ -99,17 +98,17 @@ public class NumberWidget extends BaseWidget {
Integer selectedIndex = null;
for (int i = 0; i < anyTypes.size() && selectedIndex == null; i++) {
if (anyTypes.get(i).equals(label)) {
- selectedIndex = i + 1;
- pageParameters.add(Realms.SELECTED_INDEX, selectedIndex);
+ selectedIndex = i;
+ pageParameters.add(Anys.SELECTED_INDEX, selectedIndex);
}
}
- responsePage = realmsPage;
+ responsePage = realms;
isAuthorized = SyncopeConsoleSession.get().owns(label + "_SEARCH");
break;
default:
- pageParameters.add(Realms.SELECTED_INDEX, 0);
- responsePage = realmsPage;
+ pageParameters.add(Anys.SELECTED_INDEX, 0);
+ responsePage = realms;
}
AjaxEventBehavior clickToRealms = new AjaxEventBehavior("mousedown") {
diff --git a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/wizards/any/Details.java b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/wizards/any/Details.java
index 665e3f487e..89b09757ea 100644
--- a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/wizards/any/Details.java
+++ b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/wizards/any/Details.java
@@ -23,7 +23,7 @@ import java.util.List;
import org.apache.syncope.client.console.SyncopeConsoleSession;
import org.apache.syncope.client.console.SyncopeWebApplication;
import org.apache.syncope.client.console.commons.RealmsUtils;
-import org.apache.syncope.client.console.pages.Realms;
+import org.apache.syncope.client.console.pages.Anys;
import org.apache.syncope.client.console.rest.RealmRestClient;
import org.apache.syncope.client.console.wicket.markup.html.form.AjaxSearchFieldPanel;
import org.apache.syncope.client.ui.commons.markup.html.form.AjaxTextFieldPanel;
@@ -92,8 +92,8 @@ public class Details<T extends AnyTO> extends WizardStep {
@Override
protected Iterator<String> getChoices(final String input) {
- return (pageRef.getPage() instanceof Realms realms
- ? getRealmsFromLinks(realms.getRealmChoicePanel().getLinks())
+ return (pageRef.getPage() instanceof Anys anys
+ ? getRealmsFromLinks(anys.getRealmChoicePanel().getLinks())
: (fullRealmsTree
? realmRestClient.search(RealmsUtils.buildBaseQuery())
: realmRestClient.search(RealmsUtils.buildNameQuery(input))).getResult()).
diff --git a/client/idrepo/console/src/main/resources/META-INF/resources/css/syncopeConsole.scss b/client/idrepo/console/src/main/resources/META-INF/resources/css/syncopeConsole.scss
index eae3d733da..8ff8cf813e 100644
--- a/client/idrepo/console/src/main/resources/META-INF/resources/css/syncopeConsole.scss
+++ b/client/idrepo/console/src/main/resources/META-INF/resources/css/syncopeConsole.scss
@@ -117,6 +117,81 @@ body {
width: 65px;
}
-/* BreadCrumb
+/* Sidebar Treeview
============================================================================= */
-.no-separator::before{content:none !important;}
\ No newline at end of file
+.app-sidebar {
+ .sidebar-menu {
+ .nav-treeview {
+ margin-left: 1rem;
+ padding-left: 0.5rem;
+ border-left: 1px solid rgba(0, 0, 0, 0.2);
+
+ > .nav-item {
+ > .nav-link {
+ position: relative;
+ padding-left: 0.5rem;
+ }
+ }
+ }
+ }
+}
+
+/* BreadCrumb - MUI Style
+============================================================================= */
+
+.syncope-breadcrumb {
+ padding: 0;
+ margin: 0;
+
+ &-list {
+ display: flex;
+ flex-wrap: wrap;
+ list-style: none;
+ padding: 0;
+ margin: 0;
+ align-items: center;
+ gap: 8px;
+ }
+
+ &-item {
+ display: flex;
+ align-items: center;
+ list-style: none;
+
+ &:not(:last-child)::after {
+ content: '>';
+ margin-left: 8px;
+ color: #9ca3af;
+ }
+ }
+
+ &-link {
+ display: inline-flex;
+ align-items: center;
+ padding: 8px 4px;
+ text-decoration: none;
+ border-radius: 4px;
+ transition: all 0.2s ease-in-out;
+ cursor: pointer;
+
+ &:hover {
+ background-color: rgba(59, 130, 246, 0.08);
+ text-decoration: none;
+ }
+
+ &:active {
+ background-color: rgba(59, 130, 246, 0.12);
+ }
+
+ &:disabled {
+ color: #6b7280;
+ cursor: not-allowed;
+ pointer-events: none;
+
+ &:hover {
+ background-color: transparent;
+ text-decoration: none;
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/pages/Realms.html b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/pages/Anys.html
similarity index 94%
copy from client/idrepo/console/src/main/resources/org/apache/syncope/client/console/pages/Realms.html
copy to client/idrepo/console/src/main/resources/org/apache/syncope/client/console/pages/Anys.html
index e82f06e0b3..e6cfcbfa95 100644
--- a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/pages/Realms.html
+++ b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/pages/Anys.html
@@ -29,7 +29,8 @@ under the License.
<li class="breadcrumb-item">
<a wicket:id="dashboardBr"><i class="fa fa-tachometer-alt"></i> <wicket:message key="dashboard"></wicket:message></a>
</li>
- <li class="breadcrumb-item active"><wicket:message key="realms"/></li>
+ <li class="breadcrumb-item active"><wicket:message key="directory"/></li>
+ <li class="breadcrumb-item active"><wicket:message key="any"/></li>
</ol>
</div>
</div>
@@ -46,8 +47,6 @@ under the License.
</div>
</div>
<div wicket:id="modal"/>
- <div wicket:id="templateModal"/>
- <span wicket:id="toggleTemplates"/>
</section>
</wicket:extend>
</html>
diff --git a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/pages/Realms_pt_BR.properties b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/pages/Anys.properties
similarity index 85%
copy from client/idrepo/console/src/main/resources/org/apache/syncope/client/console/pages/Realms_pt_BR.properties
copy to client/idrepo/console/src/main/resources/org/apache/syncope/client/console/pages/Anys.properties
index 24bff63fa0..69a1066b76 100644
--- a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/pages/Realms_pt_BR.properties
+++ b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/pages/Anys.properties
@@ -14,10 +14,9 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
-any.realm.new=New Realm
-any.realm.edit=Edit Realm ${fullPath}
-inner.template.edit=Edit ${left} template for '${right.fullPath}'
afterObj=Object Link
realmLabel=Realm
-realms=Realms
+dynRealmLabel=Dynamic Realm
+anys=Realms
+dynrealms=Dynamic Realms
realm.auditHistory.title=Realm ${fullPath} history
diff --git a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/pages/Realms_fr_CA.properties b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/pages/Anys_fr_CA.properties
similarity index 83%
copy from client/idrepo/console/src/main/resources/org/apache/syncope/client/console/pages/Realms_fr_CA.properties
copy to client/idrepo/console/src/main/resources/org/apache/syncope/client/console/pages/Anys_fr_CA.properties
index 0e35e8e7d4..79946302d9 100644
--- a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/pages/Realms_fr_CA.properties
+++ b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/pages/Anys_fr_CA.properties
@@ -14,10 +14,9 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
-any.realm.new=Nouveau domaine
-any.realm.edit=Modifier domaine ${fullPath}
-inner.template.edit=Modifier mod\u00e8le ${gauche} pour '${right.fullPath}''.
afterObj=Lien d'objet
realmLabel=Domaine
-realms=Domaines
+dynRealmLabel=Domaine dynamique
+anys=Domaines
+dynrealms=Domaines dynamiques
realm.auditHistory.title=Realm ${fullPath} histoire
diff --git a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/pages/Realms_it.properties b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/pages/Anys_it.properties
similarity index 85%
copy from client/idrepo/console/src/main/resources/org/apache/syncope/client/console/pages/Realms_it.properties
copy to client/idrepo/console/src/main/resources/org/apache/syncope/client/console/pages/Anys_it.properties
index c2a8049303..fec03c55be 100644
--- a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/pages/Realms_it.properties
+++ b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/pages/Anys_it.properties
@@ -14,10 +14,9 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
-any.realm.new=New Realm
-any.realm.edit=Edit Realm ${fullPath}
-inner.template.edit=Modifica ${left} template per '${right.fullPath}'
afterObj=Object Link
realmLabel=Realm
-realms=Realm
+dynRealmLabel=Realm Dinamico
+anys=Realm
+dynrealms=Realm Dinamici
realm.auditHistory.title=Realm ${fullPath} storico
diff --git a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/pages/Realms.properties b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/pages/Anys_ja.properties
similarity index 80%
copy from client/idrepo/console/src/main/resources/org/apache/syncope/client/console/pages/Realms.properties
copy to client/idrepo/console/src/main/resources/org/apache/syncope/client/console/pages/Anys_ja.properties
index 24bff63fa0..2348ebe888 100644
--- a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/pages/Realms.properties
+++ b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/pages/Anys_ja.properties
@@ -14,10 +14,9 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
-any.realm.new=New Realm
-any.realm.edit=Edit Realm ${fullPath}
-inner.template.edit=Edit ${left} template for '${right.fullPath}'
-afterObj=Object Link
-realmLabel=Realm
-realms=Realms
+afterObj=\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u30ea\u30f3\u30af
+realmLabel=\u30ec\u30eb\u30e0
+dynRealmLabel=\u52d5\u7684\u30ec\u30eb\u30e0
+anys=\u30ec\u30eb\u30e0
+dynrealms=\u52d5\u7684\u30ec\u30eb\u30e0
realm.auditHistory.title=Realm ${fullPath} history
diff --git a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/pages/Realms_pt_BR.properties b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/pages/Anys_pt_BR.properties
similarity index 85%
copy from client/idrepo/console/src/main/resources/org/apache/syncope/client/console/pages/Realms_pt_BR.properties
copy to client/idrepo/console/src/main/resources/org/apache/syncope/client/console/pages/Anys_pt_BR.properties
index 24bff63fa0..69a1066b76 100644
--- a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/pages/Realms_pt_BR.properties
+++ b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/pages/Anys_pt_BR.properties
@@ -14,10 +14,9 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
-any.realm.new=New Realm
-any.realm.edit=Edit Realm ${fullPath}
-inner.template.edit=Edit ${left} template for '${right.fullPath}'
afterObj=Object Link
realmLabel=Realm
-realms=Realms
+dynRealmLabel=Dynamic Realm
+anys=Realms
+dynrealms=Dynamic Realms
realm.auditHistory.title=Realm ${fullPath} history
diff --git a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/pages/Realms_pt_BR.properties b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/pages/Anys_ru.properties
similarity index 83%
copy from client/idrepo/console/src/main/resources/org/apache/syncope/client/console/pages/Realms_pt_BR.properties
copy to client/idrepo/console/src/main/resources/org/apache/syncope/client/console/pages/Anys_ru.properties
index 24bff63fa0..73230cdcaf 100644
--- a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/pages/Realms_pt_BR.properties
+++ b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/pages/Anys_ru.properties
@@ -14,10 +14,10 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
-any.realm.new=New Realm
-any.realm.edit=Edit Realm ${fullPath}
-inner.template.edit=Edit ${left} template for '${right.fullPath}'
-afterObj=Object Link
+#
+afterObj=\u0421\u0432\u044f\u0437\u044c \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432
realmLabel=Realm
-realms=Realms
+dynRealmLabel=Dynamic Realm
+anys=Realms
+dynrealms=Dynamic Realms
realm.auditHistory.title=Realm ${fullPath} history
diff --git a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/pages/BasePage.html b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/pages/BasePage.html
index 368396f2e6..5de595dc03 100644
--- a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/pages/BasePage.html
+++ b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/pages/BasePage.html
@@ -117,9 +117,9 @@ under the License.
<!-- Main Sidebar Container -->
<aside class="app-sidebar bg-body-secondary sidebar-light-green elevation-4">
- <div class="sidebar-brand bg-green d-flex" style="height: 57px;">
+ <div class="sidebar-brand bg-green">
<span>
- <img src="ui-commons/img/logo-mini.png" alt="Apache Syncope Logo" class="brand-image" style="max-height: none; opacity: .8;"/>
+ <img src="ui-commons/img/logo-mini.png" alt="Apache Syncope Logo" class="brand-image"/>
<span class="brand-text fw-light text-white">Apache Syncope</span>
</span>
</div>
@@ -140,12 +140,27 @@ under the License.
<wicket:message key="dashboard"/>
</p>
</a></li>
- <li class="nav-item" wicket:id="realmsLI"><a href="#" class="nav-link" wicket:id="realms"><i
- class="nav-icon fa fa-folder-open"></i>
- <p>
- <wicket:message key="realms"/>
- </p>
- </a></li>
+ <li wicket:id="directoryLI" class="nav-item">
+ <a id="directoryLink" href="#" class="nav-link">
+ <i class="nav-icon fa fa-folder-open"></i>
+ <p><wicket:message key="directory"/></p>
+ <i class="nav-arrow fas fa-angle-left right"></i>
+ </a>
+ <ul wicket:id="directoryUL" class="nav nav-treeview">
+ <li class="nav-item" wicket:id="realmsLI">
+ <a href="#" class="nav-link" wicket:id="realms">
+ <i class="nav-icon fa fa-sitemap"></i>
+ <p><wicket:message key="realm"/></p>
+ </a>
+ </li>
+ <li class="nav-item" wicket:id="anysLI">
+ <a href="#" class="nav-link" wicket:id="anys">
+ <i class="nav-icon fa fa-users"></i>
+ <p><wicket:message key="any"/></p>
+ </a>
+ </li>
+ </ul>
+ </li>
<li class="nav-item" wicket:id="engagementsLI"><a href="#" class="nav-link" wicket:id="engagements"><i
class="nav-icon fas fa-tasks"></i>
<p>
diff --git a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/pages/BasePage.properties b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/pages/BasePage.properties
index d71081c161..04b612dae6 100644
--- a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/pages/BasePage.properties
+++ b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/pages/BasePage.properties
@@ -33,3 +33,6 @@ endDelegation=End Delegation
sessionExpiration.header=Session Expiration
sessionExpiration.body=Your session is about to expire. Please select the appropriate option to keep working.
sessionExpiration.extend=Extend
+directory=Directory
+realm=Realm
+any=Any
diff --git a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/pages/BasePage_fr_CA.properties b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/pages/BasePage_fr_CA.properties
index f36bd3357c..8938dac40e 100644
--- a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/pages/BasePage_fr_CA.properties
+++ b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/pages/BasePage_fr_CA.properties
@@ -32,3 +32,6 @@ fontSize=Taille de la police
sessionExpiration.header=Expiration de la s\u00e9ance
sessionExpiration.body=Votre session va expirer. Veuillez choisir l'option appropri\u00e9e pour continuer \u00e0 travailler.
sessionExpiration.extend=\u00c9tendre
+directory=R\u00e9pertoire
+realm=Realm
+any=Any
diff --git a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/pages/BasePage_it.properties b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/pages/BasePage_it.properties
index 08327cfcfb..396517a2a6 100644
--- a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/pages/BasePage_it.properties
+++ b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/pages/BasePage_it.properties
@@ -33,3 +33,6 @@ endDelegation=Termina Delega
sessionExpiration.header=Scadenza della sessione
sessionExpiration.body=La tua sessione sta per scadere. Seleziona l'opzione appropriata per continuare a lavorare.
sessionExpiration.extend=Estendi
+directory=Directory
+realm=Realm
+any=Any
diff --git a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/pages/BasePage_ja.properties b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/pages/BasePage_ja.properties
index 5af5ed0dfc..4d3599b533 100644
--- a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/pages/BasePage_ja.properties
+++ b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/pages/BasePage_ja.properties
@@ -33,3 +33,6 @@ endDelegation=End Delegation
sessionExpiration.header=Session Expiration
sessionExpiration.body=Your session is about to expire. Please select the appropriate option to keep working.
sessionExpiration.extend=Extend
+directory=\u30c7\u30a3\u30ec\u30af\u30c8\u30ea
+any=Any
+realm=\u30ec\u30eb\u30e0
diff --git a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/pages/BasePage_pt_BR.properties b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/pages/BasePage_pt_BR.properties
index 9977dbdba0..ec4e4ba8e7 100644
--- a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/pages/BasePage_pt_BR.properties
+++ b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/pages/BasePage_pt_BR.properties
@@ -33,3 +33,6 @@ endDelegation=End Delegation
sessionExpiration.header=Session Expiration
sessionExpiration.body=Your session is about to expire. Please select the appropriate option to keep working.
sessionExpiration.extend=Extend
+directory=Diret\u00f3rio
+realm=Realm
+any=Any
diff --git a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/pages/BasePage_ru.properties b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/pages/BasePage_ru.properties
index 9def38f672..2e7f9da30c 100644
--- a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/pages/BasePage_ru.properties
+++ b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/pages/BasePage_ru.properties
@@ -33,3 +33,6 @@ endDelegation=End Delegation
sessionExpiration.header=Session Expiration
sessionExpiration.body=Your session is about to expire. Please select the appropriate option to keep working.
sessionExpiration.extend=Extend
+directory=\u041a\u0430\u0442\u0430\u043b\u043e\u0433
+realm=\u041e\u0431\u043b\u0430\u0441\u0442\u044c
+any=Any
diff --git a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/pages/Realms.html b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/pages/Realms.html
index e82f06e0b3..1cca1c12e6 100644
--- a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/pages/Realms.html
+++ b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/pages/Realms.html
@@ -27,25 +27,25 @@ under the License.
<div class="col-sm-6 mt-3">
<ol class="breadcrumb float-sm-end">
<li class="breadcrumb-item">
- <a wicket:id="dashboardBr"><i class="fa fa-tachometer-alt"></i> <wicket:message key="dashboard"></wicket:message></a>
+ <a wicket:id="dashboardBr"><i class="fa fa-tachometer-alt"></i> <wicket:message key="dashboard"/></a>
</li>
- <li class="breadcrumb-item active"><wicket:message key="realms"/></li>
+ <li class="breadcrumb-item active"><wicket:message key="directory"/></li>
+ <li class="breadcrumb-item active"><wicket:message key="realm"/></li>
</ol>
</div>
</div>
- </div><!-- /.container-fluid -->
+ </div>
</section>
- <section class="content" wicket:id="content">
+ <section class="content">
<div class="container-fluid">
<div class="card card-outline">
- <div class="card-header" wicket:id="realmChoicePanel"/>
<div class="card-body">
- <wicket:container wicket:id="body"/>
+ <div wicket:id="accordionPanel"></div>
+ <div wicket:id="directoryPanel"></div>
</div>
</div>
</div>
- <div wicket:id="modal"/>
<div wicket:id="templateModal"/>
<span wicket:id="toggleTemplates"/>
</section>
diff --git a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/pages/Realms.properties b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/pages/Realms.properties
index 24bff63fa0..1158214d33 100644
--- a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/pages/Realms.properties
+++ b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/pages/Realms.properties
@@ -16,8 +16,7 @@
# under the License.
any.realm.new=New Realm
any.realm.edit=Edit Realm ${fullPath}
-inner.template.edit=Edit ${left} template for '${right.fullPath}'
-afterObj=Object Link
-realmLabel=Realm
-realms=Realms
-realm.auditHistory.title=Realm ${fullPath} history
+inner.template.edit=Edit ${left} template for '${right.fullPath}'
+search.result=<i class="fa fa-caret-down" aria-hidden="true"></i> Search
+base=Base
+fiql=FIQL
diff --git a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/pages/Realms_fr_CA.properties b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/pages/Realms_fr_CA.properties
index 0e35e8e7d4..6a8c7429e3 100644
--- a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/pages/Realms_fr_CA.properties
+++ b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/pages/Realms_fr_CA.properties
@@ -17,7 +17,6 @@
any.realm.new=Nouveau domaine
any.realm.edit=Modifier domaine ${fullPath}
inner.template.edit=Modifier mod\u00e8le ${gauche} pour '${right.fullPath}''.
-afterObj=Lien d'objet
-realmLabel=Domaine
-realms=Domaines
-realm.auditHistory.title=Realm ${fullPath} histoire
+search.result=<i class="fa fa-caret-down" aria-hidden="true"></i> Recherche
+base=Base
+fiql=FIQL
diff --git a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/pages/Realms_it.properties b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/pages/Realms_it.properties
index c2a8049303..fa00549aa6 100644
--- a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/pages/Realms_it.properties
+++ b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/pages/Realms_it.properties
@@ -14,10 +14,9 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
-any.realm.new=New Realm
-any.realm.edit=Edit Realm ${fullPath}
-inner.template.edit=Modifica ${left} template per '${right.fullPath}'
-afterObj=Object Link
-realmLabel=Realm
-realms=Realm
-realm.auditHistory.title=Realm ${fullPath} storico
+any.realm.new=Nuovo Realm
+any.realm.edit=Modifica Realm ${fullPath}
+inner.template.edit=Modifica ${left} template per '${right.fullPath}'
+search.result=<i class="fa fa-caret-down" aria-hidden="true"></i> Ricerca
+base=Base
+fiql=FIQL
diff --git a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/pages/Realms_ja.properties b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/pages/Realms_ja.properties
index d964e2a582..8996cdfab7 100644
--- a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/pages/Realms_ja.properties
+++ b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/pages/Realms_ja.properties
@@ -16,8 +16,7 @@
# under the License.
any.realm.new=\u65b0\u3057\u3044\u30ec\u30eb\u30e0
any.realm.edit=\u30ec\u30eb\u30e0 ${fullPath} \u3092\u7de8\u96c6
-inner.template.edit='${right.fullPath}' \u306e ${left} \u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u3092\u7de8\u96c6
-afterObj=\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u30ea\u30f3\u30af
-realmLabel=\u30ec\u30eb\u30e0
-realms=\u30ec\u30eb\u30e0
-realm.auditHistory.title=Realm ${fullPath} history
+inner.template.edit='${right.fullPath}' \u306e ${left} \u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u3092\u7de8\u96c6
+search.result=<i class="fa fa-caret-down" aria-hidden="true"></i> \u691c\u7d22
+base=\u30d9\u30fc\u30b9
+fiql=FIQL
diff --git a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/pages/Realms_pt_BR.properties b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/pages/Realms_pt_BR.properties
index 24bff63fa0..01782bdfe7 100644
--- a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/pages/Realms_pt_BR.properties
+++ b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/pages/Realms_pt_BR.properties
@@ -14,10 +14,9 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
-any.realm.new=New Realm
-any.realm.edit=Edit Realm ${fullPath}
-inner.template.edit=Edit ${left} template for '${right.fullPath}'
-afterObj=Object Link
-realmLabel=Realm
-realms=Realms
-realm.auditHistory.title=Realm ${fullPath} history
+any.realm.new=Novo Realm
+any.realm.edit=Editar Realm ${fullPath}
+inner.template.edit=Edit ${left} template for '${right.fullPath}'
+search.result=<i class="fa fa-caret-down" aria-hidden="true"></i> Procurar
+base=Base
+fiql=FIQL
diff --git a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/pages/Realms_ru.properties b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/pages/Realms_ru.properties
index 40e66a065b..f26ef73b47 100644
--- a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/pages/Realms_ru.properties
+++ b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/pages/Realms_ru.properties
@@ -14,11 +14,9 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
-#
any.realm.new=\u0421\u043e\u0437\u0434\u0430\u0442\u044c \u043e\u0431\u043b\u0430\u0441\u0442\u044c
any.realm.edit=\u0418\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u043e\u0431\u043b\u0430\u0441\u0442\u044c ${fullPath}
inner.template.edit=\u0418\u0437\u043c\u0435\u043d\u0438\u0442\u044c ${left} \u0448\u0430\u0431\u043b\u043e\u043d \u0434\u043b\u044f '${right.fullPath}'
-afterObj=\u0421\u0432\u044f\u0437\u044c \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432
-realmLabel=Realm
-realms=Realms
-realm.auditHistory.title=Realm ${fullPath} history
+search.result=<i class="fa fa-caret-down" aria-hidden="true"></i> \u041f\u043e\u0438\u0441\u043a \u0434\u043b\u044f
+base=\u0411\u0430\u0437\u0430
+fiql=FIQL
diff --git a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/DisplayAttributesModalPanel.properties b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/AbstractDisplayAttributesModalPanel.properties
similarity index 100%
copy from client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/DisplayAttributesModalPanel.properties
copy to client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/AbstractDisplayAttributesModalPanel.properties
diff --git a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/DisplayAttributesModalPanel_fr_CA.properties b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/AbstractDisplayAttributesModalPanel_fr_CA.properties
similarity index 100%
copy from client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/DisplayAttributesModalPanel_fr_CA.properties
copy to client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/AbstractDisplayAttributesModalPanel_fr_CA.properties
diff --git a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/DisplayAttributesModalPanel_it.properties b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/AbstractDisplayAttributesModalPanel_it.properties
similarity index 100%
copy from client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/DisplayAttributesModalPanel_it.properties
copy to client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/AbstractDisplayAttributesModalPanel_it.properties
diff --git a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/DisplayAttributesModalPanel_ja.properties b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/AbstractDisplayAttributesModalPanel_ja.properties
similarity index 100%
copy from client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/DisplayAttributesModalPanel_ja.properties
copy to client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/AbstractDisplayAttributesModalPanel_ja.properties
diff --git a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/DisplayAttributesModalPanel_pt_BR.properties b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/AbstractDisplayAttributesModalPanel_pt_BR.properties
similarity index 100%
copy from client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/DisplayAttributesModalPanel_pt_BR.properties
copy to client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/AbstractDisplayAttributesModalPanel_pt_BR.properties
diff --git a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/DisplayAttributesModalPanel_ru.properties b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/AbstractDisplayAttributesModalPanel_ru.properties
similarity index 100%
copy from client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/DisplayAttributesModalPanel_ru.properties
copy to client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/AbstractDisplayAttributesModalPanel_ru.properties
diff --git a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/DisplayAttributesModalPanel.html b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/AbstractDisplayModalPanel.html
similarity index 95%
rename from client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/DisplayAttributesModalPanel.html
rename to client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/AbstractDisplayModalPanel.html
index 82f8d33ef4..2a5f7ccf0b 100644
--- a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/DisplayAttributesModalPanel.html
+++ b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/AbstractDisplayModalPanel.html
@@ -35,7 +35,7 @@ under the License.
<h3 class="card-title"><wicket:message key="plainSchemas"/></h3>
</div>
<div class="card-body">
- <div id="group-forum">
+ <div id="group-forum-plain">
<span wicket:id="plainSchemas">[plainSchemas]</span>
</div>
</div>
@@ -45,7 +45,7 @@ under the License.
<h3 class="card-title"><wicket:message key="derSchemas"/></h3>
</div>
<div class="card-body">
- <div id="group-forum">
+ <div id="group-forum-der">
<span wicket:id="derSchemas">[derSchemas]</span>
</div>
</div>
diff --git a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/DisplayAttributesModalPanel.properties b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/AbstractDisplayModalPanel.properties
similarity index 100%
rename from client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/DisplayAttributesModalPanel.properties
rename to client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/AbstractDisplayModalPanel.properties
diff --git a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/DisplayAttributesModalPanel_fr_CA.properties b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/AbstractDisplayModalPanel_fr_CA.properties
similarity index 100%
rename from client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/DisplayAttributesModalPanel_fr_CA.properties
rename to client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/AbstractDisplayModalPanel_fr_CA.properties
diff --git a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/DisplayAttributesModalPanel_it.properties b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/AbstractDisplayModalPanel_it.properties
similarity index 100%
rename from client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/DisplayAttributesModalPanel_it.properties
rename to client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/AbstractDisplayModalPanel_it.properties
diff --git a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/DisplayAttributesModalPanel_ja.properties b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/AbstractDisplayModalPanel_ja.properties
similarity index 100%
rename from client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/DisplayAttributesModalPanel_ja.properties
rename to client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/AbstractDisplayModalPanel_ja.properties
diff --git a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/DisplayAttributesModalPanel_pt_BR.properties b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/AbstractDisplayModalPanel_pt_BR.properties
similarity index 100%
rename from client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/DisplayAttributesModalPanel_pt_BR.properties
rename to client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/AbstractDisplayModalPanel_pt_BR.properties
diff --git a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/DisplayAttributesModalPanel_ru.properties b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/AbstractDisplayModalPanel_ru.properties
similarity index 100%
rename from client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/DisplayAttributesModalPanel_ru.properties
rename to client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/AbstractDisplayModalPanel_ru.properties
diff --git a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/Realm.html b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/AnysPanel.html
similarity index 100%
copy from client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/Realm.html
copy to client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/AnysPanel.html
diff --git a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/RealmChoicePanel.html b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/RealmChoicePanel.html
index 28589bd65f..ca8c22083b 100644
--- a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/RealmChoicePanel.html
+++ b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/RealmChoicePanel.html
@@ -18,11 +18,11 @@ under the License.
-->
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:wicket="http://wicket.apache.org">
<wicket:panel>
- <div wicket:id="container" class="realm-header">
+ <div wicket:id="container" class="realm-header ps-2 pe-4">
<div class="realm-label">
- <nav aria-label="navbar" class="navbar navbar-expand-lg bg-body-tertiary">
- <ol class="navbar-nav me-auto mb-2 mb-lg-0">
- <li class="nav-item" wicket:id="breadcrumb"><a wicket:id="bcitem" class="nav-link"/></li>
+ <nav aria-label="breadcrumb" class="syncope-breadcrumb">
+ <ol class="syncope-breadcrumb-list">
+ <li class="syncope-breadcrumb-item" wicket:id="breadcrumb"><a wicket:id="bcitem" class="syncope-breadcrumb-link"/></li>
</ol>
</nav>
</div>
diff --git a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/RealmDetails.html b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/RealmDetails.html
index 6092926ae7..da34ebb140 100644
--- a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/RealmDetails.html
+++ b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/RealmDetails.html
@@ -23,6 +23,9 @@ under the License.
<div class="form-group">
<span wicket:id="name">[name]</span>
</div>
+ <div class="form-group">
+ <span wicket:id="parent">[parent]</span>
+ </div>
<div class="form-group">
<span wicket:id="fullPath">[fullPath]</span>
</div>
diff --git a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/RealmDetails.properties b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/RealmDetails.properties
index 36833588e9..1de6048fd4 100644
--- a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/RealmDetails.properties
+++ b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/RealmDetails.properties
@@ -25,3 +25,4 @@ attrReleasePolicy=Attribute Release Policy
ticketExpirationPolicy=Ticket Expiration Policy
anyTypeClasses=AnyTypeClasses
plainAttrs=Attributes
+parent=Parent realm path
diff --git a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/RealmDetails_fr_CA.properties b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/RealmDetails_fr_CA.properties
index 1d536a4ef7..5a9944410d 100644
--- a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/RealmDetails_fr_CA.properties
+++ b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/RealmDetails_fr_CA.properties
@@ -25,3 +25,4 @@ attrReleasePolicy=Attribute Release Policy
ticketExpirationPolicy=Ticket Expiration Policy
anyTypeClasses=AnyTypeClasses
plainAttrs=Attributs
+parent=Chemin du domaine parent
diff --git a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/RealmDetails_it.properties b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/RealmDetails_it.properties
index 063c11ec47..a58dae842e 100644
--- a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/RealmDetails_it.properties
+++ b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/RealmDetails_it.properties
@@ -25,3 +25,4 @@ attrReleasePolicy=Politica Rilascio Attributi
ticketExpirationPolicy=Politica Ticket Expiration
anyTypeClasses=AnyTypeClass
plainAttrs=Attributi
+parent=Percorso realm padre
diff --git a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/RealmDetails_ja.properties b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/RealmDetails_ja.properties
index 08b5841bb9..359350d4ac 100644
--- a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/RealmDetails_ja.properties
+++ b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/RealmDetails_ja.properties
@@ -25,3 +25,4 @@ attrReleasePolicy=Attribute Release Policy
ticketExpirationPolicy=Ticket Expiration Policy
anyTypeClasses=AnyTypeClasses
plainAttrs=Attributes
+parent=\u89aa\u30ec\u30eb\u30e0\u306e\u30d1\u30b9
diff --git a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/RealmDetails_pt_BR.properties b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/RealmDetails_pt_BR.properties
index ba19e43198..cfeab01142 100644
--- a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/RealmDetails_pt_BR.properties
+++ b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/RealmDetails_pt_BR.properties
@@ -25,3 +25,4 @@ attrReleasePolicy=Attribute Release Policy
ticketExpirationPolicy=Ticket Expiration Policy
anyTypeClasses=AnyTypeClasses
plainAttrs=Attributes
+parent=Caminho do realm pai
diff --git a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/RealmDetails_ru.properties b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/RealmDetails_ru.properties
index 6d81099cc5..e1919f26cf 100644
--- a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/RealmDetails_ru.properties
+++ b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/RealmDetails_ru.properties
@@ -26,3 +26,4 @@ attrReleasePolicy=Attribute Release Policy
ticketExpirationPolicy=Ticket Expiration Policy
anyTypeClasses=AnyTypeClasses
plainAttrs=Attributes
+parent=\u041f\u0443\u0442\u044c\u0020\u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0439\u0020\u043e\u0431\u043b\u0430\u0441\u0442\u0438
diff --git a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/Realm.html b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/RealmDirectoryPanel.html
similarity index 94%
rename from client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/Realm.html
rename to client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/RealmDirectoryPanel.html
index 25a998f654..89128e97d8 100644
--- a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/Realm.html
+++ b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/RealmDirectoryPanel.html
@@ -18,6 +18,5 @@ under the License.
-->
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:wicket="http://wicket.apache.org">
<wicket:extend>
- <div wicket:id="tabbedPanel"></div>
</wicket:extend>
-</html>
\ No newline at end of file
+</html>
diff --git a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/RealmDetails_pt_BR.properties b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/RealmDirectoryPanel.properties
similarity index 68%
copy from client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/RealmDetails_pt_BR.properties
copy to client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/RealmDirectoryPanel.properties
index ba19e43198..dea410cdd7 100644
--- a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/RealmDetails_pt_BR.properties
+++ b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/RealmDirectoryPanel.properties
@@ -14,14 +14,19 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
-fullPath=Caminho
-accountPolicy=Pol\u00edtica de Conta
-passwordPolicy=Pol\u00edtica de Senha
+name=Name
+fullPath=Full path
+anyTypeClasses=AnyTypeClasses
+accountPolicy=Account policy
+passwordPolicy=Password policy
+authPolicy=Authentication policy
+accessPolicy=Access policy
+attrReleasePolicy=Attribute Release policy
+ticketExpirationPolicy=Ticket Expiration policy
+searchFailed=Search failed
+realm.auditHistory.title=Realm ${fullPath} history
+realm.propagation.tasks=Propagation tasks for realm ${fullPath}
actions=Actions
resources=Assigned resources
-authPolicy=Authentication Policy
-accessPolicy=Access Policy
-attrReleasePolicy=Attribute Release Policy
-ticketExpirationPolicy=Ticket Expiration Policy
-anyTypeClasses=AnyTypeClasses
-plainAttrs=Attributes
+zoom_in.title=navigate
+create.title=add child
diff --git a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/RealmDetails.properties b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/RealmDirectoryPanel_fr_CA.properties
similarity index 60%
copy from client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/RealmDetails.properties
copy to client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/RealmDirectoryPanel_fr_CA.properties
index 36833588e9..cef9d2598e 100644
--- a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/RealmDetails.properties
+++ b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/RealmDirectoryPanel_fr_CA.properties
@@ -14,14 +14,19 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
-fullPath=Path
-accountPolicy=Account Policy
-passwordPolicy=Password Policy
-actions=Actions
-resources=Assigned resources
-authPolicy=Authentication Policy
-accessPolicy=Access Policy
-attrReleasePolicy=Attribute Release Policy
-ticketExpirationPolicy=Ticket Expiration Policy
+name=Nom
+fullPath=Chemin complet
anyTypeClasses=AnyTypeClasses
-plainAttrs=Attributes
+accountPolicy=Politique de compte
+passwordPolicy=Politique de mot de passe
+authPolicy=Politique d'authentification
+accessPolicy=Politique d'acces
+attrReleasePolicy=Politique de publication des attributs
+ticketExpirationPolicy=Politique d'expiration du ticket
+searchFailed=\u00c9chec de la recherche
+realm.auditHistory.title=Historique du realm ${fullPath}
+realm.propagation.tasks=T\u00e2ches de propagation pour le realm ${fullPath}
+actions=Actions
+resources=Ressources assignees
+zoom_in.title=naviguer
+create.title=ajouter un enfant
diff --git a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/RealmDetails_it.properties b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/RealmDirectoryPanel_it.properties
similarity index 79%
copy from client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/RealmDetails_it.properties
copy to client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/RealmDirectoryPanel_it.properties
index 063c11ec47..6119dbc158 100644
--- a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/RealmDetails_it.properties
+++ b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/RealmDirectoryPanel_it.properties
@@ -14,14 +14,19 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
-fullPath=Percorso
+name=Nome
+fullPath=Percorso completo
+anyTypeClasses=AnyTypeClasses
accountPolicy=Politica Account
passwordPolicy=Politica Password
-actions=Azioni
-resources=Risorse assegnate
authPolicy=Politica Autenticazione
accessPolicy=Politica Accesso
attrReleasePolicy=Politica Rilascio Attributi
ticketExpirationPolicy=Politica Ticket Expiration
-anyTypeClasses=AnyTypeClass
-plainAttrs=Attributi
+searchFailed=Ricerca non riuscita
+realm.auditHistory.title=Storico realm ${fullPath}
+realm.propagation.tasks=Task di propagazione per il realm ${fullPath}
+actions=Azioni
+resources=Risorse assegnate
+zoom_in.title=naviga
+create.title=aggiungi figlio
diff --git a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/RealmDetails_ja.properties b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/RealmDirectoryPanel_ja.properties
similarity index 58%
copy from client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/RealmDetails_ja.properties
copy to client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/RealmDirectoryPanel_ja.properties
index 08b5841bb9..f4c8430832 100644
--- a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/RealmDetails_ja.properties
+++ b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/RealmDirectoryPanel_ja.properties
@@ -14,14 +14,19 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
-fullPath=\u30d1\u30b9
+name=\u540d\u524d
+fullPath=\u30d5\u30eb\u30d1\u30b9
+anyTypeClasses=AnyType\u30af\u30e9\u30b9
accountPolicy=\u30a2\u30ab\u30a6\u30f3\u30c8\u30dd\u30ea\u30b7\u30fc
passwordPolicy=\u30d1\u30b9\u30ef\u30fc\u30c9\u30dd\u30ea\u30b7\u30fc
-actions=\u30a2\u30af\u30b7\u30e7\u30f3
+authPolicy=\u8a8d\u8a3c\u30dd\u30ea\u30b7\u30fc
+accessPolicy=\u30a2\u30af\u30bb\u30b9\u30dd\u30ea\u30b7\u30fc
+attrReleasePolicy=\u5c5e\u6027\u30ea\u30ea\u30fc\u30b9\u30dd\u30ea\u30b7\u30fc
+ticketExpirationPolicy=\u30c1\u30b1\u30c3\u30c8\u6709\u52b9\u671f\u9650\u30dd\u30ea\u30b7\u30fc
+searchFailed=\u691c\u7d22\u306b\u5931\u6557\u3057\u307e\u3057\u305f
+realm.auditHistory.title=Realm ${fullPath} \u306e\u5c65\u6b74
+realm.propagation.tasks=Realm ${fullPath} \u306e\u30d7\u30ed\u30d1\u30b2\u30fc\u30b7\u30e7\u30f3\u30bf\u30b9\u30af
+actions=\u64cd\u4f5c
resources=\u5272\u308a\u5f53\u3066\u3089\u308c\u305f\u30ea\u30bd\u30fc\u30b9
-authPolicy=Authentication Policy
-accessPolicy=Access Policy
-attrReleasePolicy=Attribute Release Policy
-ticketExpirationPolicy=Ticket Expiration Policy
-anyTypeClasses=AnyTypeClasses
-plainAttrs=Attributes
+zoom_in.title=\u79fb\u52d5
+create.title=\u5b50\u3092\u8ffd\u52a0
diff --git a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/RealmDetails.properties b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/RealmDirectoryPanel_pt_BR.properties
similarity index 59%
copy from client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/RealmDetails.properties
copy to client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/RealmDirectoryPanel_pt_BR.properties
index 36833588e9..646b5d1972 100644
--- a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/RealmDetails.properties
+++ b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/RealmDirectoryPanel_pt_BR.properties
@@ -14,14 +14,19 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
-fullPath=Path
-accountPolicy=Account Policy
-passwordPolicy=Password Policy
-actions=Actions
-resources=Assigned resources
-authPolicy=Authentication Policy
-accessPolicy=Access Policy
-attrReleasePolicy=Attribute Release Policy
-ticketExpirationPolicy=Ticket Expiration Policy
+name=Nome
+fullPath=Caminho completo
anyTypeClasses=AnyTypeClasses
-plainAttrs=Attributes
+accountPolicy=Politica de conta
+passwordPolicy=Politica de senha
+authPolicy=Politica de autenticacao
+accessPolicy=Politica de acesso
+attrReleasePolicy=Politica de liberacao de atributos
+ticketExpirationPolicy=Politica de expiracao de ticket
+searchFailed=Falha na pesquisa
+realm.auditHistory.title=Hist\u00f3rico do realm ${fullPath}
+realm.propagation.tasks=Tarefas de propaga\u00e7\u00e3o para o realm ${fullPath}
+actions=Acoes
+resources=Recursos atribuidos
+zoom_in.title=navegar
+create.title=adicionar filho
diff --git a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/RealmDirectoryPanel_ru.properties b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/RealmDirectoryPanel_ru.properties
new file mode 100644
index 0000000000..e2797cd7bc
--- /dev/null
+++ b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/RealmDirectoryPanel_ru.properties
@@ -0,0 +1,32 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you 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.
+name=\u0418\u043c\u044f
+fullPath=\u041f\u043e\u043b\u043d\u044b\u0439\u0020\u043f\u0443\u0442\u044c
+anyTypeClasses=\u041a\u043b\u0430\u0441\u0441\u044b\u0020AnyType
+accountPolicy=\u041f\u043e\u043b\u0438\u0442\u0438\u043a\u0430\u0020\u0443\u0447\u0435\u0442\u043d\u043e\u0439\u0020\u0437\u0430\u043f\u0438\u0441\u0438
+passwordPolicy=\u041f\u043e\u043b\u0438\u0442\u0438\u043a\u0430\u0020\u043f\u0430\u0440\u043e\u043b\u0435\u0439
+authPolicy=\u041f\u043e\u043b\u0438\u0442\u0438\u043a\u0430\u0020\u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438
+accessPolicy=\u041f\u043e\u043b\u0438\u0442\u0438\u043a\u0430\u0020\u0434\u043e\u0441\u0442\u0443\u043f\u0430
+attrReleasePolicy=\u041f\u043e\u043b\u0438\u0442\u0438\u043a\u0430\u0020\u0440\u0430\u0441\u043a\u0440\u044b\u0442\u0438\u044f\u0020\u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432
+ticketExpirationPolicy=\u041f\u043e\u043b\u0438\u0442\u0438\u043a\u0430\u0020\u0441\u0440\u043e\u043a\u0430\u0020\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f\u0020\u0431\u0438\u043b\u0435\u0442\u0430
+searchFailed=\u041e\u0448\u0438\u0431\u043a\u0430\u0020\u043f\u043e\u0438\u0441\u043a\u0430
+realm.auditHistory.title=\u0418\u0441\u0442\u043e\u0440\u0438\u044f\u0020Realm\u0020${fullPath}
+realm.propagation.tasks=\u0417\u0430\u0434\u0430\u0447\u0438\u0020\u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u0438\u044f\u0020\u0434\u043b\u044f\u0020Realm\u0020${fullPath}
+actions=\u0414\u0435\u0439\u0441\u0442\u0432\u0438\u044f
+resources=\u041d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u043d\u044b\u0435\u0020\u0440\u0435\u0441\u0443\u0440\u0441\u044b
+zoom_in.title=\u041f\u0435\u0440\u0435\u0439\u0442\u0438
+create.title=\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c\u0020\u043f\u043e\u0442\u043e\u043c\u043a\u0430
diff --git a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/search/SearchClausePanel.html b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/search/SearchClausePanel.html
index 56d11ac473..ec8cec4ffd 100644
--- a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/search/SearchClausePanel.html
+++ b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/search/SearchClausePanel.html
@@ -37,5 +37,9 @@ under the License.
<wicket:fragment wicket:id="operatorFragment">
<span wicket:id="operator"/>
</wicket:fragment>
+
+ <wicket:fragment wicket:id="placeholderFragment">
+ <div class="placeholder"></div>
+ </wicket:fragment>
</wicket:extend>
</html>
diff --git a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/wicket/markup/html/form/ActionsPanel_it.properties b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/wicket/markup/html/form/ActionsPanel_it.properties
index ea1f43d7ad..a10621683e 100644
--- a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/wicket/markup/html/form/ActionsPanel_it.properties
+++ b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/wicket/markup/html/form/ActionsPanel_it.properties
@@ -38,6 +38,10 @@ create.class=fa fa-plus
create.title=crea
create.alt=create icon
+create_child.class=fa fa-plus
+create_child.title=aggiungi figlio
+create_child.alt=add child icon
+
create_connector.class=glyphicon glyphicon-plus
create_connector.title=crea connettore
create_connector.alt=create icon
diff --git a/client/idrepo/enduser/src/main/resources/org/apache/syncope/client/enduser/panels/Sidebar.html b/client/idrepo/enduser/src/main/resources/org/apache/syncope/client/enduser/panels/Sidebar.html
index aafa6fc103..4be8231fc3 100644
--- a/client/idrepo/enduser/src/main/resources/org/apache/syncope/client/enduser/panels/Sidebar.html
+++ b/client/idrepo/enduser/src/main/resources/org/apache/syncope/client/enduser/panels/Sidebar.html
@@ -19,9 +19,9 @@ under the License.
-->
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:wicket="http://wicket.apache.org">
<wicket:panel>
- <div class="sidebar-brand bg-red d-flex" style="height: 57px;">
+ <div class="sidebar-brand bg-red">
<span>
- <img src="ui-commons/img/logo-mini.png" alt="Apache Syncope Logo" class="brand-image" style="max-height: none; opacity: .8;"/>
+ <img src="ui-commons/img/logo-mini.png" alt="Apache Syncope Logo" class="brand-image"/>
<span class="brand-text fw-light text-white">Apache Syncope</span>
</span>
</div>
diff --git a/common/idrepo/lib/src/main/java/org/apache/syncope/common/lib/search/RealmFiqlSearchConditionBuilder.java b/common/idrepo/lib/src/main/java/org/apache/syncope/common/lib/search/RealmFiqlSearchConditionBuilder.java
index 7ee9d31938..0c2e630506 100644
--- a/common/idrepo/lib/src/main/java/org/apache/syncope/common/lib/search/RealmFiqlSearchConditionBuilder.java
+++ b/common/idrepo/lib/src/main/java/org/apache/syncope/common/lib/search/RealmFiqlSearchConditionBuilder.java
@@ -36,6 +36,13 @@ public class RealmFiqlSearchConditionBuilder
public Builder(final RealmFiqlSearchConditionBuilder.Builder parent) {
super(parent);
}
+
+ @Override
+ public RealmProperty is(final String property) {
+ Builder b = new Builder(this);
+ b.result = property;
+ return b;
+ }
}
@Override
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/search/AnySearchCondVisitor.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/search/AnySearchCondVisitor.java
index d31f7f5995..9ad26051c8 100644
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/search/AnySearchCondVisitor.java
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/search/AnySearchCondVisitor.java
@@ -23,7 +23,6 @@ import org.apache.syncope.common.lib.search.SpecialAttr;
public class AnySearchCondVisitor extends SyncopeAbstractSearchCondVisitor {
-
@Override
protected Optional<SpecialAttr> getSpecialAttrName(final String propertyName) {
return SpecialAttr.fromString(propertyName);
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/search/RealmSearchCondVisitor.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/search/RealmSearchCondVisitor.java
index b31cd96c20..eb7b6ab432 100644
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/search/RealmSearchCondVisitor.java
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/search/RealmSearchCondVisitor.java
@@ -23,9 +23,9 @@ import org.apache.syncope.common.lib.search.SpecialAttr;
public class RealmSearchCondVisitor extends SyncopeAbstractSearchCondVisitor {
-
@Override
protected Optional<SpecialAttr> getSpecialAttrName(final String propertyName) {
- return Optional.empty();
+ return SpecialAttr.fromString(propertyName).
+ filter(sa -> sa == SpecialAttr.NULL || sa == SpecialAttr.AUX_CLASSES || sa == SpecialAttr.RESOURCES);
}
}
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/AbstractJPARealmSearchDAO.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/AbstractJPARealmSearchDAO.java
index a6ce4cbdfb..cb621cb030 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/AbstractJPARealmSearchDAO.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/AbstractJPARealmSearchDAO.java
@@ -40,6 +40,8 @@ import org.apache.syncope.core.persistence.api.dao.RealmDAO;
import org.apache.syncope.core.persistence.api.dao.UserDAO;
import org.apache.syncope.core.persistence.api.dao.search.AnyCond;
import org.apache.syncope.core.persistence.api.dao.search.AttrCond;
+import org.apache.syncope.core.persistence.api.dao.search.AuxClassCond;
+import org.apache.syncope.core.persistence.api.dao.search.ResourceCond;
import org.apache.syncope.core.persistence.api.dao.search.SearchCond;
import org.apache.syncope.core.persistence.api.entity.EntityFactory;
import org.apache.syncope.core.persistence.api.entity.PlainAttrValue;
@@ -187,17 +189,25 @@ public abstract class AbstractJPARealmSearchDAO extends AbstractRealmSearchDAO {
switch (cond.getType()) {
case LEAF:
case NOT_LEAF:
- node = cond.asLeaf(AnyCond.class).
- map(anyCond -> getQuery(anyCond, not, parameters)).
- or(() -> cond.asLeaf(AttrCond.class).
- map(attrCond -> {
- CheckResult<AttrCond> checked = check(attrCond);
- AttrCondQuery query = getQuery(attrCond, not, checked, parameters);
- if (query.addPlainSchemas()) {
- plainSchemas.add(checked.schema().getKey());
- }
- return query.node();
- }));
+ node = cond.asLeaf(AuxClassCond.class).
+ map(leaf -> getQuery(leaf, not, parameters));
+
+ if (node.isEmpty()) {
+ node = cond.asLeaf(ResourceCond.class).
+ map(leaf -> getQuery(leaf, not, parameters));
+ }
+ if (node.isEmpty()) {
+ node = cond.asLeaf(AnyCond.class)
+ .map(anyCond -> getQuery(anyCond, not, parameters))
+ .or(() -> cond.asLeaf(AttrCond.class).map(attrCond -> {
+ CheckResult<AttrCond> checked = check(attrCond);
+ AttrCondQuery query = getQuery(attrCond, not, checked, parameters);
+ if (query.addPlainSchemas()) {
+ plainSchemas.add(checked.schema().getKey());
+ }
+ return query.node();
+ }));
+ }
if (node.isEmpty()) {
node = getQueryForCustomConds(cond, not, parameters);
@@ -277,6 +287,44 @@ public abstract class AbstractJPARealmSearchDAO extends AbstractRealmSearchDAO {
};
}
+ protected RealmSearchNode getQuery(
+ final AuxClassCond cond,
+ final boolean not,
+ final List<Object> parameters) {
+
+ StringBuilder clause = new StringBuilder();
+ if (not) {
+ clause.append("r.id NOT IN (");
+ } else {
+ clause.append("r.id IN (");
+ }
+
+ clause.append("SELECT realm_id FROM Realm_AnyTypeClass WHERE anyTypeClass_id=?").
+ append(setParameter(parameters, cond.getAuxClass())).
+ append(')');
+
+ return new RealmSearchNode.Leaf(clause.toString());
+ }
+
+ protected RealmSearchNode getQuery(
+ final ResourceCond cond,
+ final boolean not,
+ final List<Object> parameters) {
+
+ StringBuilder clause = new StringBuilder();
+ if (not) {
+ clause.append("r.id NOT IN (");
+ } else {
+ clause.append("r.id IN (");
+ }
+
+ clause.append("SELECT realm_id FROM Realm_ExternalResource WHERE resource_id=?").
+ append(setParameter(parameters, cond.getResource())).
+ append(')');
+
+ return new RealmSearchNode.Leaf(clause.toString());
+ }
+
protected RealmSearchNode.Leaf fillAttrQuery(
final String column,
final PlainAttrValue attrValue,
@@ -532,7 +580,7 @@ public abstract class AbstractJPARealmSearchDAO extends AbstractRealmSearchDAO {
@SuppressWarnings("unchecked")
List<String> keys = query.getResultList().stream().
- map(key -> key instanceof Object[] array ? (String) (array)[0] : ((String) key)).
+ map(key -> key instanceof Object[] array ? (array)[0] : key).
toList();
return keys.stream().map(k -> entityManager.find(JPARealm.class, k)).
diff --git a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/outer/RealmTest.java b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/outer/RealmSearchTest.java
similarity index 76%
copy from core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/outer/RealmTest.java
copy to core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/outer/RealmSearchTest.java
index 273846cc13..8a904ed459 100644
--- a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/outer/RealmTest.java
+++ b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/outer/RealmSearchTest.java
@@ -28,26 +28,28 @@ import java.util.Set;
import org.apache.syncope.common.lib.SyncopeConstants;
import org.apache.syncope.core.persistence.api.attrvalue.PlainAttrValidationManager;
import org.apache.syncope.core.persistence.api.dao.AnyTypeClassDAO;
-import org.apache.syncope.core.persistence.api.dao.GroupDAO;
+import org.apache.syncope.core.persistence.api.dao.ExternalResourceDAO;
import org.apache.syncope.core.persistence.api.dao.RealmDAO;
import org.apache.syncope.core.persistence.api.dao.RealmSearchDAO;
-import org.apache.syncope.core.persistence.api.dao.RoleDAO;
import org.apache.syncope.core.persistence.api.dao.search.AnyCond;
import org.apache.syncope.core.persistence.api.dao.search.AttrCond;
+import org.apache.syncope.core.persistence.api.dao.search.AuxClassCond;
+import org.apache.syncope.core.persistence.api.dao.search.ResourceCond;
import org.apache.syncope.core.persistence.api.dao.search.SearchCond;
import org.apache.syncope.core.persistence.api.entity.PlainAttr;
import org.apache.syncope.core.persistence.api.entity.Realm;
-import org.apache.syncope.core.persistence.api.entity.Role;
-import org.apache.syncope.core.persistence.api.entity.group.Group;
import org.apache.syncope.core.persistence.jpa.AbstractTest;
+import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
+import org.springframework.test.annotation.DirtiesContext;
import org.springframework.transaction.annotation.Transactional;
+@DirtiesContext(classMode = DirtiesContext.ClassMode.BEFORE_EACH_TEST_METHOD)
@Transactional
-public class RealmTest extends AbstractTest {
+public class RealmSearchTest extends AbstractTest {
@Autowired
private AnyTypeClassDAO anyTypeClassDAO;
@@ -59,67 +61,16 @@ public class RealmTest extends AbstractTest {
private RealmSearchDAO realmSearchDAO;
@Autowired
- private RoleDAO roleDAO;
-
- @Autowired
- private GroupDAO groupDAO;
+ private ExternalResourceDAO resourceDAO;
@Autowired
private PlainAttrValidationManager validator;
- @Test
- public void plainAttrs() {
- Realm realm = realmSearchDAO.findByFullPath("/odd").orElseThrow();
- assertTrue(realm.getAnyTypeClasses().isEmpty());
- assertTrue(realm.getPlainAttrs().isEmpty());
-
- realm.add(anyTypeClassDAO.findById("other").orElseThrow());
- realm = realmDAO.save(realm);
- entityManager.flush();
-
- realm = realmDAO.findById(realm.getKey()).orElseThrow();
- assertEquals(anyTypeClassDAO.findById("other").orElseThrow(), realm.getAnyTypeClasses().iterator().next());
-
- PlainAttr aLong = new PlainAttr();
- aLong.setSchema("aLong");
- aLong.add(validator, "9");
- realm.add(aLong);
-
- realm = realmDAO.save(realm);
- entityManager.flush();
-
- realm = realmDAO.findById(realm.getKey()).orElseThrow();
- assertEquals(anyTypeClassDAO.findById("other").orElseThrow(), realm.getAnyTypeClasses().iterator().next());
- assertEquals(1, realm.getPlainAttrs().size());
- assertEquals(9, realm.getPlainAttr("aLong").orElseThrow().getValues().get(0).getLongValue());
- }
-
- @Test
- public void delete() {
- Realm realm = realmSearchDAO.findByFullPath("/odd").orElseThrow();
-
- // need to remove this group in order to remove the realm, which is otherwise empty
- Group group = groupDAO.findByName("fake").orElseThrow();
- assertEquals(realm, group.getRealm());
- groupDAO.delete(group);
-
- Role role = roleDAO.findById("User reviewer").orElseThrow();
- assertTrue(role.getRealms().contains(realm));
-
- int beforeSize = role.getRealms().size();
-
- realmDAO.delete(realm);
-
- entityManager.flush();
-
- role = roleDAO.findById("User reviewer").orElseThrow();
- assertEquals(beforeSize - 1, role.getRealms().size());
- }
-
- @Test
- public void search() {
+ @BeforeEach
+ void prepare() {
Realm two = realmSearchDAO.findByFullPath("/even/two").orElseThrow();
two.add(anyTypeClassDAO.findById("other").orElseThrow());
+ two.add(resourceDAO.findById("resource-ldap-orgunit").orElseThrow());
two = realmDAO.save(two);
entityManager.flush();
@@ -153,7 +104,10 @@ public class RealmTest extends AbstractTest {
assertEquals(anyTypeClassDAO.findById("other").orElseThrow(), odd.getAnyTypeClasses().iterator().next());
assertEquals(1, odd.getPlainAttrs().size());
assertEquals(99, odd.getPlainAttr("aLong").orElseThrow().getValues().getFirst().getLongValue());
+ }
+ @Test
+ public void byName() {
AnyCond name = new AnyCond(AttrCond.Type.EQ);
name.setSchema("name");
name.setExpression("two");
@@ -164,25 +118,21 @@ public class RealmTest extends AbstractTest {
Pageable.unpaged());
assertEquals(1, result.size());
assertEquals("two", result.getFirst().getName());
+ }
+ @Test
+ public void byAttr() {
AttrCond attrEq = new AttrCond(AttrCond.Type.EQ);
attrEq.setSchema("aLong");
attrEq.setExpression("42");
- result = realmSearchDAO.search(
+ List<Realm> result = realmSearchDAO.search(
Set.of(SyncopeConstants.ROOT_REALM),
SearchCond.of(attrEq),
Pageable.unpaged());
assertEquals(1, result.size());
assertEquals("two", result.getFirst().getName());
- result = realmSearchDAO.search(
- Set.of(SyncopeConstants.ROOT_REALM),
- SearchCond.and(SearchCond.of(name), SearchCond.of(attrEq)),
- Pageable.unpaged());
- assertEquals(1, result.size());
- assertEquals("two", result.getFirst().getName());
-
AttrCond attrEq2 = new AttrCond(AttrCond.Type.EQ);
attrEq2.setSchema("aLong");
attrEq2.setExpression("99");
@@ -223,16 +173,66 @@ public class RealmTest extends AbstractTest {
Pageable.unpaged(Sort.by(new Sort.Order(Sort.Direction.ASC, "aLong"))));
assertEquals("two", result.get(0).getName());
assertEquals("odd", result.get(1).getName());
+ }
+
+ @Test
+ public void byNameAndAttr() {
+ AnyCond name = new AnyCond(AttrCond.Type.EQ);
+ name.setSchema("name");
+ name.setExpression("two");
+
+ AttrCond attrEq = new AttrCond(AttrCond.Type.EQ);
+ attrEq.setSchema("aLong");
+ attrEq.setExpression("42");
+
+ List<Realm> result = realmSearchDAO.search(
+ Set.of(SyncopeConstants.ROOT_REALM),
+ SearchCond.and(SearchCond.of(name), SearchCond.of(attrEq)),
+ Pageable.unpaged());
+ assertEquals(1, result.size());
+ assertEquals("two", result.getFirst().getName());
+
+ }
+ @Test
+ public void and() {
AttrCond cond1 = new AttrCond(AttrCond.Type.EQ);
cond1.setSchema("aLong");
cond1.setExpression("42");
AttrCond cond2 = new AttrCond(AttrCond.Type.IEQ);
cond2.setSchema("ctype");
cond2.setExpression("string");
+
assertDoesNotThrow(() -> realmSearchDAO.search(
Set.of(SyncopeConstants.ROOT_REALM),
SearchCond.and(SearchCond.of(cond1), SearchCond.of(cond2)),
Pageable.unpaged()));
}
+
+ @Test
+ public void auxClass() {
+ AuxClassCond auxClassCond = new AuxClassCond();
+ auxClassCond.setAuxClass("other");
+
+ List<Realm> result = realmSearchDAO.search(
+ Set.of(SyncopeConstants.ROOT_REALM),
+ SearchCond.of(auxClassCond),
+ Pageable.unpaged(Sort.by(new Sort.Order(Sort.Direction.DESC, "aLong"))));
+ assertEquals(2, result.size());
+ assertEquals("two", result.get(1).getName());
+ assertEquals("odd", result.get(0).getName());
+ }
+
+ @Test
+ public void resource() {
+ ResourceCond resourceCond = new ResourceCond();
+ resourceCond.setResource("resource-ldap-orgunit");
+
+ List<Realm> result = realmSearchDAO.search(
+ Set.of(SyncopeConstants.ROOT_REALM),
+ SearchCond.of(resourceCond),
+ Pageable.unpaged(Sort.by(new Sort.Order(Sort.Direction.DESC, "aLong"))));
+ assertEquals(1, result.size());
+ assertEquals("two", result.getFirst().getName());
+ }
}
diff --git a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/outer/RealmTest.java b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/outer/RealmTest.java
index 273846cc13..ad9bb45f72 100644
--- a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/outer/RealmTest.java
+++ b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/outer/RealmTest.java
@@ -18,23 +18,15 @@
*/
package org.apache.syncope.core.persistence.jpa.outer;
-import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
-import java.util.List;
-import java.util.Set;
-import org.apache.syncope.common.lib.SyncopeConstants;
import org.apache.syncope.core.persistence.api.attrvalue.PlainAttrValidationManager;
import org.apache.syncope.core.persistence.api.dao.AnyTypeClassDAO;
import org.apache.syncope.core.persistence.api.dao.GroupDAO;
import org.apache.syncope.core.persistence.api.dao.RealmDAO;
import org.apache.syncope.core.persistence.api.dao.RealmSearchDAO;
import org.apache.syncope.core.persistence.api.dao.RoleDAO;
-import org.apache.syncope.core.persistence.api.dao.search.AnyCond;
-import org.apache.syncope.core.persistence.api.dao.search.AttrCond;
-import org.apache.syncope.core.persistence.api.dao.search.SearchCond;
import org.apache.syncope.core.persistence.api.entity.PlainAttr;
import org.apache.syncope.core.persistence.api.entity.Realm;
import org.apache.syncope.core.persistence.api.entity.Role;
@@ -42,8 +34,6 @@ import org.apache.syncope.core.persistence.api.entity.group.Group;
import org.apache.syncope.core.persistence.jpa.AbstractTest;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.data.domain.Pageable;
-import org.springframework.data.domain.Sort;
import org.springframework.transaction.annotation.Transactional;
@Transactional
@@ -115,124 +105,4 @@ public class RealmTest extends AbstractTest {
role = roleDAO.findById("User reviewer").orElseThrow();
assertEquals(beforeSize - 1, role.getRealms().size());
}
-
- @Test
- public void search() {
- Realm two = realmSearchDAO.findByFullPath("/even/two").orElseThrow();
- two.add(anyTypeClassDAO.findById("other").orElseThrow());
- two = realmDAO.save(two);
- entityManager.flush();
-
- two = realmDAO.findById(two.getKey()).orElseThrow();
- PlainAttr aLong = new PlainAttr();
- aLong.setSchema("aLong");
- aLong.add(validator, "42");
- two.add(aLong);
- two = realmDAO.save(two);
- entityManager.flush();
-
- Realm odd = realmSearchDAO.findByFullPath("/odd").orElseThrow();
- odd.add(anyTypeClassDAO.findById("other").orElseThrow());
- odd = realmDAO.save(odd);
- entityManager.flush();
-
- odd = realmDAO.findById(odd.getKey()).orElseThrow();
- PlainAttr oddLong = new PlainAttr();
- oddLong.setSchema("aLong");
- oddLong.add(validator, "99");
- odd.add(oddLong);
- realmDAO.save(odd);
- entityManager.flush();
-
- two = realmDAO.findById(two.getKey()).orElseThrow();
- assertEquals(anyTypeClassDAO.findById("other").orElseThrow(), two.getAnyTypeClasses().iterator().next());
- assertEquals(1, two.getPlainAttrs().size());
- assertEquals(42, two.getPlainAttr("aLong").orElseThrow().getValues().getFirst().getLongValue());
-
- odd = realmDAO.findById(odd.getKey()).orElseThrow();
- assertEquals(anyTypeClassDAO.findById("other").orElseThrow(), odd.getAnyTypeClasses().iterator().next());
- assertEquals(1, odd.getPlainAttrs().size());
- assertEquals(99, odd.getPlainAttr("aLong").orElseThrow().getValues().getFirst().getLongValue());
-
- AnyCond name = new AnyCond(AttrCond.Type.EQ);
- name.setSchema("name");
- name.setExpression("two");
-
- List<Realm> result = realmSearchDAO.search(
- Set.of(SyncopeConstants.ROOT_REALM),
- SearchCond.of(name),
- Pageable.unpaged());
- assertEquals(1, result.size());
- assertEquals("two", result.getFirst().getName());
-
- AttrCond attrEq = new AttrCond(AttrCond.Type.EQ);
- attrEq.setSchema("aLong");
- attrEq.setExpression("42");
-
- result = realmSearchDAO.search(
- Set.of(SyncopeConstants.ROOT_REALM),
- SearchCond.of(attrEq),
- Pageable.unpaged());
- assertEquals(1, result.size());
- assertEquals("two", result.getFirst().getName());
-
- result = realmSearchDAO.search(
- Set.of(SyncopeConstants.ROOT_REALM),
- SearchCond.and(SearchCond.of(name), SearchCond.of(attrEq)),
- Pageable.unpaged());
- assertEquals(1, result.size());
- assertEquals("two", result.getFirst().getName());
-
- AttrCond attrEq2 = new AttrCond(AttrCond.Type.EQ);
- attrEq2.setSchema("aLong");
- attrEq2.setExpression("99");
-
- result = realmSearchDAO.search(
- Set.of(SyncopeConstants.ROOT_REALM),
- SearchCond.or(SearchCond.of(attrEq), SearchCond.of(attrEq2)),
- Pageable.unpaged());
- assertTrue(result.stream().anyMatch(r -> "two".equals(r.getName())));
- assertTrue(result.stream().anyMatch(r -> "odd".equals(r.getName())));
-
- AttrCond attrIsNull = new AttrCond(AttrCond.Type.ISNULL);
- attrIsNull.setSchema("aLong");
-
- result = realmSearchDAO.search(
- Set.of(SyncopeConstants.ROOT_REALM),
- SearchCond.of(attrIsNull),
- Pageable.unpaged());
- result.forEach(r -> assertFalse("two".equals(r.getName()) || "odd".equals(r.getName())));
-
- AttrCond attrIsNotNull = new AttrCond(AttrCond.Type.ISNOTNULL);
- attrIsNotNull.setSchema("aLong");
-
- assertEquals(2, realmSearchDAO.count(
- Set.of(SyncopeConstants.ROOT_REALM),
- SearchCond.of(attrIsNotNull)));
-
- result = realmSearchDAO.search(
- Set.of(SyncopeConstants.ROOT_REALM),
- SearchCond.of(attrIsNotNull),
- Pageable.unpaged(Sort.by(new Sort.Order(Sort.Direction.ASC, "name"))));
- assertEquals("odd", result.get(0).getName());
- assertEquals("two", result.get(1).getName());
-
- result = realmSearchDAO.search(
- Set.of(SyncopeConstants.ROOT_REALM),
- SearchCond.of(attrIsNotNull),
- Pageable.unpaged(Sort.by(new Sort.Order(Sort.Direction.ASC, "aLong"))));
- assertEquals("two", result.get(0).getName());
- assertEquals("odd", result.get(1).getName());
-
- AttrCond cond1 = new AttrCond(AttrCond.Type.EQ);
- cond1.setSchema("aLong");
- cond1.setExpression("42");
- AttrCond cond2 = new AttrCond(AttrCond.Type.IEQ);
- cond2.setSchema("ctype");
- cond2.setExpression("string");
- assertDoesNotThrow(() -> realmSearchDAO.search(
- Set.of(SyncopeConstants.ROOT_REALM),
- SearchCond.and(SearchCond.of(cond1), SearchCond.of(cond2)),
- Pageable.unpaged()));
- }
}
diff --git a/core/persistence-neo4j/src/main/java/org/apache/syncope/core/persistence/neo4j/dao/Neo4jRealmSearchDAO.java b/core/persistence-neo4j/src/main/java/org/apache/syncope/core/persistence/neo4j/dao/Neo4jRealmSearchDAO.java
index 6302c3970f..7fc1dccfd0 100644
--- a/core/persistence-neo4j/src/main/java/org/apache/syncope/core/persistence/neo4j/dao/Neo4jRealmSearchDAO.java
+++ b/core/persistence-neo4j/src/main/java/org/apache/syncope/core/persistence/neo4j/dao/Neo4jRealmSearchDAO.java
@@ -45,6 +45,8 @@ import org.apache.syncope.core.persistence.api.dao.RealmDAO;
import org.apache.syncope.core.persistence.api.dao.UserDAO;
import org.apache.syncope.core.persistence.api.dao.search.AnyCond;
import org.apache.syncope.core.persistence.api.dao.search.AttrCond;
+import org.apache.syncope.core.persistence.api.dao.search.AuxClassCond;
+import org.apache.syncope.core.persistence.api.dao.search.ResourceCond;
import org.apache.syncope.core.persistence.api.dao.search.SearchCond;
import org.apache.syncope.core.persistence.api.entity.EntityFactory;
import org.apache.syncope.core.persistence.api.entity.PlainAttrValue;
@@ -53,6 +55,8 @@ import org.apache.syncope.core.persistence.api.entity.Realm;
import org.apache.syncope.core.persistence.api.utils.RealmUtils;
import org.apache.syncope.core.persistence.common.dao.AbstractRealmSearchDAO;
import org.apache.syncope.core.persistence.neo4j.dao.repo.AnyRepoExt;
+import org.apache.syncope.core.persistence.neo4j.entity.Neo4jAnyTypeClass;
+import org.apache.syncope.core.persistence.neo4j.entity.Neo4jExternalResource;
import org.apache.syncope.core.persistence.neo4j.entity.Neo4jRealm;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
@@ -212,6 +216,12 @@ public class Neo4jRealmSearchDAO extends AbstractRealmSearchDAO {
switch (cond.getType()) {
case LEAF, NOT_LEAF -> {
+ cond.asLeaf(AuxClassCond.class).
+ ifPresent(leaf -> query.append(getQuery(leaf, not, parameters)));
+
+ cond.asLeaf(ResourceCond.class).
+ ifPresent(leaf -> query.append(getQuery(leaf, not, parameters)));
+
cond.asLeaf(AnyCond.class).ifPresentOrElse(
anyCond -> {
AnyCondQuery anyCondQuery = getQuery(anyCond, not, parameters);
@@ -332,6 +342,26 @@ public class Neo4jRealmSearchDAO extends AbstractRealmSearchDAO {
return new AttrCondQuery(query.toString(), checked.schema());
}
+ protected String getQuery(
+ final AuxClassCond cond,
+ final boolean not,
+ final Map<String, Object> parameters) {
+
+ return "MATCH (n) "
+ + "WHERE " + (not ? "NOT " : "") + "(n)-[]-"
+ + "(:" + Neo4jAnyTypeClass.NODE + " {id: $" + setParameter(parameters, cond.getAuxClass()) + "}) ";
+ }
+
+ protected String getQuery(
+ final ResourceCond cond,
+ final boolean not,
+ final Map<String, Object> parameters) {
+
+ return "MATCH (n) "
+ + "WHERE " + (not ? "NOT " : "") + "(n)-[]-"
+ + "(:" + Neo4jExternalResource.NODE + " {id: $" + setParameter(parameters, cond.getResource()) + "}) ";
+ }
+
protected void getQueryForCustomConds(
final SearchCond cond,
final Map<String, Object> parameters,
diff --git a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/outer/RealmTest.java b/core/persistence-neo4j/src/test/java/org/apache/syncope/core/persistence/neo4j/outer/RealmSearchTest.java
similarity index 74%
copy from core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/outer/RealmTest.java
copy to core/persistence-neo4j/src/test/java/org/apache/syncope/core/persistence/neo4j/outer/RealmSearchTest.java
index 273846cc13..0e1c0d75b2 100644
--- a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/outer/RealmTest.java
+++ b/core/persistence-neo4j/src/test/java/org/apache/syncope/core/persistence/neo4j/outer/RealmSearchTest.java
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.syncope.core.persistence.jpa.outer;
+package org.apache.syncope.core.persistence.neo4j.outer;
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
import static org.junit.jupiter.api.Assertions.assertEquals;
@@ -28,18 +28,18 @@ import java.util.Set;
import org.apache.syncope.common.lib.SyncopeConstants;
import org.apache.syncope.core.persistence.api.attrvalue.PlainAttrValidationManager;
import org.apache.syncope.core.persistence.api.dao.AnyTypeClassDAO;
-import org.apache.syncope.core.persistence.api.dao.GroupDAO;
+import org.apache.syncope.core.persistence.api.dao.ExternalResourceDAO;
import org.apache.syncope.core.persistence.api.dao.RealmDAO;
import org.apache.syncope.core.persistence.api.dao.RealmSearchDAO;
-import org.apache.syncope.core.persistence.api.dao.RoleDAO;
import org.apache.syncope.core.persistence.api.dao.search.AnyCond;
import org.apache.syncope.core.persistence.api.dao.search.AttrCond;
+import org.apache.syncope.core.persistence.api.dao.search.AuxClassCond;
+import org.apache.syncope.core.persistence.api.dao.search.ResourceCond;
import org.apache.syncope.core.persistence.api.dao.search.SearchCond;
import org.apache.syncope.core.persistence.api.entity.PlainAttr;
import org.apache.syncope.core.persistence.api.entity.Realm;
-import org.apache.syncope.core.persistence.api.entity.Role;
-import org.apache.syncope.core.persistence.api.entity.group.Group;
-import org.apache.syncope.core.persistence.jpa.AbstractTest;
+import org.apache.syncope.core.persistence.neo4j.AbstractTest;
+import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Pageable;
@@ -47,7 +47,7 @@ import org.springframework.data.domain.Sort;
import org.springframework.transaction.annotation.Transactional;
@Transactional
-public class RealmTest extends AbstractTest {
+public class RealmSearchTest extends AbstractTest {
@Autowired
private AnyTypeClassDAO anyTypeClassDAO;
@@ -59,69 +59,17 @@ public class RealmTest extends AbstractTest {
private RealmSearchDAO realmSearchDAO;
@Autowired
- private RoleDAO roleDAO;
-
- @Autowired
- private GroupDAO groupDAO;
+ private ExternalResourceDAO resourceDAO;
@Autowired
private PlainAttrValidationManager validator;
- @Test
- public void plainAttrs() {
- Realm realm = realmSearchDAO.findByFullPath("/odd").orElseThrow();
- assertTrue(realm.getAnyTypeClasses().isEmpty());
- assertTrue(realm.getPlainAttrs().isEmpty());
-
- realm.add(anyTypeClassDAO.findById("other").orElseThrow());
- realm = realmDAO.save(realm);
- entityManager.flush();
-
- realm = realmDAO.findById(realm.getKey()).orElseThrow();
- assertEquals(anyTypeClassDAO.findById("other").orElseThrow(), realm.getAnyTypeClasses().iterator().next());
-
- PlainAttr aLong = new PlainAttr();
- aLong.setSchema("aLong");
- aLong.add(validator, "9");
- realm.add(aLong);
-
- realm = realmDAO.save(realm);
- entityManager.flush();
-
- realm = realmDAO.findById(realm.getKey()).orElseThrow();
- assertEquals(anyTypeClassDAO.findById("other").orElseThrow(), realm.getAnyTypeClasses().iterator().next());
- assertEquals(1, realm.getPlainAttrs().size());
- assertEquals(9, realm.getPlainAttr("aLong").orElseThrow().getValues().get(0).getLongValue());
- }
-
- @Test
- public void delete() {
- Realm realm = realmSearchDAO.findByFullPath("/odd").orElseThrow();
-
- // need to remove this group in order to remove the realm, which is otherwise empty
- Group group = groupDAO.findByName("fake").orElseThrow();
- assertEquals(realm, group.getRealm());
- groupDAO.delete(group);
-
- Role role = roleDAO.findById("User reviewer").orElseThrow();
- assertTrue(role.getRealms().contains(realm));
-
- int beforeSize = role.getRealms().size();
-
- realmDAO.delete(realm);
-
- entityManager.flush();
-
- role = roleDAO.findById("User reviewer").orElseThrow();
- assertEquals(beforeSize - 1, role.getRealms().size());
- }
-
- @Test
- public void search() {
+ @BeforeEach
+ void prepare() {
Realm two = realmSearchDAO.findByFullPath("/even/two").orElseThrow();
two.add(anyTypeClassDAO.findById("other").orElseThrow());
+ two.add(resourceDAO.findById("resource-ldap-orgunit").orElseThrow());
two = realmDAO.save(two);
- entityManager.flush();
two = realmDAO.findById(two.getKey()).orElseThrow();
PlainAttr aLong = new PlainAttr();
@@ -129,12 +77,10 @@ public class RealmTest extends AbstractTest {
aLong.add(validator, "42");
two.add(aLong);
two = realmDAO.save(two);
- entityManager.flush();
Realm odd = realmSearchDAO.findByFullPath("/odd").orElseThrow();
odd.add(anyTypeClassDAO.findById("other").orElseThrow());
odd = realmDAO.save(odd);
- entityManager.flush();
odd = realmDAO.findById(odd.getKey()).orElseThrow();
PlainAttr oddLong = new PlainAttr();
@@ -142,7 +88,6 @@ public class RealmTest extends AbstractTest {
oddLong.add(validator, "99");
odd.add(oddLong);
realmDAO.save(odd);
- entityManager.flush();
two = realmDAO.findById(two.getKey()).orElseThrow();
assertEquals(anyTypeClassDAO.findById("other").orElseThrow(), two.getAnyTypeClasses().iterator().next());
@@ -153,7 +98,10 @@ public class RealmTest extends AbstractTest {
assertEquals(anyTypeClassDAO.findById("other").orElseThrow(), odd.getAnyTypeClasses().iterator().next());
assertEquals(1, odd.getPlainAttrs().size());
assertEquals(99, odd.getPlainAttr("aLong").orElseThrow().getValues().getFirst().getLongValue());
+ }
+ @Test
+ public void byName() {
AnyCond name = new AnyCond(AttrCond.Type.EQ);
name.setSchema("name");
name.setExpression("two");
@@ -164,25 +112,21 @@ public class RealmTest extends AbstractTest {
Pageable.unpaged());
assertEquals(1, result.size());
assertEquals("two", result.getFirst().getName());
+ }
+ @Test
+ public void byAttr() {
AttrCond attrEq = new AttrCond(AttrCond.Type.EQ);
attrEq.setSchema("aLong");
attrEq.setExpression("42");
- result = realmSearchDAO.search(
+ List<Realm> result = realmSearchDAO.search(
Set.of(SyncopeConstants.ROOT_REALM),
SearchCond.of(attrEq),
Pageable.unpaged());
assertEquals(1, result.size());
assertEquals("two", result.getFirst().getName());
- result = realmSearchDAO.search(
- Set.of(SyncopeConstants.ROOT_REALM),
- SearchCond.and(SearchCond.of(name), SearchCond.of(attrEq)),
- Pageable.unpaged());
- assertEquals(1, result.size());
- assertEquals("two", result.getFirst().getName());
-
AttrCond attrEq2 = new AttrCond(AttrCond.Type.EQ);
attrEq2.setSchema("aLong");
attrEq2.setExpression("99");
@@ -223,16 +167,66 @@ public class RealmTest extends AbstractTest {
Pageable.unpaged(Sort.by(new Sort.Order(Sort.Direction.ASC, "aLong"))));
assertEquals("two", result.get(0).getName());
assertEquals("odd", result.get(1).getName());
+ }
+ @Test
+ public void byNameAndAttr() {
+ AnyCond name = new AnyCond(AttrCond.Type.EQ);
+ name.setSchema("name");
+ name.setExpression("two");
+
+ AttrCond attrEq = new AttrCond(AttrCond.Type.EQ);
+ attrEq.setSchema("aLong");
+ attrEq.setExpression("42");
+
+ List<Realm> result = realmSearchDAO.search(
+ Set.of(SyncopeConstants.ROOT_REALM),
+ SearchCond.and(SearchCond.of(name), SearchCond.of(attrEq)),
+ Pageable.unpaged());
+ assertEquals(1, result.size());
+ assertEquals("two", result.getFirst().getName());
+
+ }
+
+ @Test
+ public void and() {
AttrCond cond1 = new AttrCond(AttrCond.Type.EQ);
cond1.setSchema("aLong");
cond1.setExpression("42");
AttrCond cond2 = new AttrCond(AttrCond.Type.IEQ);
cond2.setSchema("ctype");
cond2.setExpression("string");
+
assertDoesNotThrow(() -> realmSearchDAO.search(
Set.of(SyncopeConstants.ROOT_REALM),
SearchCond.and(SearchCond.of(cond1), SearchCond.of(cond2)),
Pageable.unpaged()));
}
+
+ @Test
+ public void auxClass() {
+ AuxClassCond auxClassCond = new AuxClassCond();
+ auxClassCond.setAuxClass("other");
+
+ List<Realm> result = realmSearchDAO.search(
+ Set.of(SyncopeConstants.ROOT_REALM),
+ SearchCond.of(auxClassCond),
+ Pageable.unpaged(Sort.by(new Sort.Order(Sort.Direction.DESC, "aLong"))));
+ assertEquals(2, result.size());
+ assertEquals("two", result.get(1).getName());
+ assertEquals("odd", result.get(0).getName());
+ }
+
+ @Test
+ public void resource() {
+ ResourceCond resourceCond = new ResourceCond();
+ resourceCond.setResource("resource-ldap-orgunit");
+
+ List<Realm> result = realmSearchDAO.search(
+ Set.of(SyncopeConstants.ROOT_REALM),
+ SearchCond.of(resourceCond),
+ Pageable.unpaged(Sort.by(new Sort.Order(Sort.Direction.DESC, "aLong"))));
+ assertEquals(1, result.size());
+ assertEquals("two", result.getFirst().getName());
+ }
}
diff --git a/core/persistence-neo4j/src/test/java/org/apache/syncope/core/persistence/neo4j/outer/RealmTest.java b/core/persistence-neo4j/src/test/java/org/apache/syncope/core/persistence/neo4j/outer/RealmTest.java
index cd457b900b..941889f3cb 100644
--- a/core/persistence-neo4j/src/test/java/org/apache/syncope/core/persistence/neo4j/outer/RealmTest.java
+++ b/core/persistence-neo4j/src/test/java/org/apache/syncope/core/persistence/neo4j/outer/RealmTest.java
@@ -18,15 +18,10 @@
*/
package org.apache.syncope.core.persistence.neo4j.outer;
-import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
-import java.util.List;
-import java.util.Set;
import java.util.UUID;
-import org.apache.syncope.common.lib.SyncopeConstants;
import org.apache.syncope.common.lib.types.IdRepoImplementationType;
import org.apache.syncope.common.lib.types.ImplementationEngine;
import org.apache.syncope.core.persistence.api.attrvalue.PlainAttrValidationManager;
@@ -36,9 +31,6 @@ import org.apache.syncope.core.persistence.api.dao.ImplementationDAO;
import org.apache.syncope.core.persistence.api.dao.RealmDAO;
import org.apache.syncope.core.persistence.api.dao.RealmSearchDAO;
import org.apache.syncope.core.persistence.api.dao.RoleDAO;
-import org.apache.syncope.core.persistence.api.dao.search.AnyCond;
-import org.apache.syncope.core.persistence.api.dao.search.AttrCond;
-import org.apache.syncope.core.persistence.api.dao.search.SearchCond;
import org.apache.syncope.core.persistence.api.entity.Implementation;
import org.apache.syncope.core.persistence.api.entity.PlainAttr;
import org.apache.syncope.core.persistence.api.entity.Realm;
@@ -47,8 +39,6 @@ import org.apache.syncope.core.persistence.api.entity.group.Group;
import org.apache.syncope.core.persistence.neo4j.AbstractTest;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.data.domain.Pageable;
-import org.springframework.data.domain.Sort;
import org.springframework.transaction.annotation.Transactional;
@Transactional
@@ -146,120 +136,4 @@ public class RealmTest extends AbstractTest {
realm = realmDAO.findById("722f3d84-9c2b-4525-8f6e-e4b82c55a36c").orElseThrow();
assertTrue(realm.getActions().isEmpty());
}
-
- @Test
- public void search() {
- Realm two = realmSearchDAO.findByFullPath("/even/two").orElseThrow();
- two.add(anyTypeClassDAO.findById("other").orElseThrow());
- two = realmDAO.save(two);
-
- two = realmDAO.findById(two.getKey()).orElseThrow();
- PlainAttr aLong = new PlainAttr();
- aLong.setSchema("aLong");
- aLong.add(validator, "42");
- two.add(aLong);
- two = realmDAO.save(two);
-
- Realm odd = realmSearchDAO.findByFullPath("/odd").orElseThrow();
- odd.add(anyTypeClassDAO.findById("other").orElseThrow());
- odd = realmDAO.save(odd);
-
- odd = realmDAO.findById(odd.getKey()).orElseThrow();
- PlainAttr oddLong = new PlainAttr();
- oddLong.setSchema("aLong");
- oddLong.add(validator, "99");
- odd.add(oddLong);
- realmDAO.save(odd);
-
- two = realmDAO.findById(two.getKey()).orElseThrow();
- assertEquals(anyTypeClassDAO.findById("other").orElseThrow(), two.getAnyTypeClasses().iterator().next());
- assertEquals(1, two.getPlainAttrs().size());
- assertEquals(42, two.getPlainAttr("aLong").orElseThrow().getValues().getFirst().getLongValue());
-
- odd = realmDAO.findById(odd.getKey()).orElseThrow();
- assertEquals(anyTypeClassDAO.findById("other").orElseThrow(), odd.getAnyTypeClasses().iterator().next());
- assertEquals(1, odd.getPlainAttrs().size());
- assertEquals(99, odd.getPlainAttr("aLong").orElseThrow().getValues().getFirst().getLongValue());
-
- AnyCond name = new AnyCond(AttrCond.Type.EQ);
- name.setSchema("name");
- name.setExpression("two");
-
- List<Realm> result = realmSearchDAO.search(
- Set.of(SyncopeConstants.ROOT_REALM),
- SearchCond.of(name),
- Pageable.unpaged());
- assertEquals(1, result.size());
- assertEquals("two", result.getFirst().getName());
-
- AttrCond attrEq = new AttrCond(AttrCond.Type.EQ);
- attrEq.setSchema("aLong");
- attrEq.setExpression("42");
-
- result = realmSearchDAO.search(
- Set.of(SyncopeConstants.ROOT_REALM),
- SearchCond.of(attrEq),
- Pageable.unpaged());
- assertEquals(1, result.size());
- assertEquals("two", result.getFirst().getName());
-
- result = realmSearchDAO.search(
- Set.of(SyncopeConstants.ROOT_REALM),
- SearchCond.and(SearchCond.of(name), SearchCond.of(attrEq)),
- Pageable.unpaged());
- assertEquals(1, result.size());
- assertEquals("two", result.getFirst().getName());
-
- AttrCond attrEq2 = new AttrCond(AttrCond.Type.EQ);
- attrEq2.setSchema("aLong");
- attrEq2.setExpression("99");
-
- result = realmSearchDAO.search(
- Set.of(SyncopeConstants.ROOT_REALM),
- SearchCond.or(SearchCond.of(attrEq), SearchCond.of(attrEq2)),
- Pageable.unpaged());
- assertTrue(result.stream().anyMatch(r -> "two".equals(r.getName())));
- assertTrue(result.stream().anyMatch(r -> "odd".equals(r.getName())));
-
- AttrCond attrIsNull = new AttrCond(AttrCond.Type.ISNULL);
- attrIsNull.setSchema("aLong");
-
- result = realmSearchDAO.search(
- Set.of(SyncopeConstants.ROOT_REALM),
- SearchCond.of(attrIsNull),
- Pageable.unpaged());
- result.forEach(r -> assertFalse("two".equals(r.getName()) || "odd".equals(r.getName())));
-
- AttrCond attrIsNotNull = new AttrCond(AttrCond.Type.ISNOTNULL);
- attrIsNotNull.setSchema("aLong");
-
- assertEquals(2, realmSearchDAO.count(
- Set.of(SyncopeConstants.ROOT_REALM),
- SearchCond.of(attrIsNotNull)));
-
- result = realmSearchDAO.search(
- Set.of(SyncopeConstants.ROOT_REALM),
- SearchCond.of(attrIsNotNull),
- Pageable.unpaged(Sort.by(new Sort.Order(Sort.Direction.ASC, "name"))));
- assertEquals("odd", result.get(0).getName());
- assertEquals("two", result.get(1).getName());
-
- result = realmSearchDAO.search(
- Set.of(SyncopeConstants.ROOT_REALM),
- SearchCond.of(attrIsNotNull),
- Pageable.unpaged(Sort.by(new Sort.Order(Sort.Direction.ASC, "aLong"))));
- assertEquals("two", result.get(0).getName());
- assertEquals("odd", result.get(1).getName());
-
- AttrCond cond1 = new AttrCond(AttrCond.Type.EQ);
- cond1.setSchema("aLong");
- cond1.setExpression("42");
- AttrCond cond2 = new AttrCond(AttrCond.Type.IEQ);
- cond2.setSchema("ctype");
- cond2.setExpression("string");
- assertDoesNotThrow(() -> realmSearchDAO.search(
- Set.of(SyncopeConstants.ROOT_REALM),
- SearchCond.and(SearchCond.of(cond1), SearchCond.of(cond2)),
- Pageable.unpaged()));
- }
}
diff --git a/ext/elasticsearch/client-elasticsearch/src/main/java/org/apache/syncope/ext/elasticsearch/client/ElasticsearchUtils.java b/ext/elasticsearch/client-elasticsearch/src/main/java/org/apache/syncope/ext/elasticsearch/client/ElasticsearchUtils.java
index 146abe8f0f..6b59cc2bda 100644
--- a/ext/elasticsearch/client-elasticsearch/src/main/java/org/apache/syncope/ext/elasticsearch/client/ElasticsearchUtils.java
+++ b/ext/elasticsearch/client-elasticsearch/src/main/java/org/apache/syncope/ext/elasticsearch/client/ElasticsearchUtils.java
@@ -34,6 +34,7 @@ import org.apache.syncope.core.persistence.api.dao.UserDAO;
import org.apache.syncope.core.persistence.api.entity.Any;
import org.apache.syncope.core.persistence.api.entity.AnyTypeClass;
import org.apache.syncope.core.persistence.api.entity.AuditEvent;
+import org.apache.syncope.core.persistence.api.entity.Entity;
import org.apache.syncope.core.persistence.api.entity.Groupable;
import org.apache.syncope.core.persistence.api.entity.PlainAttr;
import org.apache.syncope.core.persistence.api.entity.PlainAttrValue;
@@ -214,6 +215,8 @@ public class ElasticsearchUtils {
builder.put("name", realm.getName());
builder.put("parent_id", realm.getParent() == null ? null : realm.getParent().getKey());
builder.put("fullPath", realm.getFullPath());
+ builder.put("auxClasses", realm.getAnyTypeClasses().stream().map(AnyTypeClass::getKey).toList());
+ builder.put("resources", realm.getResources().stream().map(Entity::getKey).toList());
addPlainAttr(builder, realm.getPlainAttrs());
customizeDocument(builder, realm);
diff --git a/ext/elasticsearch/persistence/src/main/java/org/apache/syncope/core/persistence/elasticsearch/dao/ElasticsearchRealmSearchDAO.java b/ext/elasticsearch/persistence/src/main/java/org/apache/syncope/core/persistence/elasticsearch/dao/ElasticsearchRealmSearchDAO.java
index 395a475646..3808827536 100644
--- a/ext/elasticsearch/persistence/src/main/java/org/apache/syncope/core/persistence/elasticsearch/dao/ElasticsearchRealmSearchDAO.java
+++ b/ext/elasticsearch/persistence/src/main/java/org/apache/syncope/core/persistence/elasticsearch/dao/ElasticsearchRealmSearchDAO.java
@@ -54,6 +54,8 @@ import org.apache.syncope.core.persistence.api.dao.RealmSearchDAO;
import org.apache.syncope.core.persistence.api.dao.UserDAO;
import org.apache.syncope.core.persistence.api.dao.search.AnyCond;
import org.apache.syncope.core.persistence.api.dao.search.AttrCond;
+import org.apache.syncope.core.persistence.api.dao.search.AuxClassCond;
+import org.apache.syncope.core.persistence.api.dao.search.ResourceCond;
import org.apache.syncope.core.persistence.api.dao.search.SearchCond;
import org.apache.syncope.core.persistence.api.entity.EntityFactory;
import org.apache.syncope.core.persistence.api.entity.PlainAttrValue;
@@ -62,7 +64,6 @@ import org.apache.syncope.core.persistence.api.entity.Realm;
import org.apache.syncope.core.persistence.api.utils.FormatUtils;
import org.apache.syncope.core.persistence.api.utils.RealmUtils;
import org.apache.syncope.core.persistence.common.dao.AbstractRealmSearchDAO;
-import org.apache.syncope.core.persistence.common.dao.AbstractSearchDAO.CheckResult;
import org.apache.syncope.core.spring.security.AuthContextUtils;
import org.apache.syncope.ext.elasticsearch.client.ElasticsearchUtils;
import org.slf4j.Logger;
@@ -204,6 +205,12 @@ public class ElasticsearchRealmSearchDAO extends AbstractRealmSearchDAO implemen
switch (cond.getType()) {
case LEAF, NOT_LEAF -> {
query = cond.asLeaf(AnyCond.class).map(this::getQuery).orElse(null);
+ if (query == null) {
+ query = cond.asLeaf(AuxClassCond.class).map(this::getQuery).orElse(null);
+ }
+ if (query == null) {
+ query = cond.asLeaf(ResourceCond.class).map(this::getQuery).orElse(null);
+ }
if (query == null) {
query = cond.asLeaf(AttrCond.class).map(this::getQuery).orElse(null);
}
@@ -375,6 +382,18 @@ public class ElasticsearchRealmSearchDAO extends AbstractRealmSearchDAO implemen
return fillAttrQuery(checked.schema(), checked.value(), checked.cond());
}
+ protected Query getQuery(final AuxClassCond cond) {
+ return new Query.Builder().term(QueryBuilders.term().
+ field("auxClasses").value(cond.getAuxClass()).caseInsensitive(false).build()).
+ build();
+ }
+
+ protected Query getQuery(final ResourceCond cond) {
+ return new Query.Builder().term(QueryBuilders.term().
+ field("resources").value(cond.getResource()).caseInsensitive(false).build()).
+ build();
+ }
+
protected Query getQueryForCustomConds(final SearchCond cond) {
return null;
}
diff --git a/ext/opensearch/client-opensearch/src/main/java/org/apache/syncope/ext/opensearch/client/OpenSearchUtils.java b/ext/opensearch/client-opensearch/src/main/java/org/apache/syncope/ext/opensearch/client/OpenSearchUtils.java
index 22c864f3a2..b206a4e363 100644
--- a/ext/opensearch/client-opensearch/src/main/java/org/apache/syncope/ext/opensearch/client/OpenSearchUtils.java
+++ b/ext/opensearch/client-opensearch/src/main/java/org/apache/syncope/ext/opensearch/client/OpenSearchUtils.java
@@ -34,6 +34,7 @@ import org.apache.syncope.core.persistence.api.dao.UserDAO;
import org.apache.syncope.core.persistence.api.entity.Any;
import org.apache.syncope.core.persistence.api.entity.AnyTypeClass;
import org.apache.syncope.core.persistence.api.entity.AuditEvent;
+import org.apache.syncope.core.persistence.api.entity.Entity;
import org.apache.syncope.core.persistence.api.entity.Groupable;
import org.apache.syncope.core.persistence.api.entity.PlainAttr;
import org.apache.syncope.core.persistence.api.entity.PlainAttrValue;
@@ -214,6 +215,8 @@ public class OpenSearchUtils {
builder.put("name", realm.getName());
builder.put("parent_id", realm.getParent() == null ? null : realm.getParent().getKey());
builder.put("fullPath", realm.getFullPath());
+ builder.put("auxClasses", realm.getAnyTypeClasses().stream().map(AnyTypeClass::getKey).toList());
+ builder.put("resources", realm.getResources().stream().map(Entity::getKey).toList());
addPlainAttr(builder, realm.getPlainAttrs());
customizeDocument(builder, realm);
diff --git a/ext/opensearch/persistence/src/main/java/org/apache/syncope/core/persistence/opensearch/dao/OpenSearchRealmSearchDAO.java b/ext/opensearch/persistence/src/main/java/org/apache/syncope/core/persistence/opensearch/dao/OpenSearchRealmSearchDAO.java
index 6b9415d383..787ec93b27 100644
--- a/ext/opensearch/persistence/src/main/java/org/apache/syncope/core/persistence/opensearch/dao/OpenSearchRealmSearchDAO.java
+++ b/ext/opensearch/persistence/src/main/java/org/apache/syncope/core/persistence/opensearch/dao/OpenSearchRealmSearchDAO.java
@@ -36,6 +36,8 @@ import org.apache.syncope.core.persistence.api.dao.RealmSearchDAO;
import org.apache.syncope.core.persistence.api.dao.UserDAO;
import org.apache.syncope.core.persistence.api.dao.search.AnyCond;
import org.apache.syncope.core.persistence.api.dao.search.AttrCond;
+import org.apache.syncope.core.persistence.api.dao.search.AuxClassCond;
+import org.apache.syncope.core.persistence.api.dao.search.ResourceCond;
import org.apache.syncope.core.persistence.api.dao.search.SearchCond;
import org.apache.syncope.core.persistence.api.entity.EntityFactory;
import org.apache.syncope.core.persistence.api.entity.PlainAttrValue;
@@ -203,6 +205,12 @@ public class OpenSearchRealmSearchDAO extends AbstractRealmSearchDAO implements
switch (cond.getType()) {
case LEAF, NOT_LEAF -> {
query = cond.asLeaf(AnyCond.class).map(this::getQuery).orElse(null);
+ if (query == null) {
+ query = cond.asLeaf(AuxClassCond.class).map(this::getQuery).orElse(null);
+ }
+ if (query == null) {
+ query = cond.asLeaf(ResourceCond.class).map(this::getQuery).orElse(null);
+ }
if (query == null) {
query = cond.asLeaf(AttrCond.class).map(this::getQuery).orElse(null);
}
@@ -370,6 +378,18 @@ public class OpenSearchRealmSearchDAO extends AbstractRealmSearchDAO implements
return fillAttrQuery(checked.schema(), checked.value(), checked.cond());
}
+ protected Query getQuery(final AuxClassCond cond) {
+ return new Query.Builder().term(QueryBuilders.term().
+ field("auxClasses").value(FieldValue.of(cond.getAuxClass())).caseInsensitive(false).build()).
+ build();
+ }
+
+ protected Query getQuery(final ResourceCond cond) {
+ return new Query.Builder().term(QueryBuilders.term().
+ field("resources").value(FieldValue.of(cond.getResource())).caseInsensitive(false).build()).
+ build();
+ }
+
protected Query getQueryForCustomConds(final SearchCond cond) {
return null;
}
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/console/AbstractConsoleITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/console/AbstractConsoleITCase.java
index 3e0590e089..fbdcf8910c 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/console/AbstractConsoleITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/console/AbstractConsoleITCase.java
@@ -67,6 +67,10 @@ import org.springframework.test.context.support.TestPropertySourceUtils;
public abstract class AbstractConsoleITCase extends AbstractUIITCase {
+ protected static final String REALM_PAGE = "body:directoryLI:directoryUL:realmsLI:realms";
+
+ protected static final String ANY_PAGE = "body:directoryLI:directoryUL:anysLI:anys";
+
@ImportAutoConfiguration(classes = {
SelfKeymasterClientContext.class,
ZookeeperKeymasterClientContext.class,
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/console/AjaxBrowseITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/console/AjaxBrowseITCase.java
index 0b5d67dbc3..a3245a25db 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/console/AjaxBrowseITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/console/AjaxBrowseITCase.java
@@ -18,6 +18,7 @@
*/
package org.apache.syncope.fit.console;
+import org.apache.syncope.client.console.pages.Anys;
import org.apache.syncope.client.console.pages.Dashboard;
import org.apache.syncope.client.console.pages.Engagements;
import org.apache.syncope.client.console.pages.Login;
@@ -59,9 +60,12 @@ public class AjaxBrowseITCase extends AbstractConsoleITCase {
TESTER.assertRenderedPage(Dashboard.class);
- TESTER.clickLink("body:realmsLI:realms", false);
+ TESTER.clickLink(REALM_PAGE, false);
TESTER.assertRenderedPage(Realms.class);
+ TESTER.clickLink(ANY_PAGE, false);
+ TESTER.assertRenderedPage(Anys.class);
+
TESTER.clickLink("body:idmPages:0:idmPageLI:idmPage", false);
TESTER.assertRenderedPage(Topology.class);
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/console/AnyObjectsITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/console/AnyObjectsITCase.java
index b10afdd8ee..707a2f6519 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/console/AnyObjectsITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/console/AnyObjectsITCase.java
@@ -31,6 +31,9 @@ import org.junit.jupiter.api.Test;
public class AnyObjectsITCase extends AbstractConsoleITCase {
+ private static final String ANY_OBJECT_TAB =
+ "body:content:body:container:content:tabbedPanel:tabs-container:tabs:2:link";
+
private static final String TAB_PANEL = "body:content:body:container:content:tabbedPanel:panel:searchResult:";
private static final String CONTAINER = TAB_PANEL + "container:content:";
@@ -42,9 +45,9 @@ public class AnyObjectsITCase extends AbstractConsoleITCase {
@Test
public void filteredSearch() {
- TESTER.clickLink("body:realmsLI:realms", false);
+ TESTER.clickLink(ANY_PAGE, false);
- TESTER.clickLink("body:content:body:container:content:tabbedPanel:tabs-container:tabs:3:link");
+ TESTER.clickLink(ANY_OBJECT_TAB);
TESTER.clickLink(
"body:content:body:container:content:tabbedPanel:panel:accordionPanel:tabs:0:title");
@@ -62,8 +65,8 @@ public class AnyObjectsITCase extends AbstractConsoleITCase {
@Test
public void clickToClonePrinter() {
- TESTER.clickLink("body:realmsLI:realms", false);
- TESTER.clickLink("body:content:body:container:content:tabbedPanel:tabs-container:tabs:3:link");
+ TESTER.clickLink(ANY_PAGE, false);
+ TESTER.clickLink(ANY_OBJECT_TAB);
Component component = findComponentByProp("key", CONTAINER
+ ":searchContainer:resultTable:tablePanel:groupForm:checkgroup:dataTable",
@@ -84,8 +87,8 @@ public class AnyObjectsITCase extends AbstractConsoleITCase {
@Test
public void editPrinter() {
- TESTER.clickLink("body:realmsLI:realms", false);
- TESTER.clickLink("body:content:body:container:content:tabbedPanel:tabs-container:tabs:3:link");
+ TESTER.clickLink(ANY_PAGE, false);
+ TESTER.clickLink(ANY_OBJECT_TAB);
Component component = findComponentByProp("key", CONTAINER
+ ":searchContainer:resultTable:tablePanel:groupForm:checkgroup:dataTable",
@@ -136,8 +139,8 @@ public class AnyObjectsITCase extends AbstractConsoleITCase {
@Test
public void checkDeletePrinterLink() {
- TESTER.clickLink("body:realmsLI:realms", false);
- TESTER.clickLink("body:content:body:container:content:tabbedPanel:tabs-container:tabs:3:link");
+ TESTER.clickLink(ANY_PAGE, false);
+ TESTER.clickLink(ANY_OBJECT_TAB);
Component component = findComponentByProp("key", CONTAINER
+ ":searchContainer:resultTable:tablePanel:groupForm:checkgroup:dataTable",
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/console/AnyTypesITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/console/AnyTypesITCase.java
index 530ad77a02..fce753ba1b 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/console/AnyTypesITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/console/AnyTypesITCase.java
@@ -22,7 +22,7 @@ import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertNull;
import de.agilecoders.wicket.core.markup.html.bootstrap.dialog.Modal;
-import org.apache.syncope.client.console.pages.Realms;
+import org.apache.syncope.client.console.pages.Anys;
import org.apache.syncope.client.console.pages.Types;
import org.apache.syncope.client.console.panels.AjaxDataTablePanel;
import org.apache.syncope.client.console.wicket.markup.html.bootstrap.dialog.BaseModal;
@@ -87,10 +87,10 @@ public class AnyTypesITCase extends AbstractTypesITCase {
TESTER.assertLabel(component.getPageRelativePath() + ":cells:3:cell", "[csv]");
// issue SYNCOPE-1111
- TESTER.clickLink("body:realmsLI:realms", false);
- TESTER.assertRenderedPage(Realms.class);
+ TESTER.clickLink(ANY_PAGE, false);
+ TESTER.assertRenderedPage(Anys.class);
TESTER.assertLabel(
- "body:content:body:container:content:tabbedPanel:tabs-container:tabs:4:link:title",
+ "body:content:body:container:content:tabbedPanel:tabs-container:tabs:3:link:title",
anyTypeTest);
}
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/console/BatchesITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/console/BatchesITCase.java
index 20ac76a4b6..96564a85b3 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/console/BatchesITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/console/BatchesITCase.java
@@ -21,6 +21,7 @@ package org.apache.syncope.fit.console;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
+import java.util.stream.Stream;
import org.apache.syncope.client.ui.commons.Constants;
import org.apache.syncope.client.ui.commons.status.Status;
import org.apache.syncope.client.ui.commons.status.StatusBean;
@@ -30,6 +31,9 @@ import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.util.tester.FormTester;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.Arguments;
+import org.junit.jupiter.params.provider.MethodSource;
public class BatchesITCase extends AbstractConsoleITCase {
@@ -44,8 +48,7 @@ public class BatchesITCase extends AbstractConsoleITCase {
@Test
public void users() {
- TESTER.clickLink("body:realmsLI:realms", false);
- TESTER.clickLink("body:content:body:container:content:tabbedPanel:tabs-container:tabs:1:link");
+ TESTER.clickLink(ANY_PAGE, false);
Component component = findComponentByProp("username", CONTAINER
+ "searchContainer:resultTable:tablePanel:groupForm:checkgroup:dataTable", "rossini");
@@ -69,8 +72,7 @@ public class BatchesITCase extends AbstractConsoleITCase {
@Test
public void userResource() {
- TESTER.clickLink("body:realmsLI:realms", false);
- TESTER.clickLink("body:content:body:container:content:tabbedPanel:tabs-container:tabs:1:link");
+ TESTER.clickLink(ANY_PAGE, false);
Component component = findComponentByProp("username", CONTAINER
+ ":searchContainer:resultTable:tablePanel:groupForm:checkgroup:dataTable", "rossini");
@@ -111,20 +113,18 @@ public class BatchesITCase extends AbstractConsoleITCase {
+ "form:content:status:secondLevelContainer:second:container", "resource-csv"));
}
- @Test
- public void userStatus() {
- userStatusBatch(1, "resource-testdb2");
- }
-
- @Test
- public void userStatusOnSyncopeOnly() {
- userStatusBatch(0, Constants.SYNCOPE);
+ private static Stream<Arguments> userStatusProvider() {
+ return Stream.of(
+ Arguments.of(1, "resource-testdb2"),
+ Arguments.of(0, Constants.SYNCOPE)
+ );
}
- private static void userStatusBatch(final int index, final String resource) {
+ @ParameterizedTest
+ @MethodSource("userStatusProvider")
+ void userStatusBatch(final int index, final String resource) {
// suspend
- TESTER.clickLink("body:realmsLI:realms", false);
- TESTER.clickLink("body:content:body:container:content:tabbedPanel:tabs-container:tabs:1:link");
+ TESTER.clickLink(ANY_PAGE, false);
Component component = findComponentByProp("username", CONTAINER
+ ":searchContainer:resultTable:tablePanel:groupForm:checkgroup:dataTable", "rossini");
@@ -190,8 +190,7 @@ public class BatchesITCase extends AbstractConsoleITCase {
assertEquals(resource, StatusBean.class.cast(component.getDefaultModelObject()).getResource());
// re-activate
- TESTER.clickLink("body:realmsLI:realms", false);
- TESTER.clickLink("body:content:body:container:content:tabbedPanel:tabs-container:tabs:1:link");
+ TESTER.clickLink(ANY_PAGE, false);
component = findComponentByProp("username", CONTAINER
+ ":searchContainer:resultTable:tablePanel:groupForm:checkgroup:dataTable", "rossini");
@@ -254,8 +253,8 @@ public class BatchesITCase extends AbstractConsoleITCase {
@Test
public void groupResource() {
- TESTER.clickLink("body:realmsLI:realms", false);
- TESTER.clickLink("body:content:body:container:content:tabbedPanel:tabs-container:tabs:2:link");
+ TESTER.clickLink(ANY_PAGE, false);
+ TESTER.clickLink("body:content:body:container:content:tabbedPanel:tabs-container:tabs:1:link");
Component component = findComponentByProp("name", CONTAINER
+ ":searchContainer:resultTable:tablePanel:groupForm:checkgroup:dataTable", "director");
@@ -303,8 +302,8 @@ public class BatchesITCase extends AbstractConsoleITCase {
@Test
public void printerResource() {
- TESTER.clickLink("body:realmsLI:realms", false);
- TESTER.clickLink("body:content:body:container:content:tabbedPanel:tabs-container:tabs:3:link");
+ TESTER.clickLink(ANY_PAGE, false);
+ TESTER.clickLink("body:content:body:container:content:tabbedPanel:tabs-container:tabs:2:link");
Component component = findComponentByProp("key", CONTAINER
+ ":searchContainer:resultTable:tablePanel:groupForm:checkgroup:dataTable",
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/console/DisplayAttributesITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/console/DisplayAttributesITCase.java
index b3ac49108e..51cd6032de 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/console/DisplayAttributesITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/console/DisplayAttributesITCase.java
@@ -19,7 +19,7 @@
package org.apache.syncope.fit.console;
import de.agilecoders.wicket.core.markup.html.bootstrap.dialog.Modal;
-import org.apache.syncope.client.console.pages.Realms;
+import org.apache.syncope.client.console.pages.Anys;
import org.apache.wicket.util.tester.FormTester;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
@@ -29,13 +29,13 @@ public class DisplayAttributesITCase extends AbstractConsoleITCase {
@BeforeEach
public void login() {
doLogin(ADMIN_UNAME, ADMIN_PWD);
- TESTER.clickLink("body:realmsLI:realms", false);
- TESTER.assertRenderedPage(Realms.class);
+ TESTER.clickLink(ANY_PAGE, false);
+ TESTER.assertRenderedPage(Anys.class);
}
@Test
public void readAndSet() {
- TESTER.clickLink("body:content:body:container:content:tabbedPanel:tabs-container:tabs:3:link");
+ TESTER.clickLink("body:content:body:container:content:tabbedPanel:tabs-container:tabs:2:link");
TESTER.clickLink(
"body:content:body:container:content:tabbedPanel:panel:searchResult:container:content:"
+ "searchContainer:tablehandling:actionRepeater:1:action:action");
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/console/GroupsITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/console/GroupsITCase.java
index a4ebf82b78..8b14bae4bc 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/console/GroupsITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/console/GroupsITCase.java
@@ -33,6 +33,9 @@ import org.junit.jupiter.api.Test;
public class GroupsITCase extends AbstractConsoleITCase {
+ private static final String GROUP_TAB =
+ "body:content:body:container:content:tabbedPanel:tabs-container:tabs:1:link";
+
private static final String TAB_PANEL = "body:content:body:container:content:tabbedPanel:panel:searchResult:";
private static final String CONTAINER = TAB_PANEL + "container:content:";
@@ -44,8 +47,8 @@ public class GroupsITCase extends AbstractConsoleITCase {
@Test
public void read() {
- TESTER.clickLink("body:realmsLI:realms", false);
- TESTER.clickLink("body:content:body:container:content:tabbedPanel:tabs-container:tabs:2:link");
+ TESTER.clickLink(ANY_PAGE, false);
+ TESTER.clickLink(GROUP_TAB);
Component component = findComponentByProp("name", CONTAINER
+ ":searchContainer:resultTable:tablePanel:groupForm:checkgroup:dataTable", "artDirector");
@@ -74,8 +77,8 @@ public class GroupsITCase extends AbstractConsoleITCase {
@Test
public void filteredSearch() {
- TESTER.clickLink("body:realmsLI:realms", false);
- TESTER.clickLink("body:content:body:container:content:tabbedPanel:tabs-container:tabs:2:link");
+ TESTER.clickLink(ANY_PAGE, false);
+ TESTER.clickLink(GROUP_TAB);
TESTER.clickLink(
"body:content:body:container:content:tabbedPanel:panel:accordionPanel:tabs:0:title");
@@ -92,8 +95,8 @@ public class GroupsITCase extends AbstractConsoleITCase {
}
private static void cloneGroup(final String group) {
- TESTER.clickLink("body:realmsLI:realms", false);
- TESTER.clickLink("body:content:body:container:content:tabbedPanel:tabs-container:tabs:2:link");
+ TESTER.clickLink(ANY_PAGE, false);
+ TESTER.clickLink(GROUP_TAB);
Component component = findComponentByProp("name", CONTAINER
+ ":searchContainer:resultTable:tablePanel:groupForm:checkgroup:dataTable", group);
@@ -227,8 +230,8 @@ public class GroupsITCase extends AbstractConsoleITCase {
@Test
public void checkDeleteGroupLink() {
- TESTER.clickLink("body:realmsLI:realms", false);
- TESTER.clickLink("body:content:body:container:content:tabbedPanel:tabs-container:tabs:2:link");
+ TESTER.clickLink(ANY_PAGE, false);
+ TESTER.clickLink(GROUP_TAB);
Component component = findComponentByProp("name", CONTAINER
+ ":searchContainer:resultTable:tablePanel:groupForm:checkgroup:dataTable", "director");
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/console/LinkedAccountsITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/console/LinkedAccountsITCase.java
index 8a0fc795fa..85a3cef742 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/console/LinkedAccountsITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/console/LinkedAccountsITCase.java
@@ -112,8 +112,8 @@ public class LinkedAccountsITCase extends AbstractConsoleITCase {
@Test
public void createLinkedAccountAndMergeWithUser() {
// Locate and select first user
- TESTER.clickLink("body:realmsLI:realms", false);
- TESTER.clickLink("body:content:body:container:content:tabbedPanel:tabs-container:tabs:1:link");
+ TESTER.clickLink(ANY_PAGE, false);
+ TESTER.clickLink("body:content:body:container:content:tabbedPanel:tabs-container:tabs:0:link");
Component verdiUserComponent = findComponentByProp("username", CONTAINER
+ ":searchContainer:resultTable:tablePanel:groupForm:checkgroup:dataTable", "verdi");
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/console/PoliciesITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/console/PoliciesITCase.java
index fede1e7739..ac0c5ad673 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/console/PoliciesITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/console/PoliciesITCase.java
@@ -25,8 +25,10 @@ import de.agilecoders.wicket.core.markup.html.bootstrap.dialog.Modal;
import org.apache.syncope.client.console.pages.Policies;
import org.apache.syncope.client.console.pages.Realms;
import org.apache.syncope.client.ui.commons.Constants;
+import org.apache.syncope.common.lib.SyncopeConstants;
import org.apache.wicket.Component;
import org.apache.wicket.markup.html.WebMarkupContainer;
+import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.form.TextField;
import org.apache.wicket.util.tester.FormTester;
import org.junit.jupiter.api.BeforeEach;
@@ -738,34 +740,40 @@ public class PoliciesITCase extends AbstractConsoleITCase {
composeDefaultAccountPolicy(name);
// goto realms
- TESTER.clickLink("body:realmsLI:realms", false);
+ TESTER.clickLink(REALM_PAGE, false);
TESTER.assertRenderedPage(Realms.class);
// edit root realm
- TESTER.clickLink("body:content:body:container:content:tabbedPanel:panel:"
- + "actionsPanel:actions:actionRepeater:1:action:action");
- TESTER.assertComponent("body:content:body:outerObjectsRepeater:0:outer", Modal.class);
+ Component component = findComponentByProp("name",
+ "body:directoryPanel:container:content:searchContainer:resultTable"
+ + ":tablePanel:groupForm:checkgroup:dataTable", SyncopeConstants.ROOT_REALM);
+ TESTER.executeAjaxEvent(component.getPageRelativePath(), Constants.ON_CLICK);
+ TESTER.clickLink("body:directoryPanel:outerObjectsRepeater:1:outer:container:content:"
+ + "togglePanelContainer:container:actions:actions:actionRepeater:1:action:action");
+ TESTER.assertComponent("body:directoryPanel:outerObjectsRepeater:0:outer:dialog:header:header-label",
+ Label.class);
+ TESTER.assertLabel("body:directoryPanel:outerObjectsRepeater:0:outer:dialog:header:header-label",
+ "Edit Realm /");
// set new account policy
- TESTER.assertLabel("body:content:body:outerObjectsRepeater:0:outer:form:content:form:view:details:container:"
- + "policies:1:field-label", "Account Policy");
+ TESTER.assertComponent("body:directoryPanel:outerObjectsRepeater:0:outer:form:content:"
+ + "form:view:details:container:policies:1:field-label", Label.class);
+ TESTER.assertLabel("body:directoryPanel:outerObjectsRepeater:0:outer:form:content:"
+ + "form:view:details:container:policies:1:field-label", "Account policy");
FormTester formTester = TESTER.newFormTester(
- "body:content:body:outerObjectsRepeater:0:outer:form:content:form");
+ "body:directoryPanel:outerObjectsRepeater:0:outer:form:content:form");
formTester.select("view:details:container:policies:1:dropDownChoiceField", 0);
formTester.submit("buttons:finish");
assertSuccessMessage();
TESTER.cleanupFeedbackMessages();
- TESTER.executeAjaxEvent(
- "body:content:body:outerObjectsRepeater:0:outer:form:content:action:actionRepeater:0:action:action",
- Constants.ON_CLICK);
+ //navigate to Any Page (default: UserTab)
+ TESTER.clickLink(ANY_PAGE, false);
// create user with a valid account name
- TESTER.clickLink("body:content:body:container:content:tabbedPanel:tabs-container:tabs:1:link");
-
- Component component = findComponentByProp("username",
+ component = findComponentByProp("username",
"body:content:body:container:content:tabbedPanel:panel:searchResult:container:content:"
+ ":searchContainer:resultTable:tablePanel:groupForm:checkgroup:dataTable", "rossini");
assertNotNull(component);
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/console/RealmsITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/console/RealmsITCase.java
index 8190ec1d06..478923c43a 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/console/RealmsITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/console/RealmsITCase.java
@@ -18,15 +18,17 @@
*/
package org.apache.syncope.fit.console;
-import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNotNull;
-import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertNull;
import de.agilecoders.wicket.core.markup.html.bootstrap.dialog.Modal;
import org.apache.syncope.client.console.pages.Realms;
import org.apache.syncope.client.console.panels.TogglePanel;
import org.apache.syncope.client.ui.commons.Constants;
+import org.apache.syncope.common.lib.SyncopeConstants;
+import org.apache.syncope.common.lib.types.ResourceOperation;
import org.apache.wicket.Component;
+import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.util.tester.FormTester;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
@@ -36,129 +38,119 @@ public class RealmsITCase extends AbstractConsoleITCase {
@BeforeEach
public void login() {
doLogin(ADMIN_UNAME, ADMIN_PWD);
- TESTER.clickLink("body:realmsLI:realms", false);
+ TESTER.clickLink(REALM_PAGE, false);
TESTER.assertRenderedPage(Realms.class);
}
@Test
public void read() {
- TESTER.assertLabel(
- "body:content:body:container:content:tabbedPanel:panel:container:policies:1:field-label",
- "Account Policy");
+ assertNotNull(findComponentByProp("name", "body:directoryPanel:container:content:searchContainer"
+ + ":resultTable:tablePanel:groupForm:checkgroup:dataTable", SyncopeConstants.ROOT_REALM));
}
@Test
public void create() {
- TESTER.clickLink("body:content:body:container:content:tabbedPanel:panel:"
- + "actionsPanel:actions:actionRepeater:0:action:action");
- TESTER.assertComponent("body:content:body:outerObjectsRepeater:0:outer", Modal.class);
+ String newRealmName = "testRealm";
+ TESTER.clickLink("body:directoryPanel:container:content:add");
+ TESTER.assertComponent("body:directoryPanel:outerObjectsRepeater:0:outer", Modal.class);
+ TESTER.assertComponent("body:directoryPanel:outerObjectsRepeater:0:outer:dialog:header:header-label",
+ Label.class);
+ TESTER.assertLabel("body:directoryPanel:outerObjectsRepeater:0:outer:dialog:header:header-label",
+ "New Realm");
FormTester formTester = TESTER.newFormTester(
- "body:content:body:outerObjectsRepeater:0:outer:form:content:form");
- formTester.setValue("view:details:container:generics:name:textField", "testRealm");
-
+ "body:directoryPanel:outerObjectsRepeater:0:outer:form:content:form");
+ formTester.setValue("view:details:container:generics:name:textField", newRealmName);
formTester.submit("buttons:finish");
assertSuccessMessage();
TESTER.cleanupFeedbackMessages();
- TESTER.executeAjaxEvent(
- "body:content:body:outerObjectsRepeater:0:outer:form:content:action:actionRepeater:"
- + "0:action:action", Constants.ON_CLICK);
+ TESTER.executeAjaxEvent("body:directoryPanel:outerObjectsRepeater:0:outer:form:content:"
+ + "action:actionRepeater:0:action:action", Constants.ON_CLICK);
// remove the new realm just created
- TESTER.clickLink("body:realmsLI:realms", false);
-
- TESTER.executeAjaxEvent(
- "body:content:realmChoicePanel:container:realmsFragment:realms:btn", Constants.ON_CLICK);
- TESTER.executeAjaxEvent(
- "body:content:realmChoicePanel:container:realmsFragment:realms:dropdown-menu:buttons:5:button",
- Constants.ON_CLICK);
-
- assertTrue(TESTER.getLastResponseAsString().contains(">/</a>"));
- assertTrue(TESTER.getLastResponseAsString().contains(">testRealm</a>"));
+ Component component = findComponentByProp("name",
+ "body:directoryPanel:container:content:searchContainer:resultTable:tablePanel:groupForm"
+ + ":checkgroup:dataTable", newRealmName);
+ TESTER.executeAjaxEvent(component.getPageRelativePath(), Constants.ON_CLICK);
+ TESTER.clickLink("body:directoryPanel:outerObjectsRepeater:1:outer:container:content:"
+ + "togglePanelContainer:container:actions:actions:actionRepeater:7:action:action");
TESTER.getRequest().addParameter("confirm", "true");
- TESTER.clickLink("body:content:body:container:content:tabbedPanel:panel:"
- + "actionsPanel:actions:actionRepeater:4:action:action");
-
- assertSuccessMessage();
- TESTER.cleanupFeedbackMessages();
- TESTER.assertLabel(
- "body:content:body:container:content:tabbedPanel:panel:container:policies:1:field-label",
- "Account Policy");
-
- assertTrue(TESTER.getLastResponseAsString().contains(">/</a>"));
- assertFalse(TESTER.getLastResponseAsString().contains(">testRealm</a>"));
+ component = findComponentByProp("name",
+ "body:directoryPanel:container:content:searchContainer:resultTable:tablePanel:groupForm"
+ + ":checkgroup:dataTable", newRealmName);
+ assertNull(component);
}
@Test
public void update() {
- TESTER.clickLink("body:content:body:container:content:tabbedPanel:panel:"
- + "actionsPanel:actions:actionRepeater:1:action:action");
- TESTER.assertComponent("body:content:body:outerObjectsRepeater:0:outer", Modal.class);
+ Component component = findComponentByProp("name",
+ "body:directoryPanel:container:content:searchContainer:resultTable:tablePanel:groupForm"
+ + ":checkgroup:dataTable", "odd");
+ TESTER.executeAjaxEvent(component.getPageRelativePath(), Constants.ON_CLICK);
+ TESTER.clickLink("body:directoryPanel:outerObjectsRepeater:1:outer:container:content:"
+ + "togglePanelContainer:container:actions:actions:actionRepeater:1:action:action");
+ TESTER.assertComponent("body:directoryPanel:outerObjectsRepeater:0:outer", Modal.class);
+ TESTER.assertComponent("body:directoryPanel:outerObjectsRepeater:0:outer:dialog:header:header-label",
+ Label.class);
+ TESTER.assertLabel("body:directoryPanel:outerObjectsRepeater:0:outer:dialog:header:header-label",
+ "Edit Realm /odd");
FormTester formTester = TESTER.newFormTester(
- "body:content:body:outerObjectsRepeater:0:outer:form:content:form");
+ "body:directoryPanel:outerObjectsRepeater:0:outer:form:content:form");
formTester.submit("buttons:finish");
assertSuccessMessage();
TESTER.cleanupFeedbackMessages();
- TESTER.executeAjaxEvent(
- "body:content:body:outerObjectsRepeater:0:outer:form:content:action:actionRepeater:"
- + "0:action:action", Constants.ON_CLICK);
+ TESTER.executeAjaxEvent("body:directoryPanel:outerObjectsRepeater:0:outer:form:content:"
+ + "action:actionRepeater:0:action:action", Constants.ON_CLICK);
}
@Test
public void addUserTemplate() {
- TESTER.executeAjaxEvent(
- "body:content:realmChoicePanel:container:realmsFragment:realms:btn",
- Constants.ON_CLICK);
- TESTER.executeAjaxEvent(
- "body:content:realmChoicePanel:container:realmsFragment:realms:dropdown-menu:buttons:4:button",
- Constants.ON_CLICK);
-
- assertTrue(TESTER.getLastResponseAsString().contains(">/</a>"));
- assertTrue(TESTER.getLastResponseAsString().contains(">odd</a>"));
+ Component component = findComponentByProp("name",
+ "body:directoryPanel:container:content:searchContainer:resultTable:tablePanel:groupForm"
+ + ":checkgroup:dataTable", "odd");
+ TESTER.executeAjaxEvent(component.getPageRelativePath(), Constants.ON_CLICK);
+ TESTER.clickLink("body:directoryPanel:outerObjectsRepeater:1:outer:container:content:"
+ + "togglePanelContainer:container:actions:actions:actionRepeater:5:action:action");
- TESTER.clickLink("body:content:body:container:content:tabbedPanel:panel:"
- + "actionsPanel:actions:actionRepeater:2:action:action");
- TESTER.assertComponent("body:content:toggleTemplates", TogglePanel.class);
+ TESTER.assertComponent("body:toggleTemplates", TogglePanel.class);
FormTester formTester = TESTER.newFormTester(
- "body:content:toggleTemplates:container:content:togglePanelContainer:templatesForm");
+ "body:toggleTemplates:container:content:togglePanelContainer:templatesForm");
formTester.setValue("type:dropDownChoiceField", "0");
formTester.submit("changeit");
- TESTER.assertComponent("body:content:templateModal", Modal.class);
+ TESTER.assertComponent("body:templateModal", Modal.class);
- formTester = TESTER.newFormTester("body:content:templateModal:form:content:form");
+ formTester = TESTER.newFormTester("body:templateModal:form:content:form");
formTester.setValue("view:username:textField", "'k' + firstname");
formTester.submit("buttons:finish");
assertSuccessMessage();
TESTER.cleanupFeedbackMessages();
- assertTrue(TESTER.getLastResponseAsString().contains(">/</a>"));
- assertTrue(TESTER.getLastResponseAsString().contains(">odd</a>"));
-
- TESTER.clickLink("body:content:body:container:content:tabbedPanel:panel:"
- + "actionsPanel:actions:actionRepeater:2:action:action");
- TESTER.assertComponent("body:content:toggleTemplates", TogglePanel.class);
+ TESTER.executeAjaxEvent(component.getPageRelativePath(), Constants.ON_CLICK);
+ TESTER.clickLink("body:directoryPanel:outerObjectsRepeater:1:outer:container:content:"
+ + "togglePanelContainer:container:actions:actions:actionRepeater:5:action:action");
+ TESTER.assertComponent("body:toggleTemplates", TogglePanel.class);
formTester = TESTER.newFormTester(
- "body:content:toggleTemplates:container:content:togglePanelContainer:templatesForm");
+ "body:toggleTemplates:container:content:togglePanelContainer:templatesForm");
formTester.setValue("type:dropDownChoiceField", "0");
formTester.submit("changeit");
- TESTER.assertComponent("body:content:templateModal", Modal.class);
+ TESTER.assertComponent("body:templateModal", Modal.class);
- TESTER.assertModelValue("body:content:templateModal:form:content:form:view:username:textField",
+ TESTER.assertModelValue("body:templateModal:form:content:form:view:username:textField",
"'k' + firstname");
- formTester = TESTER.newFormTester("body:content:templateModal:form:content:form");
+ formTester = TESTER.newFormTester("body:templateModal:form:content:form");
formTester.setValue("view:username:textField", "");
formTester.submit("buttons:finish");
@@ -168,21 +160,24 @@ public class RealmsITCase extends AbstractConsoleITCase {
@Test
public void verifyPropagation() {
- TESTER.executeAjaxEvent("body:content:realmChoicePanel:container"
- + ":realmsFragment:realms:btn", Constants.ON_CLICK);
- TESTER.executeAjaxEvent("body:content:realmChoicePanel:container"
- + ":realmsFragment:realms:dropdown-menu:buttons:2:button",
- Constants.ON_CLICK);
-
- TESTER.clickLink("body:content:body:container:content:tabbedPanel:panel:"
- + "actionsPanel:actions:actionRepeater:1:action:action");
- TESTER.assertComponent("body:content:body:outerObjectsRepeater:0:outer", Modal.class);
- TESTER.assertModelValue(
- "body:content:body:outerObjectsRepeater:0:outer:form:content:form:view:details:"
- + "container:generics:name:textField", "even");
+ // ----------------------------------
+ // Associate the resource with a realm
+ // ----------------------------------
+ Component component = findComponentByProp("name",
+ "body:directoryPanel:container:content:searchContainer:resultTable:tablePanel:groupForm"
+ + ":checkgroup:dataTable", "even");
+ TESTER.executeAjaxEvent(component.getPageRelativePath(), Constants.ON_CLICK);
+ TESTER.clickLink("body:directoryPanel:outerObjectsRepeater:1:outer:container:content:"
+ + "togglePanelContainer:container:actions:actions:actionRepeater:1:action:action");
+
+ TESTER.assertComponent("body:directoryPanel:outerObjectsRepeater:0:outer", Modal.class);
+ TESTER.assertComponent("body:directoryPanel:outerObjectsRepeater:0:outer:dialog:header:header-label",
+ Label.class);
+ TESTER.assertLabel("body:directoryPanel:outerObjectsRepeater:0:outer:dialog:header:header-label",
+ "Edit Realm /even");
FormTester formTester = TESTER.newFormTester(
- "body:content:body:outerObjectsRepeater:0:outer:form:content:form");
+ "body:directoryPanel:outerObjectsRepeater:0:outer:form:content:form");
formTester.setValue("view:details:container:resources:paletteField:recorder", "resource-ldap-orgunit");
formTester.submit("buttons:finish");
@@ -193,49 +188,53 @@ public class RealmsITCase extends AbstractConsoleITCase {
// ----------------------------------
// Check for propagation results
// ----------------------------------
- Component component = findComponentByProp("resource",
- "body:content:body:outerObjectsRepeater:0:outer:form:"
- + "content:customResultBody:firstLevelContainer:first:container", "resource-ldap-orgunit");
+ component = findComponentByProp("resource",
+ "body:directoryPanel:outerObjectsRepeater:0:outer:form:content:customResultBody"
+ + ":firstLevelContainer:first:container:content:group", "resource-ldap-orgunit");
TESTER.clickLink(component.getPageRelativePath() + ":actions:actionRepeater:0:action:action");
TESTER.assertLabel(
- "body:content:body:outerObjectsRepeater:0:outer:form:content:customResultBody:"
+ "body:directoryPanel:outerObjectsRepeater:0:outer:form:content:customResultBody:"
+ "secondLevelContainer:second:remoteObject:propView:0:value:leftAttribute:field-label", "__NAME__");
TESTER.assertModelValue(
- "body:content:body:outerObjectsRepeater:0:outer:form:content:customResultBody:"
+ "body:directoryPanel:outerObjectsRepeater:0:outer:form:content:customResultBody:"
+ "secondLevelContainer:second:remoteObject:propView:0:value:leftAttribute:textField", null);
TESTER.assertLabel(
- "body:content:body:outerObjectsRepeater:0:outer:form:content:customResultBody:"
+ "body:directoryPanel:outerObjectsRepeater:0:outer:form:content:customResultBody:"
+ "secondLevelContainer:second:remoteObject:propView:0:value:rightAttribute:field-label", "__NAME__");
TESTER.assertModelValue(
- "body:content:body:outerObjectsRepeater:0:outer:form:content:customResultBody:"
+ "body:directoryPanel:outerObjectsRepeater:0:outer:form:content:customResultBody:"
+ "secondLevelContainer:second:remoteObject:propView:0:value:rightAttribute:textField",
"ou=even,o=isp");
- TESTER.clickLink("body:content:body:outerObjectsRepeater:0:outer:form:content:customResultBody:"
+ TESTER.clickLink("body:directoryPanel:outerObjectsRepeater:0:outer:form:content:customResultBody:"
+ "secondLevelContainer:back");
- assertNotNull(findComponentByProp("resource", "body:content:body:outerObjectsRepeater:0:outer:form:"
+ assertNotNull(findComponentByProp("resource", "body:directoryPanel:outerObjectsRepeater:0:outer:form:"
+ "content:customResultBody:firstLevelContainer:first:container", "resource-ldap-orgunit"));
- // ----------------------------------
TESTER.executeAjaxEvent(
- "body:content:body:outerObjectsRepeater:0:outer:form:content:action:actionRepeater:"
+ "body:directoryPanel:outerObjectsRepeater:0:outer:form:content:action:actionRepeater:"
+ "0:action:action", Constants.ON_CLICK);
+ // ----------------------------------
+ // Dissociate the resource from the realm
+ // ----------------------------------
+ TESTER.executeAjaxEvent(component.getPageRelativePath(), Constants.ON_CLICK);
+ TESTER.clickLink("body:directoryPanel:outerObjectsRepeater:1:outer:container:content:"
+ + "togglePanelContainer:container:actions:actions:actionRepeater:1:action:action");
- TESTER.clickLink("body:content:body:container:content:tabbedPanel:panel:"
- + "actionsPanel:actions:actionRepeater:1:action:action");
- TESTER.assertComponent("body:content:body:outerObjectsRepeater:0:outer", Modal.class);
- TESTER.assertModelValue(
- "body:content:body:outerObjectsRepeater:0:outer:form:content:form:view:details:"
- + "container:generics:name:textField", "even");
+ TESTER.assertComponent("body:directoryPanel:outerObjectsRepeater:0:outer", Modal.class);
+ TESTER.assertComponent("body:directoryPanel:outerObjectsRepeater:0:outer:dialog:header:header-label",
+ Label.class);
+ TESTER.assertLabel("body:directoryPanel:outerObjectsRepeater:0:outer:dialog:header:header-label",
+ "Edit Realm /even");
formTester = TESTER.newFormTester(
- "body:content:body:outerObjectsRepeater:0:outer:form:content:form");
+ "body:directoryPanel:outerObjectsRepeater:0:outer:form:content:form");
formTester.setValue("view:details:container:resources:paletteField:recorder", "");
formTester.submit("buttons:finish");
@@ -246,36 +245,76 @@ public class RealmsITCase extends AbstractConsoleITCase {
// ----------------------------------
// Check for propagation results
// ----------------------------------
- component = findComponentByProp("resource", "body:content:body:outerObjectsRepeater:0:outer:form:"
+ component = findComponentByProp("resource", "body:directoryPanel:outerObjectsRepeater:0:outer:form:"
+ "content:customResultBody:firstLevelContainer:first:container", "resource-ldap-orgunit");
TESTER.clickLink(component.getPageRelativePath() + ":actions:actionRepeater:0:action:action");
TESTER.assertLabel(
- "body:content:body:outerObjectsRepeater:0:outer:form:content:customResultBody:"
+ "body:directoryPanel:outerObjectsRepeater:0:outer:form:content:customResultBody:"
+ "secondLevelContainer:second:remoteObject:propView:5:value:leftAttribute:field-label", "ou");
TESTER.assertModelValue(
- "body:content:body:outerObjectsRepeater:0:outer:form:content:customResultBody:"
+ "body:directoryPanel:outerObjectsRepeater:0:outer:form:content:customResultBody:"
+ "secondLevelContainer:second:remoteObject:propView:5:value:leftAttribute:textField", "even");
TESTER.assertLabel(
- "body:content:body:outerObjectsRepeater:0:outer:form:content:customResultBody:"
+ "body:directoryPanel:outerObjectsRepeater:0:outer:form:content:customResultBody:"
+ "secondLevelContainer:second:remoteObject:propView:5:value:rightAttribute:field-label", "ou");
TESTER.assertModelValue(
- "body:content:body:outerObjectsRepeater:0:outer:form:content:customResultBody:"
+ "body:directoryPanel:outerObjectsRepeater:0:outer:form:content:customResultBody:"
+ "secondLevelContainer:second:remoteObject:propView:5:value:rightAttribute:textField", null);
- TESTER.clickLink("body:content:body:outerObjectsRepeater:0:outer:form:content:customResultBody:"
+ TESTER.clickLink("body:directoryPanel:outerObjectsRepeater:0:outer:form:content:customResultBody:"
+ "secondLevelContainer:back");
- assertNotNull(findComponentByProp("resource", "body:content:body:outerObjectsRepeater:0:outer:form:"
+ assertNotNull(findComponentByProp("resource", "body:directoryPanel:outerObjectsRepeater:0:outer:form:"
+ "content:customResultBody:firstLevelContainer:first:container", "resource-ldap-orgunit"));
- // ----------------------------------
TESTER.executeAjaxEvent(
- "body:content:body:outerObjectsRepeater:0:outer:form:content:action:actionRepeater:"
+ "body:directoryPanel:outerObjectsRepeater:0:outer:form:content:action:actionRepeater:"
+ "0:action:action", Constants.ON_CLICK);
+
+ // ----------------------------------
+ // Check that 2 propagations have been recorded
+ // ----------------------------------
+
+ TESTER.executeAjaxEvent(component.getPageRelativePath(), Constants.ON_CLICK);
+ TESTER.clickLink("body:directoryPanel:outerObjectsRepeater:1:outer:container:content:"
+ + "togglePanelContainer:container:actions:actions:actionRepeater:3:action:action");
+
+ TESTER.assertComponent("body:directoryPanel:outerObjectsRepeater:4:outer", Modal.class);
+ TESTER.assertComponent("body:directoryPanel:outerObjectsRepeater:4:outer:dialog:header:header-label",
+ Label.class);
+ TESTER.assertLabel("body:directoryPanel:outerObjectsRepeater:4:outer:dialog:header:header-label",
+ "Propagation tasks for realm /even");
+
+ component = findComponentByProp("operation", "body:directoryPanel:outerObjectsRepeater:4:outer:"
+ + "form:content:tasks:firstLevelContainer:first:container:content:searchContainer:resultTable:"
+ + "tablePanel:groupForm:checkgroup:dataTable", ResourceOperation.CREATE);
+
+ assertNotNull(component);
+
+ TESTER.executeAjaxEvent(component.getPageRelativePath(), Constants.ON_CLICK);
+ TESTER.clickLink("body:directoryPanel:outerObjectsRepeater:4:outer:form:content:tasks:firstLevelContainer:"
+ + "first:outerObjectsRepeater:1:outer:container:content:togglePanelContainer:container:actions:"
+ + "actions:actionRepeater:3:action:action");
+ TESTER.getRequest().addParameter("confirm", "true");
+
+ component = findComponentByProp("operation", "body:directoryPanel:outerObjectsRepeater:4:outer:"
+ + "form:content:tasks:firstLevelContainer:first:container:content:searchContainer:resultTable:"
+ + "tablePanel:groupForm:checkgroup:dataTable", ResourceOperation.DELETE);
+
+ assertNotNull(component);
+
+ TESTER.executeAjaxEvent(component.getPageRelativePath(), Constants.ON_CLICK);
+ TESTER.clickLink("body:directoryPanel:outerObjectsRepeater:4:outer:form:content:tasks:firstLevelContainer:"
+ + "first:outerObjectsRepeater:1:outer:container:content:togglePanelContainer:container:actions:"
+ + "actions:actionRepeater:3:action:action");
+ TESTER.getRequest().addParameter("confirm", "true");
+
+ TESTER.executeAjaxEvent("body:directoryPanel:outerObjectsRepeater:4:outer:dialog:footer:buttons:0:button",
+ Constants.ON_CLICK);
}
}
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/console/UsersITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/console/UsersITCase.java
index 6d9e17405c..8223b93901 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/console/UsersITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/console/UsersITCase.java
@@ -35,6 +35,8 @@ import org.junit.jupiter.api.Test;
public class UsersITCase extends AbstractConsoleITCase {
+ private static final String USER_TAB = "body:content:body:container:content:tabbedPanel:tabs-container:tabs:0:link";
+
private static final String TAB_PANEL = "body:content:body:container:content:tabbedPanel:panel:searchResult:";
private static final String CONTAINER = TAB_PANEL + "container:content:";
@@ -46,8 +48,8 @@ public class UsersITCase extends AbstractConsoleITCase {
@Test
public void filteredSearch() {
- TESTER.clickLink("body:realmsLI:realms", false);
- TESTER.clickLink("body:content:body:container:content:tabbedPanel:tabs-container:tabs:1:link");
+ TESTER.clickLink(ANY_PAGE, false);
+ TESTER.clickLink(USER_TAB);
TESTER.clickLink(
"body:content:body:container:content:tabbedPanel:panel:accordionPanel:tabs:0:title");
@@ -69,8 +71,8 @@ public class UsersITCase extends AbstractConsoleITCase {
@Test
public void forceChangePassword() {
- TESTER.clickLink("body:realmsLI:realms", false);
- TESTER.clickLink("body:content:body:container:content:tabbedPanel:tabs-container:tabs:1:link");
+ TESTER.clickLink(ANY_PAGE, false);
+ TESTER.clickLink(USER_TAB);
Component component = findComponentByProp("username", CONTAINER
+ ":searchContainer:resultTable:tablePanel:groupForm:checkgroup:dataTable", "verdi");
@@ -86,8 +88,8 @@ public class UsersITCase extends AbstractConsoleITCase {
@Test
public void clickToCloneUser() {
- TESTER.clickLink("body:realmsLI:realms", false);
- TESTER.clickLink("body:content:body:container:content:tabbedPanel:tabs-container:tabs:1:link");
+ TESTER.clickLink(ANY_PAGE, false);
+ TESTER.clickLink(USER_TAB);
Component component = findComponentByProp("username", CONTAINER
+ ":searchContainer:resultTable:tablePanel:groupForm:checkgroup:dataTable", "rossini");
@@ -110,8 +112,8 @@ public class UsersITCase extends AbstractConsoleITCase {
@Test
public void editUser() {
- TESTER.clickLink("body:realmsLI:realms", false);
- TESTER.clickLink("body:content:body:container:content:tabbedPanel:tabs-container:tabs:1:link");
+ TESTER.clickLink(ANY_PAGE, false);
+ TESTER.clickLink(USER_TAB);
Component component = findComponentByProp("username", CONTAINER
+ ":searchContainer:resultTable:tablePanel:groupForm:checkgroup:dataTable", "puccini");
@@ -176,14 +178,14 @@ public class UsersITCase extends AbstractConsoleITCase {
@Test
public void editUserMembership() {
- TESTER.clickLink("body:realmsLI:realms", false);
+ TESTER.clickLink(ANY_PAGE, false);
TESTER.executeAjaxEvent("body:content:realmChoicePanel:container"
+ ":realmsFragment:realms:btn", Constants.ON_CLICK);
TESTER.executeAjaxEvent("body:content:realmChoicePanel:container"
+ ":realmsFragment:realms:dropdown-menu:buttons:2:button",
Constants.ON_CLICK);
- TESTER.clickLink("body:content:body:container:content:tabbedPanel:tabs-container:tabs:1:link");
+ TESTER.clickLink(USER_TAB);
Component component = findComponentByProp("username", CONTAINER
+ ":searchContainer:resultTable:tablePanel:groupForm:checkgroup:dataTable", "puccini");
@@ -274,14 +276,14 @@ public class UsersITCase extends AbstractConsoleITCase {
@Test
public void editUserMemberships() {
- TESTER.clickLink("body:realmsLI:realms", false);
+ TESTER.clickLink(ANY_PAGE, false);
TESTER.executeAjaxEvent("body:content:realmChoicePanel:container"
+ ":realmsFragment:realms:btn", Constants.ON_CLICK);
TESTER.executeAjaxEvent("body:content:realmChoicePanel:container"
+ ":realmsFragment:realms:dropdown-menu:buttons:2:button",
Constants.ON_CLICK);
- TESTER.clickLink("body:content:body:container:content:tabbedPanel:tabs-container:tabs:1:link");
+ TESTER.clickLink(USER_TAB);
Component component = findComponentByProp("username", CONTAINER
+ ":searchContainer:resultTable:tablePanel:groupForm:checkgroup:dataTable", "rossini");
@@ -510,8 +512,8 @@ public class UsersITCase extends AbstractConsoleITCase {
@Test
public void checkDeleteUsrLink() {
- TESTER.clickLink("body:realmsLI:realms", false);
- TESTER.clickLink("body:content:body:container:content:tabbedPanel:tabs-container:tabs:1:link");
+ TESTER.clickLink(ANY_PAGE, false);
+ TESTER.clickLink(USER_TAB);
Component component = findComponentByProp("username", CONTAINER
+ ":searchContainer:resultTable:tablePanel:groupForm:checkgroup:dataTable", "rossini");
@@ -526,8 +528,8 @@ public class UsersITCase extends AbstractConsoleITCase {
@Disabled
@Test
public void editDateTimeField() {
- TESTER.clickLink("body:realmsLI:realms", false);
- TESTER.clickLink("body:content:body:container:content:tabbedPanel:tabs-container:tabs:1:link");
+ TESTER.clickLink(ANY_PAGE, false);
+ TESTER.clickLink(USER_TAB);
Component component = findComponentByProp("username", CONTAINER
+ ":searchContainer:resultTable:tablePanel:groupForm:checkgroup:dataTable", "puccini");
@@ -619,8 +621,8 @@ public class UsersITCase extends AbstractConsoleITCase {
public void changePassword() {
TESTER.cleanupFeedbackMessages();
- TESTER.clickLink("body:realmsLI:realms", false);
- TESTER.clickLink("body:content:body:container:content:tabbedPanel:tabs-container:tabs:1:link");
+ TESTER.clickLink(ANY_PAGE, false);
+ TESTER.clickLink(USER_TAB);
Component component = findComponentByProp("username", CONTAINER
+ ":searchContainer:resultTable:tablePanel:groupForm:checkgroup:dataTable", "vivaldi");
@@ -645,8 +647,8 @@ public class UsersITCase extends AbstractConsoleITCase {
assertSuccessMessage();
TESTER.cleanupFeedbackMessages();
- TESTER.clickLink("body:realmsLI:realms", false);
- TESTER.clickLink("body:content:body:container:content:tabbedPanel:tabs-container:tabs:1:link");
+ TESTER.clickLink(ANY_PAGE, false);
+ TESTER.clickLink(USER_TAB);
component = findComponentByProp("username", CONTAINER
+ ":searchContainer:resultTable:tablePanel:groupForm:checkgroup:dataTable", "vivaldi");
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/RealmITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/RealmITCase.java
index c7a8ddae5c..20329dcdb7 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/RealmITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/RealmITCase.java
@@ -103,7 +103,6 @@ public class RealmITCase extends AbstractITCase {
realm.setName("searchTest4");
realm.getAnyTypeClasses().add("other");
realm.getPlainAttrs().add(new Attr.Builder("aLong").value("4242").build());
- realm.getResources().add(RESOURCE_NAME_LDAP_ORGUNIT);
REALM_SERVICE.create("/even/two", realm);
realm = new RealmTO();
@@ -112,7 +111,6 @@ public class RealmITCase extends AbstractITCase {
realm.getPlainAttrs().add(new Attr.Builder("ctype").value("String5").build());
realm.getPlainAttrs().add(new Attr.Builder("aLong").value("5").build());
realm.getPlainAttrs().add(new Attr.Builder("loginDate").value("2011-05-26").build());
- realm.getResources().add(RESOURCE_NAME_LDAP_ORGUNIT);
REALM_SERVICE.create("/even", realm);
// Numeric equality
@@ -229,6 +227,23 @@ public class RealmITCase extends AbstractITCase {
SyncopeClientException exception = assertThrows(SyncopeClientException.class,
() -> REALM_SERVICE.search(new RealmQuery.Builder().fiql("aLong==notANumber").build()));
assertEquals(ClientExceptionType.InvalidSearchParameters, exception.getType());
+
+ // Resource
+ match = REALM_SERVICE.search(new RealmQuery.Builder().
+ fiql("name==searchTest*;$resources==" + RESOURCE_NAME_LDAP_ORGUNIT).build());
+ assertEquals(3, match.getSize());
+ assertTrue(match.getResult().stream().anyMatch(r -> r.getName().equals("searchTest1")));
+ assertTrue(match.getResult().stream().anyMatch(r -> r.getName().equals("searchTest2")));
+ assertTrue(match.getResult().stream().anyMatch(r -> r.getName().equals("searchTest3")));
+
+ // Resource
+ match = REALM_SERVICE.search(new RealmQuery.Builder().base("/even").
+ fiql("name==searchTest*;$auxClasses==other").build());
+ assertEquals(4, match.getSize());
+ assertTrue(match.getResult().stream().anyMatch(r -> r.getName().equals("searchTest2")));
+ assertTrue(match.getResult().stream().anyMatch(r -> r.getName().equals("searchTest3")));
+ assertTrue(match.getResult().stream().anyMatch(r -> r.getName().equals("searchTest4")));
+ assertTrue(match.getResult().stream().anyMatch(r -> r.getName().equals("searchTest5")));
}
@Test