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/02/10 07:14:01 UTC
(syncope) branch master updated: [SYNCOPE-1948] Introducing Any Managers and removing DynRealms and DynGroups (#1295)
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 3ba59eb277 [SYNCOPE-1948] Introducing Any Managers and removing DynRealms and DynGroups (#1295)
3ba59eb277 is described below
commit 3ba59eb277b7378666dd72b6f56a24624f6d9766
Author: Francesco Chicchiriccò <il...@users.noreply.github.com>
AuthorDate: Tue Feb 10 08:13:55 2026 +0100
[SYNCOPE-1948] Introducing Any Managers and removing DynRealms and DynGroups (#1295)
---
...irectoryPanelAdditionalActionLinksProvider.java | 10 +-
.../client/console/commons/IdMConstants.java | 2 +
.../client/console/panels/ConnidLocations.java | 4 +-
.../ui/commons/layout/AbstractAnyFormLayout.java | 10 +
.../ui/commons/wizards/any/AbstractGroups.java | 8 -
.../commons/wizards/any/AbstractGroupsModel.java | 2 -
.../client/console/IdRepoConsoleContext.java | 9 +-
.../client/console/commons/IdRepoConstants.java | 2 -
.../client/console/layout/GroupFormLayoutInfo.java | 22 +-
.../syncope/client/console/pages/Security.java | 20 -
.../client/console/panels/AnyDirectoryPanel.java | 13 +-
.../console/panels/AnyObjectDirectoryPanel.java | 4 +-
.../syncope/client/console/panels/AnyPanel.java | 50 +--
.../console/panels/DynRealmDirectoryPanel.java | 196 ----------
.../client/console/panels/DynRealmModalPanel.java | 152 --------
.../client/console/panels/GroupDirectoryPanel.java | 8 +-
.../client/console/panels/RealmChoicePanel.java | 83 +---
.../client/console/panels/RoleDirectoryPanel.java | 2 -
.../client/console/panels/UserDirectoryPanel.java | 10 +-
.../client/console/rest/DynRealmRestClient.java | 47 ---
.../client/console/rest/RealmRestClient.java | 11 -
.../console/wicket/markup/html/form/Action.java | 8 -
.../client/console/wizards/DynRealmWrapper.java | 83 ----
.../console/wizards/any/AnyWizardBuilder.java | 17 +-
.../console/wizards/any/DynamicMemberships.java | 110 ------
.../console/wizards/any/GroupWizardBuilder.java | 15 +-
.../client/console/wizards/any/GroupWrapper.java | 65 ----
.../syncope/client/console/wizards/any/Groups.java | 80 +---
.../any/{Ownership.java => Management.java} | 125 +++---
.../console/wizards/role/RoleWizardBuilder.java | 44 ---
.../client/console/wizards/role/RoleWrapper.java | 32 --
.../syncope/client/console/pages/Realms.properties | 2 -
.../client/console/pages/Realms_fr_CA.properties | 2 -
.../client/console/pages/Realms_it.properties | 2 -
.../client/console/pages/Realms_ja.properties | 2 -
.../client/console/pages/Realms_pt_BR.properties | 2 -
.../client/console/pages/Realms_ru.properties | 2 -
.../client/console/pages/Security.properties | 1 -
.../client/console/pages/Security_fr_CA.properties | 1 -
.../client/console/pages/Security_it.properties | 1 -
.../client/console/pages/Security_ja.properties | 1 -
.../client/console/pages/Security_pt_BR.properties | 1 -
.../client/console/pages/Security_ru.properties | 1 -
.../panels/DynRealmDirectoryPanel.properties | 18 -
.../panels/DynRealmDirectoryPanel_fr_CA.properties | 18 -
.../panels/DynRealmDirectoryPanel_it.properties | 18 -
.../panels/DynRealmDirectoryPanel_ja.properties | 18 -
.../panels/DynRealmDirectoryPanel_pt_BR.properties | 18 -
.../panels/DynRealmDirectoryPanel_ru.properties | 19 -
.../client/console/panels/DynRealmModalPanel.html | 28 --
.../console/wizards/any/DynamicMemberships.html | 26 --
.../wizards/any/DynamicMemberships.properties | 20 -
.../any/DynamicMemberships_fr_CA.properties | 20 -
.../wizards/any/DynamicMemberships_it.properties | 20 -
.../wizards/any/DynamicMemberships_ja.properties | 20 -
.../any/DynamicMemberships_pt_BR.properties | 20 -
.../wizards/any/DynamicMemberships_ru.properties | 25 --
.../syncope/client/console/wizards/any/Groups.html | 24 --
.../client/console/wizards/any/Groups.properties | 2 -
.../console/wizards/any/Groups_fr_CA.properties | 4 +-
.../console/wizards/any/Groups_it.properties | 2 -
.../console/wizards/any/Groups_ja.properties | 2 -
.../console/wizards/any/Groups_pt_BR.properties | 2 -
.../console/wizards/any/Groups_ru.properties | 2 -
.../any/{Ownership.html => Management.html} | 12 +-
...ship_pt_BR.properties => Management.properties} | 2 +-
...ship.properties => Management_fr_CA.properties} | 2 +-
...p_fr_CA.properties => Management_it.properties} | 2 +-
...ship_it.properties => Management_ja.properties} | 2 +-
...t_BR.properties => Management_pt_BR.properties} | 2 +-
...p_pt_BR.properties => Management_ru.properties} | 3 +-
.../console/wizards/any/Ownership_ja.properties | 17 -
.../console/wizards/any/Ownership_ru.properties | 18 -
.../wizards/role/RoleWizardBuilder$Details.html | 1 -
.../wizards/role/RoleWizardBuilder$DynRealms.html | 25 --
.../syncope/client/enduser/panels/any/Groups.java | 17 -
.../apache/syncope/common/lib/AnyOperations.java | 51 ++-
.../apache/syncope/common/lib/EntityTOUtils.java | 12 +-
.../apache/syncope/common/lib/request/AnyCR.java | 36 ++
.../syncope/common/lib/request/AnyObjectCR.java | 6 -
.../apache/syncope/common/lib/request/AnyUR.java | 38 ++
.../apache/syncope/common/lib/request/GroupCR.java | 66 ----
.../apache/syncope/common/lib/request/GroupUR.java | 74 +---
.../apache/syncope/common/lib/request/UserCR.java | 6 -
.../search/AbstractFiqlSearchConditionBuilder.java | 24 --
.../common/lib/search/SearchableFields.java | 3 +-
.../syncope/common/lib/search/SpecialAttr.java | 4 -
.../syncope/common/lib/search/SyncopeProperty.java | 18 -
.../apache/syncope/common/lib/to/AnyObjectTO.java | 9 -
.../org/apache/syncope/common/lib/to/AnyTO.java | 26 +-
.../apache/syncope/common/lib/to/DynRealmTO.java | 47 ---
.../org/apache/syncope/common/lib/to/GroupTO.java | 86 +---
.../common/lib/to/GroupableRelatableTO.java | 2 -
.../org/apache/syncope/common/lib/to/RoleTO.java | 20 -
.../org/apache/syncope/common/lib/to/UserTO.java | 9 -
.../common/lib/types/ClientExceptionType.java | 3 +-
.../common/lib/types/EntityViolationType.java | 4 +-
.../common/lib/types/IdRepoEntitlement.java | 8 -
.../syncope/common/lib/SerializationTest.java | 4 -
.../common/rest/api/service/DynRealmService.java | 123 ------
.../apache/syncope/core/logic/DynRealmLogic.java | 108 ------
.../org/apache/syncope/core/logic/GroupLogic.java | 24 +-
.../syncope/core/logic/IdRepoLogicContext.java | 11 -
.../org/apache/syncope/core/logic/RoleLogic.java | 8 -
.../org/apache/syncope/core/logic/UserLogic.java | 9 +-
.../core/rest/cxf/IdRepoRESTCXFContext.java | 9 -
.../core/rest/cxf/service/DynRealmServiceImpl.java | 66 ----
.../syncope/core/persistence/api/dao/AnyDAO.java | 2 -
.../core/persistence/api/dao/AnyObjectDAO.java | 4 -
.../core/persistence/api/dao/DynRealmDAO.java | 31 --
.../syncope/core/persistence/api/dao/GroupDAO.java | 68 +---
.../syncope/core/persistence/api/dao/RoleDAO.java | 13 -
.../syncope/core/persistence/api/dao/UserDAO.java | 15 +-
.../persistence/api/dao/search/DynRealmCond.java | 74 ----
.../syncope/core/persistence/api/entity/Any.java | 10 +
.../persistence/api/entity/DynGroupMembership.java | 28 --
.../core/persistence/api/entity/DynMembership.java | 26 --
.../core/persistence/api/entity/DynRealm.java | 32 --
.../persistence/api/entity/DynRealmMembership.java | 31 --
.../syncope/core/persistence/api/entity/Role.java | 8 -
.../api/entity/anyobject/ADynGroupMembership.java | 29 --
.../core/persistence/api/entity/group/Group.java | 21 -
.../api/entity/user/UDynGroupMembership.java | 25 --
.../persistence/api/search/SearchCondVisitor.java | 7 -
.../core/persistence/api/utils/RealmUtils.java | 31 +-
.../api/search/FilterConverterTest.java | 20 -
.../api/search/SearchCondConverterTest.java | 15 -
.../core/persistence/api/utils/RealmUtilsTest.java | 26 +-
.../common/dao/AbstractAnyMatchDAO.java | 25 +-
.../common/dao/AbstractAnySearchDAO.java | 59 ++-
.../common/validation/AnyValidator.java | 8 +
.../common/validation/DynRealmCheck.java | 40 --
.../common/validation/DynRealmValidator.java | 47 ---
.../common/validation/GroupValidator.java | 40 --
.../common/validation/RoleValidator.java | 6 +-
.../persistence/jpa/MariaDBPersistenceContext.java | 3 -
.../persistence/jpa/MySQLPersistenceContext.java | 3 -
.../persistence/jpa/OraclePersistenceContext.java | 3 -
.../core/persistence/jpa/PGPersistenceContext.java | 3 -
.../core/persistence/jpa/PersistenceContext.java | 55 ---
.../jpa/dao/AbstractJPAAnySearchDAO.java | 96 +----
.../jpa/dao/MariaDBJPAAnySearchDAO.java | 3 -
.../persistence/jpa/dao/MySQLJPAAnySearchDAO.java | 3 -
.../persistence/jpa/dao/OracleJPAAnySearchDAO.java | 3 -
.../persistence/jpa/dao/PGJPAAnySearchDAO.java | 3 -
.../core/persistence/jpa/dao/SearchSupport.java | 16 -
.../jpa/dao/repo/AbstractAnyRepoExt.java | 24 --
.../persistence/jpa/dao/repo/AnyObjectRepoExt.java | 5 -
.../jpa/dao/repo/AnyObjectRepoExtImpl.java | 72 +---
.../core/persistence/jpa/dao/repo/AnyRepoExt.java | 2 -
.../persistence/jpa/dao/repo/DynRealmRepo.java | 28 --
.../persistence/jpa/dao/repo/DynRealmRepoExt.java | 35 --
.../jpa/dao/repo/DynRealmRepoExtImpl.java | 190 ---------
.../core/persistence/jpa/dao/repo/GroupRepo.java | 4 -
.../persistence/jpa/dao/repo/GroupRepoExt.java | 35 +-
.../persistence/jpa/dao/repo/GroupRepoExtImpl.java | 396 +++----------------
.../core/persistence/jpa/dao/repo/RoleRepoExt.java | 14 -
.../persistence/jpa/dao/repo/RoleRepoExtImpl.java | 109 ------
.../core/persistence/jpa/dao/repo/UserRepoExt.java | 16 +-
.../persistence/jpa/dao/repo/UserRepoExtImpl.java | 185 +++++----
.../core/persistence/jpa/entity/AbstractAny.java | 32 ++
.../jpa/entity/AbstractDynMembership.java | 44 ---
.../jpa/entity/AbstractEntityFactory.java | 14 -
.../core/persistence/jpa/entity/JPADynRealm.java | 65 ----
.../jpa/entity/JPADynRealmMembership.java | 78 ----
.../core/persistence/jpa/entity/JPARole.java | 34 --
.../entity/anyobject/JPAADynGroupMembership.java | 68 ----
.../persistence/jpa/entity/group/JPAGroup.java | 72 ----
.../jpa/entity/user/JPAUDynGroupMembership.java | 51 ---
.../jpa/openjpa/EntityValidationListener.java | 2 -
.../src/main/resources/META-INF/indexes.xml | 11 -
.../main/resources/META-INF/mariadb/indexes.xml | 11 -
.../src/main/resources/META-INF/mariadb/views.xml | 26 --
.../src/main/resources/META-INF/mysql/indexes.xml | 11 -
.../src/main/resources/META-INF/mysql/views.xml | 26 --
.../src/main/resources/META-INF/oracle/indexes.xml | 11 -
.../src/main/resources/META-INF/oracle/views.xml | 26 --
.../src/main/resources/META-INF/views.xml | 26 --
.../src/main/resources/domains/MasterContent.xml | 2 -
.../core/persistence/jpa/inner/AnySearchTest.java | 43 +-
.../core/persistence/jpa/outer/AnySearchTest.java | 40 +-
.../core/persistence/jpa/outer/DynRealmTest.java | 169 --------
.../core/persistence/jpa/outer/GroupTest.java | 231 +----------
.../core/persistence/jpa/outer/RoleTest.java | 100 -----
.../src/test/resources/domains/MasterContent.xml | 22 +-
.../core/persistence/neo4j/PersistenceContext.java | 70 +---
.../persistence/neo4j/dao/Neo4jAnySearchDAO.java | 93 ++---
.../neo4j/dao/repo/AbstractAnyRepoExt.java | 18 -
.../neo4j/dao/repo/AnyObjectRepoExt.java | 5 -
.../neo4j/dao/repo/AnyObjectRepoExtImpl.java | 73 ++--
.../persistence/neo4j/dao/repo/AnyRepoExt.java | 2 -
.../persistence/neo4j/dao/repo/DynRealmRepo.java | 28 --
.../neo4j/dao/repo/DynRealmRepoExt.java | 35 --
.../neo4j/dao/repo/DynRealmRepoExtImpl.java | 206 ----------
.../persistence/neo4j/dao/repo/GroupRepoExt.java | 35 +-
.../neo4j/dao/repo/GroupRepoExtImpl.java | 431 ++++-----------------
.../persistence/neo4j/dao/repo/RoleRepoExt.java | 13 -
.../neo4j/dao/repo/RoleRepoExtImpl.java | 96 -----
.../persistence/neo4j/dao/repo/UserRepoExt.java | 16 +-
.../neo4j/dao/repo/UserRepoExtImpl.java | 175 ++++++---
.../core/persistence/neo4j/entity/AbstractAny.java | 36 ++
.../neo4j/entity/AbstractDynMembership.java | 42 --
.../persistence/neo4j/entity/Neo4jDynRealm.java | 61 ---
.../neo4j/entity/Neo4jDynRealmMembership.java | 76 ----
.../neo4j/entity/Neo4jEntityFactory.java | 14 -
.../core/persistence/neo4j/entity/Neo4jRole.java | 27 --
.../entity/anyobject/Neo4jADynGroupMembership.java | 65 ----
.../persistence/neo4j/entity/group/Neo4jGroup.java | 73 ----
.../entity/user/Neo4jUDynGroupMembership.java | 47 ---
.../persistence/neo4j/spring/NodeValidator.java | 2 -
.../src/main/resources/domains/MasterContent.xml | 2 -
.../persistence/neo4j/inner/AnySearchTest.java | 39 +-
.../persistence/neo4j/outer/AnySearchTest.java | 34 +-
.../core/persistence/neo4j/outer/DynRealmTest.java | 163 --------
.../core/persistence/neo4j/outer/GroupTest.java | 181 +--------
.../core/persistence/neo4j/outer/RoleTest.java | 70 ----
.../src/test/resources/domains/MasterContent.xml | 20 +-
.../provisioning/api/GroupProvisioningManager.java | 2 -
.../provisioning/api/data/DynRealmDataBinder.java | 31 --
.../core/provisioning/api/jexl/TemplateUtils.java | 87 ++---
.../api/pushpull/GroupPullResultHandler.java | 7 -
.../provisioning/api/IntAttrNameParserTest.java | 10 +-
.../java/DefaultGroupProvisioningManager.java | 19 +-
.../provisioning/java/DefaultMappingManager.java | 67 ++--
.../core/provisioning/java/ExecutorProperties.java | 1 -
.../provisioning/java/ProvisioningContext.java | 16 -
.../core/provisioning/java/data/AnyDataBinder.java | 74 +++-
.../java/data/AnyObjectDataBinderImpl.java | 17 +-
.../java/data/DynRealmDataBinderImpl.java | 116 ------
.../java/data/GroupDataBinderImpl.java | 162 +-------
.../provisioning/java/data/RoleDataBinderImpl.java | 38 +-
.../provisioning/java/data/UserDataBinderImpl.java | 20 +-
.../java/pushpull/AbstractPullExecutor.java | 39 --
.../java/pushpull/AbstractPullResultHandler.java | 26 ++
.../java/pushpull/AbstractPushResultHandler.java | 15 -
.../pushpull/DefaultGroupPullResultHandler.java | 31 +-
.../provisioning/java/pushpull/InboundMatcher.java | 6 +-
.../java/pushpull/LiveSyncJobDelegate.java | 11 +-
.../java/pushpull/PullJobDelegate.java | 9 +-
.../java/pushpull/SinglePullJobDelegate.java | 9 +-
.../pushpull/stream/StreamPullJobDelegate.java | 9 +-
.../provisioning/java/utils/ConnObjectUtils.java | 4 -
.../java/DefaultMappingManagerTest.java | 54 ---
.../core/spring/security/AuthDataAccessor.java | 122 +++---
.../java/AbstractAnyObjectWorkflowAdapter.java | 5 +-
.../workflow/java/DefaultGroupWorkflowAdapter.java | 2 +-
.../elasticsearch/client/ElasticsearchUtils.java | 9 +-
.../ElasticsearchPersistenceContext.java | 3 -
.../dao/ElasticsearchAnySearchDAO.java | 71 ++--
.../dao/ElasticsearchAnySearchDAOTest.java | 39 +-
.../ext/opensearch/client/OpenSearchUtils.java | 9 +-
.../opensearch/OpenSearchPersistenceContext.java | 3 -
.../opensearch/dao/OpenSearchAnySearchDAO.java | 71 ++--
.../opensearch/dao/OpenSearchAnySearchDAOTest.java | 39 +-
.../apache/syncope/core/logic/SCIMDataBinder.java | 5 -
.../ext/scimv2/cxf/SCIMExceptionMapper.java | 2 +-
.../org/apache/syncope/fit/AbstractITCase.java | 4 -
.../apache/syncope/fit/console/GroupsITCase.java | 32 +-
.../apache/syncope/fit/console/RolesITCase.java | 4 -
.../fit/console/SecurityQuestionsITCase.java | 7 +-
.../syncope/fit/core/AuthenticationITCase.java | 105 -----
.../apache/syncope/fit/core/DynRealmITCase.java | 393 -------------------
.../org/apache/syncope/fit/core/GroupITCase.java | 179 +--------
.../org/apache/syncope/fit/core/ManagerITCase.java | 193 +++++++++
.../apache/syncope/fit/core/PullTaskITCase.java | 4 +-
.../apache/syncope/fit/core/PushTaskITCase.java | 33 --
.../apache/syncope/fit/core/ResourceITCase.java | 2 +-
.../org/apache/syncope/fit/core/RoleITCase.java | 57 ---
.../org/apache/syncope/fit/core/SearchITCase.java | 73 +---
.../apache/syncope/fit/core/UserIssuesITCase.java | 65 ----
.../concepts/provisioning/pull.adoc | 3 +-
.../asciidoc/reference-guide/concepts/realms.adoc | 12 -
.../asciidoc/reference-guide/concepts/roles.adoc | 67 +---
.../concepts/usersgroupsandanyobjects.adoc | 11 -
274 files changed, 1588 insertions(+), 9031 deletions(-)
diff --git a/client/idm/console/src/main/java/org/apache/syncope/client/console/commons/IdMAnyDirectoryPanelAdditionalActionLinksProvider.java b/client/idm/console/src/main/java/org/apache/syncope/client/console/commons/IdMAnyDirectoryPanelAdditionalActionLinksProvider.java
index d685da5b5b..f2a4f95a07 100644
--- a/client/idm/console/src/main/java/org/apache/syncope/client/console/commons/IdMAnyDirectoryPanelAdditionalActionLinksProvider.java
+++ b/client/idm/console/src/main/java/org/apache/syncope/client/console/commons/IdMAnyDirectoryPanelAdditionalActionLinksProvider.java
@@ -100,7 +100,7 @@ public class IdMAnyDirectoryPanelAdditionalActionLinksProvider
}, ActionLink.ActionType.ENABLE);
enable.setEntitlements(IdRepoEntitlement.USER_UPDATE);
enable.setOnConfirm(false);
- enable.setRealms(realm, model.getObject().getDynRealms());
+ enable.setRealm(realm);
actions.add(enable);
Action<UserTO> manageResources = new Action<>(new ActionLink<>() {
@@ -128,7 +128,7 @@ public class IdMAnyDirectoryPanelAdditionalActionLinksProvider
manageResources.setEntitlements(
String.format("%s,%s", IdRepoEntitlement.USER_READ, IdRepoEntitlement.USER_UPDATE));
manageResources.setOnConfirm(false);
- manageResources.setRealms(realm, model.getObject().getDynRealms());
+ manageResources.setRealm(realm);
actions.add(manageResources);
Action<UserTO> manageAccounts = new Action<>(new ActionLink<>() {
@@ -149,7 +149,7 @@ public class IdMAnyDirectoryPanelAdditionalActionLinksProvider
manageAccounts.setEntitlements(String.format("%s,%s,%s",
IdRepoEntitlement.USER_READ, IdRepoEntitlement.USER_UPDATE, IdMEntitlement.RESOURCE_GET_CONNOBJECT));
manageAccounts.setOnConfirm(false);
- manageAccounts.setRealms(realm, model.getObject().getDynRealms());
+ manageAccounts.setRealm(realm);
actions.add(manageAccounts);
Action<UserTO> mergeAccounts = new Action<>(new ActionLink<>() {
@@ -209,7 +209,7 @@ public class IdMAnyDirectoryPanelAdditionalActionLinksProvider
manageResources.setEntitlements(
String.format("%s,%s", IdRepoEntitlement.GROUP_READ, IdRepoEntitlement.GROUP_UPDATE));
manageResources.setOnConfirm(false);
- manageResources.setRealms(realm, modelObject.getDynRealms());
+ manageResources.setRealm(realm);
actions.add(manageResources);
return actions;
@@ -250,7 +250,7 @@ public class IdMAnyDirectoryPanelAdditionalActionLinksProvider
}, ActionLink.ActionType.MANAGE_RESOURCES);
manageResources.setEntitlements(
String.format("%s,%s", AnyEntitlement.READ.getFor(type), AnyEntitlement.UPDATE.getFor(type)));
- manageResources.setRealms(realm, modelObject.getDynRealms());
+ manageResources.setRealm(realm);
actions.add(manageResources);
return actions;
}
diff --git a/client/idm/console/src/main/java/org/apache/syncope/client/console/commons/IdMConstants.java b/client/idm/console/src/main/java/org/apache/syncope/client/console/commons/IdMConstants.java
index 48edd857dd..a208c04e0c 100644
--- a/client/idm/console/src/main/java/org/apache/syncope/client/console/commons/IdMConstants.java
+++ b/client/idm/console/src/main/java/org/apache/syncope/client/console/commons/IdMConstants.java
@@ -20,6 +20,8 @@ package org.apache.syncope.client.console.commons;
public final class IdMConstants {
+ public static final String PREF_CONNID_LOCATIONS_PAGINATOR_ROWS = "connid.locations.paginator.rows";
+
public static final String PREF_RECONCILIATION_PAGINATOR_ROWS = "reconciliation.paginator.rows";
public static final String PREF_RESOURCE_STATUS_PAGINATOR_ROWS = "resource.status.paginator.rows";
diff --git a/client/idm/console/src/main/java/org/apache/syncope/client/console/panels/ConnidLocations.java b/client/idm/console/src/main/java/org/apache/syncope/client/console/panels/ConnidLocations.java
index a7aa03650b..81c81225aa 100644
--- a/client/idm/console/src/main/java/org/apache/syncope/client/console/panels/ConnidLocations.java
+++ b/client/idm/console/src/main/java/org/apache/syncope/client/console/panels/ConnidLocations.java
@@ -28,7 +28,7 @@ import java.util.Iterator;
import java.util.List;
import org.apache.syncope.client.console.SyncopeConsoleSession;
import org.apache.syncope.client.console.commons.DirectoryDataProvider;
-import org.apache.syncope.client.console.commons.IdRepoConstants;
+import org.apache.syncope.client.console.commons.IdMConstants;
import org.apache.syncope.client.console.rest.ConnectorRestClient;
import org.apache.syncope.client.console.wicket.markup.html.bootstrap.dialog.BaseModal;
import org.apache.syncope.client.console.wicket.markup.html.form.ActionLink;
@@ -78,7 +78,7 @@ public class ConnidLocations extends
@Override
protected String paginatorRowsKey() {
- return IdRepoConstants.PREF_DYNREALM_PAGINATOR_ROWS;
+ return IdMConstants.PREF_CONNID_LOCATIONS_PAGINATOR_ROWS;
}
@Override
diff --git a/client/idrepo/common-ui/src/main/java/org/apache/syncope/client/ui/commons/layout/AbstractAnyFormLayout.java b/client/idrepo/common-ui/src/main/java/org/apache/syncope/client/ui/commons/layout/AbstractAnyFormLayout.java
index 2a7b6df727..97df33a091 100644
--- a/client/idrepo/common-ui/src/main/java/org/apache/syncope/client/ui/commons/layout/AbstractAnyFormLayout.java
+++ b/client/idrepo/common-ui/src/main/java/org/apache/syncope/client/ui/commons/layout/AbstractAnyFormLayout.java
@@ -28,12 +28,22 @@ public abstract class AbstractAnyFormLayout<A extends AnyTO, F extends AnyForm<A
private static final long serialVersionUID = -6061683026789976508L;
+ private boolean manager = true;
+
private boolean relationships = true;
private final List<String> whichPlainAttrs = new ArrayList<>();
private final List<String> whichDerAttrs = new ArrayList<>();
+ public boolean isManager() {
+ return manager;
+ }
+
+ public void setManager(final boolean manager) {
+ this.manager = manager;
+ }
+
public boolean isRelationships() {
return relationships;
}
diff --git a/client/idrepo/common-ui/src/main/java/org/apache/syncope/client/ui/commons/wizards/any/AbstractGroups.java b/client/idrepo/common-ui/src/main/java/org/apache/syncope/client/ui/commons/wizards/any/AbstractGroups.java
index 45c9fdf27d..c227bcfdfb 100644
--- a/client/idrepo/common-ui/src/main/java/org/apache/syncope/client/ui/commons/wizards/any/AbstractGroups.java
+++ b/client/idrepo/common-ui/src/main/java/org/apache/syncope/client/ui/commons/wizards/any/AbstractGroups.java
@@ -35,10 +35,6 @@ public abstract class AbstractGroups extends WizardStep implements ICondition {
protected final AnyTO anyTO;
- protected WebMarkupContainer dyngroupsContainer;
-
- protected WebMarkupContainer dynrealmsContainer;
-
protected WebMarkupContainer groupsContainer;
public <T extends AnyTO> AbstractGroups(final AnyWrapper<T> modelObject) {
@@ -70,10 +66,6 @@ public abstract class AbstractGroups extends WizardStep implements ICondition {
protected abstract void addGroupsPanel();
- protected abstract void addDynamicRealmsContainer();
-
- protected abstract void addDynamicGroupsContainer();
-
@Override
public boolean evaluate() {
return true;
diff --git a/client/idrepo/common-ui/src/main/java/org/apache/syncope/client/ui/commons/wizards/any/AbstractGroupsModel.java b/client/idrepo/common-ui/src/main/java/org/apache/syncope/client/ui/commons/wizards/any/AbstractGroupsModel.java
index 7264856b08..5a64320ac5 100644
--- a/client/idrepo/common-ui/src/main/java/org/apache/syncope/client/ui/commons/wizards/any/AbstractGroupsModel.java
+++ b/client/idrepo/common-ui/src/main/java/org/apache/syncope/client/ui/commons/wizards/any/AbstractGroupsModel.java
@@ -55,6 +55,4 @@ public abstract class AbstractGroupsModel extends ListModel<GroupTO> {
}
return memberships;
}
-
- public abstract List<String> getDynMemberships();
}
diff --git a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/IdRepoConsoleContext.java b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/IdRepoConsoleContext.java
index b1a3c8fb91..faa5affb46 100644
--- a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/IdRepoConsoleContext.java
+++ b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/IdRepoConsoleContext.java
@@ -52,7 +52,6 @@ import org.apache.syncope.client.console.rest.AnyTypeRestClient;
import org.apache.syncope.client.console.rest.AuditRestClient;
import org.apache.syncope.client.console.rest.CommandRestClient;
import org.apache.syncope.client.console.rest.DelegationRestClient;
-import org.apache.syncope.client.console.rest.DynRealmRestClient;
import org.apache.syncope.client.console.rest.FIQLQueryRestClient;
import org.apache.syncope.client.console.rest.GroupRestClient;
import org.apache.syncope.client.console.rest.ImplementationRestClient;
@@ -234,12 +233,6 @@ public class IdRepoConsoleContext {
return new DelegationRestClient();
}
- @ConditionalOnMissingBean
- @Bean
- public DynRealmRestClient dynRealmRestClient() {
- return new DynRealmRestClient();
- }
-
@ConditionalOnMissingBean
@Bean
public FIQLQueryRestClient fiqlQueryRestClient() {
@@ -335,7 +328,7 @@ public class IdRepoConsoleContext {
public UserSelfRestClient userSelfRestClient() {
return new UserSelfRestClient();
}
-
+
@ConditionalOnMissingBean
@Bean
public DynamicMenuStringResourceLoader dynamicMenuStringResourceLoader() {
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 2514be26fb..995a2c01c0 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,8 +54,6 @@ public final class IdRepoConstants {
public static final String PREF_APPLICATION_PAGINATOR_ROWS = "application.paginator.rows";
- public static final String PREF_DYNREALM_PAGINATOR_ROWS = "dynRealm.paginator.rows";
-
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/layout/GroupFormLayoutInfo.java b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/layout/GroupFormLayoutInfo.java
index 722b6b4bcb..4536fae6e5 100644
--- a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/layout/GroupFormLayoutInfo.java
+++ b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/layout/GroupFormLayoutInfo.java
@@ -26,10 +26,6 @@ public class GroupFormLayoutInfo extends AbstractAnyFormLayout<GroupTO, GroupFor
private static final long serialVersionUID = -5573691733739618500L;
- private boolean ownership = true;
-
- private boolean dynamicMemberships = true;
-
private boolean typeExtensions = true;
@Override
@@ -37,20 +33,9 @@ public class GroupFormLayoutInfo extends AbstractAnyFormLayout<GroupTO, GroupFor
return GroupWizardBuilder.class;
}
- public boolean isOwnership() {
- return ownership;
- }
-
- public void setOwnership(final boolean ownership) {
- this.ownership = ownership;
- }
-
- public boolean isDynamicMemberships() {
- return dynamicMemberships;
- }
-
- public void setDynamicMemberships(final boolean dynamicMemberships) {
- this.dynamicMemberships = dynamicMemberships;
+ @Override
+ public boolean isGroups() {
+ return false;
}
public boolean isTypeExtensions() {
@@ -60,5 +45,4 @@ public class GroupFormLayoutInfo extends AbstractAnyFormLayout<GroupTO, GroupFor
public void setTypeExtensions(final boolean typeExtensions) {
this.typeExtensions = typeExtensions;
}
-
}
diff --git a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/pages/Security.java b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/pages/Security.java
index 42346f161d..35b8d7f8c6 100644
--- a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/pages/Security.java
+++ b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/pages/Security.java
@@ -24,11 +24,9 @@ import java.util.List;
import org.apache.syncope.client.console.BookmarkablePageLinkBuilder;
import org.apache.syncope.client.console.SyncopeConsoleSession;
import org.apache.syncope.client.console.panels.DelegationDirectoryPanel;
-import org.apache.syncope.client.console.panels.DynRealmDirectoryPanel;
import org.apache.syncope.client.console.panels.RoleDirectoryPanel;
import org.apache.syncope.client.console.panels.SecurityQuestionsPanel;
import org.apache.syncope.client.console.rest.DelegationRestClient;
-import org.apache.syncope.client.console.rest.DynRealmRestClient;
import org.apache.syncope.client.console.rest.RealmRestClient;
import org.apache.syncope.client.console.rest.RoleRestClient;
import org.apache.syncope.client.console.rest.SecurityQuestionRestClient;
@@ -59,9 +57,6 @@ public class Security extends BasePage {
@SpringBean
protected DelegationRestClient delegationRestClient;
- @SpringBean
- protected DynRealmRestClient dynRealmRestClient;
-
@SpringBean
protected SecurityQuestionRestClient securityQuestionRestClient;
@@ -98,7 +93,6 @@ public class Security extends BasePage {
new RoleTO(),
roleRestClient,
realmRestClient,
- dynRealmRestClient,
getPageReference()), true).build(panelId);
}
});
@@ -123,20 +117,6 @@ public class Security extends BasePage {
}
});
- tabs.add(new AbstractTab(new ResourceModel("dynRealms")) {
-
- private static final long serialVersionUID = -6815067322125799251L;
-
- @Override
- public Panel getPanel(final String panelId) {
- return new DynRealmDirectoryPanel.Builder(dynRealmRestClient, getPageReference()) {
-
- private static final long serialVersionUID = -5960765294082359003L;
-
- }.build(panelId);
- }
- });
-
tabs.add(new AbstractTab(new ResourceModel("securityQuestions")) {
private static final long serialVersionUID = -6815067322125799251L;
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 223b7d95b2..6cd3e3c010 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
@@ -113,11 +113,7 @@ public abstract class AnyDirectoryPanel<A extends AnyTO, E extends AbstractAnyRe
} else {
MetaDataRoleAuthorizationStrategy.unauthorizeAll(addAjaxLink, RENDER);
}
- if (builder.dynRealm == null) {
- setReadOnly(!SyncopeConsoleSession.get().owns(String.format("%s_UPDATE", builder.type), builder.realm));
- } else {
- setReadOnly(!SyncopeConsoleSession.get().owns(String.format("%s_UPDATE", builder.type), builder.dynRealm));
- }
+ setReadOnly(!SyncopeConsoleSession.get().owns(String.format("%s_UPDATE", builder.type), builder.realm));
realm = builder.realm;
type = builder.type;
@@ -280,8 +276,6 @@ public abstract class AnyDirectoryPanel<A extends AnyTO, E extends AbstractAnyRe
*/
protected String realm = SyncopeConstants.ROOT_REALM;
- protected String dynRealm = null;
-
/**
* Any type related to current panel.
*/
@@ -305,11 +299,6 @@ public abstract class AnyDirectoryPanel<A extends AnyTO, E extends AbstractAnyRe
return this;
}
- public Builder<A, E> setDynRealm(final String dynRealm) {
- this.dynRealm = dynRealm;
- return this;
- }
-
@Override
public List<AnyTypeClassTO> getAnyTypeClassTOs() {
return this.anyTypeClassTOs;
diff --git a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/AnyObjectDirectoryPanel.java b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/AnyObjectDirectoryPanel.java
index 68477bb15b..f8fa5d00a2 100644
--- a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/AnyObjectDirectoryPanel.java
+++ b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/AnyObjectDirectoryPanel.java
@@ -122,7 +122,7 @@ public class AnyObjectDirectoryPanel extends AnyDirectoryPanel<AnyObjectTO, AnyO
}
}, ActionType.EDIT,
String.format("%s,%s", AnyEntitlement.READ.getFor(type), AnyEntitlement.UPDATE.getFor(type))).
- setRealms(realm, model.getObject().getDynRealms());
+ setRealm(realm);
if (wizardInModal) {
SyncopeWebApplication.get().getAnyDirectoryPanelAdditionalActionLinksProvider().get(
@@ -204,7 +204,7 @@ public class AnyObjectDirectoryPanel extends AnyDirectoryPanel<AnyObjectTO, AnyO
}
}, ActionType.VIEW_AUDIT_HISTORY,
String.format("%s,%s", AnyEntitlement.READ.getFor(type), IdRepoEntitlement.AUDIT_LIST)).
- setRealms(realm, model.getObject().getDynRealms());
+ setRealm(realm);
panel.add(new ActionLink<>() {
diff --git a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/AnyPanel.java b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/AnyPanel.java
index 7abaa5f20b..8b68658d2a 100644
--- a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/AnyPanel.java
+++ b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/AnyPanel.java
@@ -21,8 +21,6 @@ package org.apache.syncope.client.console.panels;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.commons.lang3.Strings;
import org.apache.syncope.client.console.commons.RealmsUtils;
import org.apache.syncope.client.console.layout.AnyLayout;
import org.apache.syncope.client.console.layout.AnyLayoutUtils;
@@ -43,7 +41,6 @@ import org.apache.syncope.client.ui.commons.Constants;
import org.apache.syncope.client.ui.commons.panels.LabelPanel;
import org.apache.syncope.client.ui.commons.panels.ModalPanel;
import org.apache.syncope.client.ui.commons.wicket.markup.html.bootstrap.tabs.Accordion;
-import org.apache.syncope.common.lib.SyncopeConstants;
import org.apache.syncope.common.lib.to.AnyObjectTO;
import org.apache.syncope.common.lib.to.AnyTypeTO;
import org.apache.syncope.common.lib.to.GroupTO;
@@ -215,23 +212,12 @@ public class AnyPanel extends Panel implements ModalPanel {
Panel panel;
String fiql;
- String realm;
- String dynRealm;
- if (Strings.CS.startsWith(r.getFullPath(), SyncopeConstants.ROOT_REALM)) {
- realm = RealmsUtils.getFullPath(r.getFullPath());
- dynRealm = null;
- } else {
- realm = SyncopeConstants.ROOT_REALM;
- dynRealm = r.getKey();
- }
+ String realm = RealmsUtils.getFullPath(r.getFullPath());
switch (anyType.getKind()) {
case USER:
- fiql = dynRealm == null
- ? SyncopeClient.getUserSearchConditionBuilder().
- is(Constants.KEY_FIELD_NAME).notNullValue().query()
- : SyncopeClient.getUserSearchConditionBuilder().
- inDynRealms(dynRealm).query();
+ fiql = SyncopeClient.getUserSearchConditionBuilder().
+ is(Constants.KEY_FIELD_NAME).notNullValue().query();
UserTO user = new UserTO();
user.setRealm(RealmsUtils.getFullPath(r.getFullPath()));
@@ -239,7 +225,7 @@ public class AnyPanel extends Panel implements ModalPanel {
anyTypeClassRestClient.list(anyType.getClasses()),
userRestClient,
anyType.getKey(),
- pr).setRealm(realm).setDynRealm(dynRealm).setFiltered(true).
+ pr).setRealm(realm).setFiltered(true).
setFiql(fiql).setWizardInModal(true).addNewItemPanelBuilder(
AnyLayoutUtils.newLayoutInfo(
user, anyType.getClasses(), layout.getUser(), userRestClient, pr)).
@@ -249,11 +235,8 @@ public class AnyPanel extends Panel implements ModalPanel {
break;
case GROUP:
- fiql = dynRealm == null
- ? SyncopeClient.getGroupSearchConditionBuilder().
- is(Constants.KEY_FIELD_NAME).notNullValue().query()
- : SyncopeClient.getGroupSearchConditionBuilder().
- inDynRealms(dynRealm).query();
+ fiql = SyncopeClient.getGroupSearchConditionBuilder().
+ is(Constants.KEY_FIELD_NAME).notNullValue().query();
GroupTO group = new GroupTO();
group.setRealm(RealmsUtils.getFullPath(r.getFullPath()));
@@ -261,7 +244,7 @@ public class AnyPanel extends Panel implements ModalPanel {
anyTypeClassRestClient.list(anyType.getClasses()),
groupRestClient,
anyType.getKey(),
- pr).setRealm(realm).setDynRealm(dynRealm).setFiltered(true).
+ pr).setRealm(realm).setFiltered(true).
setFiql(fiql).setWizardInModal(true).addNewItemPanelBuilder(
AnyLayoutUtils.newLayoutInfo(
group, anyType.getClasses(), layout.getGroup(), groupRestClient, pr)).
@@ -270,11 +253,8 @@ public class AnyPanel extends Panel implements ModalPanel {
break;
case ANY_OBJECT:
- fiql = dynRealm == null
- ? SyncopeClient.getAnyObjectSearchConditionBuilder(anyType.getKey()).
- is(Constants.KEY_FIELD_NAME).notNullValue().query()
- : SyncopeClient.getAnyObjectSearchConditionBuilder(anyType.getKey()).
- inDynRealms(dynRealm).query();
+ fiql = SyncopeClient.getAnyObjectSearchConditionBuilder(anyType.getKey()).
+ is(Constants.KEY_FIELD_NAME).notNullValue().query();
AnyObjectTO anyObject = new AnyObjectTO();
anyObject.setRealm(RealmsUtils.getFullPath(r.getFullPath()));
@@ -283,7 +263,7 @@ public class AnyPanel extends Panel implements ModalPanel {
anyTypeClassRestClient.list(anyType.getClasses()),
anyObjectRestClient,
anyType.getKey(),
- pr).setRealm(realm).setDynRealm(dynRealm).setFiltered(true).
+ pr).setRealm(realm).setFiltered(true).
setFiql(fiql).setWizardInModal(true).addNewItemPanelBuilder(
AnyLayoutUtils.newLayoutInfo(anyObject, anyType.getClasses(),
layout.getAnyObjects().get(anyType.getKey()),
@@ -317,14 +297,10 @@ public class AnyPanel extends Panel implements ModalPanel {
send(AnyPanel.this.directoryPanel, Broadcast.BREADTH,
new ActionLinksTogglePanel.ActionLinkToggleCloseEventPayload(target));
- String precond = realmTO.getFullPath().startsWith(SyncopeConstants.ROOT_REALM)
- ? StringUtils.EMPTY
- : String.format("$dynRealms=~%s;", realmTO.getKey());
-
switch (anyTypeTO.getKind()) {
case USER ->
UserDirectoryPanel.class.cast(AnyPanel.this.directoryPanel).search(
- precond + SearchUtils.buildFIQL(
+ SearchUtils.buildFIQL(
AnyPanel.this.searchPanel.getModel().getObject(),
SyncopeClient.getUserSearchConditionBuilder(),
AnyPanel.this.searchPanel.getAvailableSchemaTypes(),
@@ -333,7 +309,7 @@ public class AnyPanel extends Panel implements ModalPanel {
case GROUP ->
GroupDirectoryPanel.class.cast(AnyPanel.this.directoryPanel).search(
- precond + SearchUtils.buildFIQL(
+ SearchUtils.buildFIQL(
AnyPanel.this.searchPanel.getModel().getObject(),
SyncopeClient.getGroupSearchConditionBuilder(),
AnyPanel.this.searchPanel.getAvailableSchemaTypes(),
@@ -342,7 +318,7 @@ public class AnyPanel extends Panel implements ModalPanel {
case ANY_OBJECT ->
AnyObjectDirectoryPanel.class.cast(AnyPanel.this.directoryPanel).search(
- precond + SearchUtils.buildFIQL(
+ SearchUtils.buildFIQL(
AnyPanel.this.searchPanel.getModel().getObject(),
SyncopeClient.getAnyObjectSearchConditionBuilder(anyTypeTO.getKey()),
AnyPanel.this.searchPanel.getAvailableSchemaTypes(),
diff --git a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/DynRealmDirectoryPanel.java b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/DynRealmDirectoryPanel.java
deleted file mode 100644
index 3968b02bf0..0000000000
--- a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/DynRealmDirectoryPanel.java
+++ /dev/null
@@ -1,196 +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 de.agilecoders.wicket.core.markup.html.bootstrap.dialog.Modal;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-import org.apache.syncope.client.console.SyncopeConsoleSession;
-import org.apache.syncope.client.console.commons.DirectoryDataProvider;
-import org.apache.syncope.client.console.commons.IdRepoConstants;
-import org.apache.syncope.client.console.commons.SortableDataProviderComparator;
-import org.apache.syncope.client.console.pages.BasePage;
-import org.apache.syncope.client.console.panels.DynRealmDirectoryPanel.DynRealmDataProvider;
-import org.apache.syncope.client.console.rest.DynRealmRestClient;
-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.DynRealmWrapper;
-import org.apache.syncope.client.console.wizards.WizardMgtPanel;
-import org.apache.syncope.client.ui.commons.Constants;
-import org.apache.syncope.common.lib.SyncopeClientException;
-import org.apache.syncope.common.lib.to.DynRealmTO;
-import org.apache.syncope.common.lib.types.IdRepoEntitlement;
-import org.apache.wicket.PageReference;
-import org.apache.wicket.ajax.AjaxRequestTarget;
-import org.apache.wicket.ajax.markup.html.AjaxLink;
-import org.apache.wicket.authroles.authorization.strategies.role.metadata.MetaDataRoleAuthorizationStrategy;
-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.WebMarkupContainer;
-import org.apache.wicket.model.CompoundPropertyModel;
-import org.apache.wicket.model.IModel;
-import org.apache.wicket.model.ResourceModel;
-import org.apache.wicket.model.StringResourceModel;
-
-public class DynRealmDirectoryPanel extends
- DirectoryPanel<DynRealmTO, DynRealmWrapper, DynRealmDataProvider, DynRealmRestClient> {
-
- private static final long serialVersionUID = -5491515010207202168L;
-
- protected DynRealmDirectoryPanel(final String id, final Builder builder) {
- super(id, builder);
- MetaDataRoleAuthorizationStrategy.authorize(addAjaxLink, RENDER, IdRepoEntitlement.DYNREALM_CREATE);
- setReadOnly(!SyncopeConsoleSession.get().owns(IdRepoEntitlement.DYNREALM_UPDATE));
-
- disableCheckBoxes();
- setShowResultPanel(true);
-
- modal.size(Modal.Size.Large);
- modal.addSubmitButton();
- setWindowClosedReloadCallback(modal, true);
- setFooterVisibility(true);
-
- AjaxLink<Void> newDynRealmlLink = new AjaxLink<>("add") {
-
- private static final long serialVersionUID = -7978723352517770644L;
-
- @Override
- public void onClick(final AjaxRequestTarget target) {
- modal.header(new StringResourceModel("any.new"));
- modal.setContent(new DynRealmModalPanel(new DynRealmWrapper(new DynRealmTO()), true, modal, pageRef));
- modal.show(true);
- target.add(modal);
- }
- };
- ((WebMarkupContainer) get("container:content")).addOrReplace(newDynRealmlLink);
- MetaDataRoleAuthorizationStrategy.authorize(newDynRealmlLink, RENDER, IdRepoEntitlement.DYNREALM_CREATE);
-
- initResultTable();
- }
-
- @Override
- protected DynRealmDataProvider dataProvider() {
- return new DynRealmDataProvider(rows);
- }
-
- @Override
- protected String paginatorRowsKey() {
- return IdRepoConstants.PREF_DYNREALM_PAGINATOR_ROWS;
- }
-
- @Override
- protected List<IColumn<DynRealmTO, String>> getColumns() {
- final List<IColumn<DynRealmTO, String>> columns = new ArrayList<>();
-
- columns.add(new PropertyColumn<>(
- new ResourceModel(Constants.KEY_FIELD_NAME), Constants.KEY_FIELD_NAME, Constants.KEY_FIELD_NAME));
-
- return columns;
- }
-
- @Override
- public ActionsPanel<DynRealmTO> getActions(final IModel<DynRealmTO> model) {
- final ActionsPanel<DynRealmTO> panel = super.getActions(model);
-
- panel.add(new ActionLink<>() {
-
- private static final long serialVersionUID = -7978723352517770644L;
-
- @Override
- public void onClick(final AjaxRequestTarget target, final DynRealmTO ignore) {
- modal.header(new StringResourceModel("any.edit", model));
- modal.setContent(new DynRealmModalPanel(new DynRealmWrapper(model.getObject()), false, modal, pageRef));
- modal.show(true);
- target.add(modal);
- }
- }, ActionLink.ActionType.EDIT, IdRepoEntitlement.DYNREALM_UPDATE);
-
- panel.add(new ActionLink<>() {
-
- private static final long serialVersionUID = 3766262567901552032L;
-
- @Override
- public void onClick(final AjaxRequestTarget target, final DynRealmTO ignore) {
- try {
- restClient.delete(model.getObject().getKey());
-
- SyncopeConsoleSession.get().success(getString(Constants.OPERATION_SUCCEEDED));
- target.add(container);
- } catch (SyncopeClientException e) {
- LOG.error("While deleting dynamic realm {}", model.getObject().getKey(), e);
- SyncopeConsoleSession.get().onException(e);
- }
- ((BasePage) pageRef.getPage()).getNotificationPanel().refresh(target);
- }
- }, ActionLink.ActionType.DELETE, IdRepoEntitlement.DYNREALM_DELETE, true);
-
- return panel;
- }
-
- @Override
- protected Collection<ActionLink.ActionType> getBatches() {
- return List.of();
- }
-
- protected class DynRealmDataProvider extends DirectoryDataProvider<DynRealmTO> {
-
- private static final long serialVersionUID = 3124431855954382273L;
-
- private final SortableDataProviderComparator<DynRealmTO> comparator;
-
- public DynRealmDataProvider(final int paginatorRows) {
- super(paginatorRows);
- this.comparator = new SortableDataProviderComparator<>(this);
- }
-
- @Override
- public Iterator<DynRealmTO> iterator(final long first, final long count) {
- List<DynRealmTO> result = restClient.list();
- result.sort(comparator);
- return result.subList((int) first, (int) first + (int) count).iterator();
- }
-
- @Override
- public long size() {
- return restClient.list().size();
- }
-
- @Override
- public IModel<DynRealmTO> model(final DynRealmTO object) {
- return new CompoundPropertyModel<>(object);
- }
- }
-
- public abstract static class Builder
- extends DirectoryPanel.Builder<DynRealmTO, DynRealmWrapper, DynRealmRestClient> {
-
- private static final long serialVersionUID = 5530948153889495221L;
-
- public Builder(final DynRealmRestClient restClient, final PageReference pageRef) {
- super(restClient, pageRef);
- }
-
- @Override
- protected WizardMgtPanel<DynRealmWrapper> newInstance(final String id, final boolean wizardInModal) {
- return new DynRealmDirectoryPanel(id, this);
- }
- }
-}
diff --git a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/DynRealmModalPanel.java b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/DynRealmModalPanel.java
deleted file mode 100644
index de9ddb374d..0000000000
--- a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/DynRealmModalPanel.java
+++ /dev/null
@@ -1,152 +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.util.List;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.syncope.client.console.SyncopeConsoleSession;
-import org.apache.syncope.client.console.pages.BasePage;
-import org.apache.syncope.client.console.panels.search.AnyObjectSearchPanel;
-import org.apache.syncope.client.console.panels.search.GroupSearchPanel;
-import org.apache.syncope.client.console.panels.search.MapOfListModel;
-import org.apache.syncope.client.console.panels.search.UserSearchPanel;
-import org.apache.syncope.client.console.rest.AnyTypeRestClient;
-import org.apache.syncope.client.console.rest.DynRealmRestClient;
-import org.apache.syncope.client.console.wicket.markup.html.bootstrap.dialog.BaseModal;
-import org.apache.syncope.client.console.wizards.DynRealmWrapper;
-import org.apache.syncope.client.ui.commons.Constants;
-import org.apache.syncope.client.ui.commons.markup.html.form.AjaxTextFieldPanel;
-import org.apache.syncope.client.ui.commons.wicket.markup.html.bootstrap.tabs.Accordion;
-import org.apache.syncope.common.lib.to.AnyTypeTO;
-import org.apache.wicket.PageReference;
-import org.apache.wicket.ajax.AjaxRequestTarget;
-import org.apache.wicket.extensions.markup.html.tabs.AbstractTab;
-import org.apache.wicket.markup.html.list.ListItem;
-import org.apache.wicket.markup.html.list.ListView;
-import org.apache.wicket.markup.html.panel.Panel;
-import org.apache.wicket.model.LoadableDetachableModel;
-import org.apache.wicket.model.Model;
-import org.apache.wicket.model.PropertyModel;
-import org.apache.wicket.spring.injection.annot.SpringBean;
-
-public class DynRealmModalPanel extends AbstractModalPanel<DynRealmWrapper> {
-
- private static final long serialVersionUID = -3773196441177699452L;
-
- @SpringBean
- protected AnyTypeRestClient anyTypeRestClient;
-
- @SpringBean
- protected DynRealmRestClient dynRealmRestClient;
-
- protected final DynRealmWrapper dynRealmWrapper;
-
- protected final boolean create;
-
- public DynRealmModalPanel(
- final DynRealmWrapper dynRealmWrapper,
- final boolean create,
- final BaseModal<DynRealmWrapper> modal,
- final PageReference pageRef) {
-
- super(modal, pageRef);
- this.dynRealmWrapper = dynRealmWrapper;
- this.create = create;
- modal.setFormModel(dynRealmWrapper);
-
- AjaxTextFieldPanel key = new AjaxTextFieldPanel(
- Constants.KEY_FIELD_NAME,
- Constants.KEY_FIELD_NAME,
- new PropertyModel<>(dynRealmWrapper.getInnerObject(), Constants.KEY_FIELD_NAME), false);
- key.setReadOnly(!create);
- key.setRequired(true);
- add(key);
-
- final LoadableDetachableModel<List<AnyTypeTO>> types = new LoadableDetachableModel<>() {
-
- private static final long serialVersionUID = 5275935387613157437L;
-
- @Override
- protected List<AnyTypeTO> load() {
- return anyTypeRestClient.listAnyTypes();
- }
- };
-
- add(new ListView<>("dynMembershipCond", types) {
-
- private static final long serialVersionUID = 9101744072914090143L;
-
- @Override
- protected void populateItem(final ListItem<AnyTypeTO> item) {
- final String key = item.getModelObject().getKey();
- item.add(new Accordion("dynMembershipCond", List.of(
- new AbstractTab(Model.of(key + " Dynamic Condition")) {
-
- private static final long serialVersionUID = 1037272333056449378L;
-
- @Override
- public Panel getPanel(final String panelId) {
- switch (item.getModelObject().getKind()) {
- case USER:
- return new UserSearchPanel.Builder(
- new MapOfListModel<>(dynRealmWrapper, "dynClauses", key), pageRef).
- required(false).build(panelId);
-
- case GROUP:
- return new GroupSearchPanel.Builder(
- new MapOfListModel<>(dynRealmWrapper, "dynClauses", key), pageRef).
- required(false).build(panelId);
-
- case ANY_OBJECT:
- default:
- return new AnyObjectSearchPanel.Builder(
- key,
- new MapOfListModel<>(dynRealmWrapper, "dynClauses", key), pageRef).
- required(false).build(panelId);
- }
- }
- }), Model.of(StringUtils.isBlank(dynRealmWrapper.getDynMembershipConds().get(key)) ? -1 : 0)).
- setOutputMarkupId(true));
- }
- });
- }
-
- @Override
- public DynRealmWrapper getItem() {
- return dynRealmWrapper;
- }
-
- @Override
- public void onSubmit(final AjaxRequestTarget target) {
- try {
- dynRealmWrapper.fillDynamicConditions();
- if (create) {
- dynRealmRestClient.create(dynRealmWrapper.getInnerObject());
- } else {
- dynRealmRestClient.update(dynRealmWrapper.getInnerObject());
- }
- SyncopeConsoleSession.get().success(getString(Constants.OPERATION_SUCCEEDED));
- this.modal.close(target);
- } catch (Exception e) {
- LOG.error("While creating/updating dynamic realm", e);
- SyncopeConsoleSession.get().onException(e);
- }
- ((BasePage) pageRef.getPage()).getNotificationPanel().refresh(target);
- }
-}
diff --git a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/GroupDirectoryPanel.java b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/GroupDirectoryPanel.java
index c8b2acbb8f..96f8f872f3 100644
--- a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/GroupDirectoryPanel.java
+++ b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/GroupDirectoryPanel.java
@@ -251,7 +251,7 @@ public class GroupDirectoryPanel extends AnyDirectoryPanel<GroupTO, GroupRestCli
}
}, ActionType.EDIT,
String.format("%s,%s", IdRepoEntitlement.GROUP_READ, IdRepoEntitlement.GROUP_UPDATE)).
- setRealms(realm, model.getObject().getDynRealms());
+ setRealm(realm);
actions.add(new ActionLink<>() {
@@ -288,7 +288,7 @@ public class GroupDirectoryPanel extends AnyDirectoryPanel<GroupTO, GroupRestCli
typeExtensionsModal.show(true);
}
}, ActionType.TYPE_EXTENSIONS, IdRepoEntitlement.GROUP_UPDATE).
- setRealms(realm, model.getObject().getDynRealms());
+ setRealm(realm);
actions.add(new ActionLink<>() {
@@ -307,7 +307,7 @@ public class GroupDirectoryPanel extends AnyDirectoryPanel<GroupTO, GroupRestCli
}
}, ActionType.MEMBERS,
String.format("%s,%s", IdRepoEntitlement.GROUP_READ, IdRepoEntitlement.GROUP_UPDATE)).
- setRealms(realm, model.getObject().getDynRealms());
+ setRealm(realm);
ActionLink<GroupTO> provisionMembers = new ActionLink<GroupTO>() {
@@ -432,7 +432,7 @@ public class GroupDirectoryPanel extends AnyDirectoryPanel<GroupTO, GroupRestCli
}
}, ActionType.VIEW_AUDIT_HISTORY,
String.format("%s,%s", IdRepoEntitlement.GROUP_READ, IdRepoEntitlement.AUDIT_LIST)).
- setRealms(realm, model.getObject().getDynRealms());
+ setRealm(realm);
actions.add(new ActionLink<>() {
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 48b79686d9..9cfeb117fb 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
@@ -25,7 +25,6 @@ import de.agilecoders.wicket.core.markup.html.bootstrap.button.dropdown.DropDown
import de.agilecoders.wicket.core.markup.html.bootstrap.button.dropdown.DropDownButton;
import de.agilecoders.wicket.extensions.markup.html.bootstrap.icon.FontAwesome5IconType;
import java.util.ArrayList;
-import java.util.Collection;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
@@ -45,7 +44,6 @@ import org.apache.syncope.client.console.wicket.markup.html.WebMarkupContainerNo
import org.apache.syncope.client.ui.commons.Constants;
import org.apache.syncope.client.ui.commons.ajax.form.IndicatorAjaxFormComponentUpdatingBehavior;
import org.apache.syncope.common.lib.SyncopeConstants;
-import org.apache.syncope.common.lib.to.DynRealmTO;
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;
@@ -87,8 +85,6 @@ public class RealmChoicePanel extends Panel {
protected final LoadableDetachableModel<List<Pair<String, RealmTO>>> realmTree;
- protected final LoadableDetachableModel<List<DynRealmTO>> dynRealmTree;
-
protected final WebMarkupContainerNoVeil container;
protected Model<RealmTO> model;
@@ -140,28 +136,6 @@ public class RealmChoicePanel extends Panel {
}
};
- dynRealmTree = new LoadableDetachableModel<>() {
-
- private static final long serialVersionUID = 5275935387613157437L;
-
- @Override
- protected List<DynRealmTO> load() {
- List<DynRealmTO> dynRealms = realmRestClient.listDynRealms();
- dynRealms.sort((left, right) -> {
- if (left == null) {
- return -1;
- }
- if (right == null) {
- return 1;
- }
- return left.getKey().compareTo(right.getKey());
- });
- return dynRealms.stream().filter(dynRealm -> SyncopeConsoleSession.get().getSearchableRealms().stream().
- anyMatch(availableRealm -> SyncopeConstants.ROOT_REALM.equals(availableRealm)
- || dynRealm.getKey().equals(availableRealm))).collect(Collectors.toList());
- }
- };
-
RealmTO realm = SyncopeConsoleSession.get().getRootRealm(base).map(rootRealm -> {
String rootRealmName = StringUtils.substringAfterLast(rootRealm, "/");
@@ -381,65 +355,10 @@ public class RealmChoicePanel extends Panel {
}
});
});
-
- if (!dynRealmTree.getObject().isEmpty()) {
- RealmChoicePanel.this.links.add(new BootstrapAjaxLink<>(
- ButtonList.getButtonMarkupId(),
- new Model<>(),
- Buttons.Type.Link,
- new ResourceModel("dynrealms", "Dynamic Realms")) {
-
- private static final long serialVersionUID = -7978723352517770744L;
-
- @Override
- public void onClick(final AjaxRequestTarget target) {
- }
-
- @Override
- public boolean isEnabled() {
- return false;
- }
-
- @Override
- protected void onComponentTag(final ComponentTag tag) {
- tag.put("class", "dropdown-header disabled");
- }
- });
-
- dynRealmTree.getObject().forEach(dynRealmTO -> {
- RealmTO realm = new RealmTO();
- realm.setKey(dynRealmTO.getKey());
- realm.setName(dynRealmTO.getKey());
- realm.setFullPath(dynRealmTO.getKey());
-
- RealmChoicePanel.this.links.add(new BootstrapAjaxLink<>(
- ButtonList.getButtonMarkupId(),
- new Model<>(),
- Buttons.Type.Link,
- new Model<>(realm.getKey())) {
-
- private static final long serialVersionUID = -7978723352517770644L;
-
- @Override
- public void onClick(final AjaxRequestTarget target) {
- chooseRealm(realm, target);
- }
- });
- });
- }
}
protected List<RealmTO> buildRealmChoices() {
- return Stream.of(
- realmTree.getObject().stream().map(Pair::getValue).collect(Collectors.toList()),
- dynRealmTree.getObject().stream().map(item -> {
- RealmTO realm = new RealmTO();
- realm.setKey(item.getKey());
- realm.setName(item.getKey());
- realm.setFullPath(item.getKey());
- return realm;
- }).collect(Collectors.toList())).flatMap(Collection::stream).
- collect(Collectors.toList());
+ return realmTree.getObject().stream().map(Pair::getRight).toList();
}
public final RealmChoicePanel reloadRealmTree(final AjaxRequestTarget target) {
diff --git a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/RoleDirectoryPanel.java b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/RoleDirectoryPanel.java
index 077d74478f..a57be4b32e 100644
--- a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/RoleDirectoryPanel.java
+++ b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/RoleDirectoryPanel.java
@@ -127,8 +127,6 @@ public class RoleDirectoryPanel extends DirectoryPanel<RoleTO, RoleWrapper, Role
new ResourceModel("entitlements", "Entitlements"), null, "entitlements"));
columns.add(new PropertyColumn<>(
new ResourceModel("realms"), null, "realms"));
- columns.add(new PropertyColumn<>(
- new ResourceModel("dynRealms"), null, "dynRealms"));
return columns;
}
diff --git a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/UserDirectoryPanel.java b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/UserDirectoryPanel.java
index 6393f31fcf..ef5dea5ba2 100644
--- a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/UserDirectoryPanel.java
+++ b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/UserDirectoryPanel.java
@@ -142,7 +142,7 @@ public class UserDirectoryPanel extends AnyDirectoryPanel<UserTO, UserRestClient
}
}, ActionType.EDIT,
String.format("%s,%s", IdRepoEntitlement.USER_READ, IdRepoEntitlement.USER_UPDATE)).
- setRealms(realm, model.getObject().getDynRealms());
+ setRealm(realm);
panel.add(new ActionLink<>() {
@@ -166,7 +166,7 @@ public class UserDirectoryPanel extends AnyDirectoryPanel<UserTO, UserRestClient
((BasePage) pageRef.getPage()).getNotificationPanel().refresh(target);
}
}, ActionType.MUSTCHANGEPASSWORD, IdRepoEntitlement.USER_UPDATE).
- setRealms(realm, model.getObject().getDynRealms());
+ setRealm(realm);
if (wizardInModal) {
panel.add(new ActionLink<>() {
@@ -192,7 +192,7 @@ public class UserDirectoryPanel extends AnyDirectoryPanel<UserTO, UserRestClient
displayAttributeModal.show(true);
}
}, ActionType.PASSWORD_MANAGEMENT, IdRepoEntitlement.USER_UPDATE).
- setRealms(realm, model.getObject().getDynRealms());
+ setRealm(realm);
PlatformInfo platformInfo = SyncopeConsoleSession.get().getAnonymousClient().platform();
if (platformInfo.isPwdResetAllowed() && !platformInfo.isPwdResetRequiringSecurityQuestions()) {
@@ -215,7 +215,7 @@ public class UserDirectoryPanel extends AnyDirectoryPanel<UserTO, UserRestClient
((BasePage) pageRef.getPage()).getNotificationPanel().refresh(target);
}
}, ActionType.REQUEST_PASSWORD_RESET, IdRepoEntitlement.USER_UPDATE).
- setRealms(realm, model.getObject().getDynRealms());
+ setRealm(realm);
}
SyncopeWebApplication.get().getAnyDirectoryPanelAdditionalActionLinksProvider().get(
@@ -309,7 +309,7 @@ public class UserDirectoryPanel extends AnyDirectoryPanel<UserTO, UserRestClient
}
}, ActionType.VIEW_AUDIT_HISTORY,
String.format("%s,%s", IdRepoEntitlement.USER_READ, IdRepoEntitlement.AUDIT_LIST)).
- setRealms(realm, model.getObject().getDynRealms());
+ setRealm(realm);
}
panel.add(new ActionLink<>() {
diff --git a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/rest/DynRealmRestClient.java b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/rest/DynRealmRestClient.java
deleted file mode 100644
index 5bc61d4c7c..0000000000
--- a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/rest/DynRealmRestClient.java
+++ /dev/null
@@ -1,47 +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.rest;
-
-import java.util.List;
-import org.apache.syncope.common.lib.to.DynRealmTO;
-import org.apache.syncope.common.rest.api.service.DynRealmService;
-
-/**
- * Console client for invoking REST DynRealm's services.
- */
-public class DynRealmRestClient extends BaseRestClient {
-
- private static final long serialVersionUID = -8549081557283519638L;
-
- public List<DynRealmTO> list() {
- return getService(DynRealmService.class).list();
- }
-
- public void create(final DynRealmTO dynRealmTO) {
- getService(DynRealmService.class).create(dynRealmTO);
- }
-
- public void update(final DynRealmTO dynRealmTO) {
- getService(DynRealmService.class).update(dynRealmTO);
- }
-
- public void delete(final String key) {
- getService(DynRealmService.class).delete(key);
- }
-}
diff --git a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/rest/RealmRestClient.java b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/rest/RealmRestClient.java
index 3ea3b3fc22..837f3d349a 100644
--- a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/rest/RealmRestClient.java
+++ b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/rest/RealmRestClient.java
@@ -20,13 +20,10 @@ package org.apache.syncope.client.console.rest;
import jakarta.ws.rs.core.GenericType;
import jakarta.ws.rs.core.Response;
-import java.util.List;
-import org.apache.syncope.common.lib.to.DynRealmTO;
import org.apache.syncope.common.lib.to.PagedResult;
import org.apache.syncope.common.lib.to.ProvisioningResult;
import org.apache.syncope.common.lib.to.RealmTO;
import org.apache.syncope.common.rest.api.beans.RealmQuery;
-import org.apache.syncope.common.rest.api.service.DynRealmService;
import org.apache.syncope.common.rest.api.service.RealmService;
/**
@@ -40,14 +37,6 @@ public class RealmRestClient extends BaseRestClient {
return getService(RealmService.class).search(query);
}
- public List<DynRealmTO> listDynRealms() {
- return getService(DynRealmService.class).list();
- }
-
- public DynRealmTO readDynRealm(final String key) {
- return getService(DynRealmService.class).read(key);
- }
-
public ProvisioningResult<RealmTO> create(final String parentPath, final RealmTO realmTO) {
final Response response = getService(RealmService.class).create(parentPath, realmTO);
return response.readEntity(new GenericType<>() {
diff --git a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/Action.java b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/Action.java
index 97e850025f..9ebf31de18 100644
--- a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/Action.java
+++ b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/Action.java
@@ -80,14 +80,6 @@ public final class Action<T extends Serializable> implements Serializable {
}
}
- public void setRealms(final String realm, final List<String> dynRealms) {
- setRealm(realm);
-
- if (dynRealms != null) {
- this.realms.addAll(dynRealms);
- }
- }
-
public ActionLink<T> getLink() {
return link;
}
diff --git a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/wizards/DynRealmWrapper.java b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/wizards/DynRealmWrapper.java
deleted file mode 100644
index ce16a7f8f7..0000000000
--- a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/wizards/DynRealmWrapper.java
+++ /dev/null
@@ -1,83 +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.wizards;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import org.apache.commons.collections4.CollectionUtils;
-import org.apache.syncope.client.console.panels.search.SearchClause;
-import org.apache.syncope.client.console.panels.search.SearchUtils;
-import org.apache.syncope.client.lib.SyncopeClient;
-import org.apache.syncope.client.ui.commons.wizards.any.EntityWrapper;
-import org.apache.syncope.common.lib.search.AbstractFiqlSearchConditionBuilder;
-import org.apache.syncope.common.lib.to.DynRealmTO;
-import org.apache.syncope.common.lib.types.AnyTypeKind;
-
-public class DynRealmWrapper extends EntityWrapper<DynRealmTO> {
-
- private static final long serialVersionUID = 7226128615964284614L;
-
- private Map<String, List<SearchClause>> dynClauses;
-
- public DynRealmWrapper(final DynRealmTO dynRealmTO) {
- super(dynRealmTO);
- getDynClauses();
- }
-
- public final Map<String, List<SearchClause>> getDynClauses() {
- if (this.dynClauses == null) {
- this.dynClauses = SearchUtils.getSearchClauses(getInnerObject().getDynMembershipConds());
- }
- return this.dynClauses;
- }
-
- public void setDynClauses(final Map<String, List<SearchClause>> dynClauses) {
- this.dynClauses.clear();
- this.dynClauses.putAll(dynClauses);
- }
-
- public Map<String, String> getDynMembershipConds() {
- final Map<String, String> res = new HashMap<>();
- if (this.dynClauses != null && !this.dynClauses.isEmpty()) {
- this.dynClauses.entrySet().stream().
- filter(entry -> (CollectionUtils.isNotEmpty(entry.getValue()))).
- forEachOrdered(entry -> {
- AbstractFiqlSearchConditionBuilder<?, ?, ?> builder =
- AnyTypeKind.USER.name().equals(entry.getKey())
- ? SyncopeClient.getUserSearchConditionBuilder()
- : AnyTypeKind.GROUP.name().equals(entry.getKey())
- ? SyncopeClient.getGroupSearchConditionBuilder()
- : SyncopeClient.getAnyObjectSearchConditionBuilder(entry.getKey());
- String fiql = SearchUtils.buildFIQL(entry.getValue(), builder);
- if (fiql != null) {
- res.put(entry.getKey(), fiql);
- }
- });
- }
-
- return res;
- }
-
- public DynRealmTO fillDynamicConditions() {
- getInnerObject().getDynMembershipConds().clear();
- getInnerObject().getDynMembershipConds().putAll(this.getDynMembershipConds());
- return getInnerObject();
- }
-}
diff --git a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/wizards/any/AnyWizardBuilder.java b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/wizards/any/AnyWizardBuilder.java
index d00eb16db4..dee5915090 100644
--- a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/wizards/any/AnyWizardBuilder.java
+++ b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/wizards/any/AnyWizardBuilder.java
@@ -27,7 +27,6 @@ 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.layout.GroupFormLayoutInfo;
import org.apache.syncope.client.console.layout.UserFormLayoutInfo;
import org.apache.syncope.client.ui.commons.layout.AbstractAnyFormLayout;
import org.apache.syncope.client.ui.commons.wizards.AjaxWizard;
@@ -106,18 +105,6 @@ public abstract class AnyWizardBuilder<A extends AnyTO> extends AbstractAnyWizar
// optional details panel step
addOptionalDetailsPanel(modelObject).ifPresent(wizardModel::add);
- if (this instanceof GroupWizardBuilder
- && modelObject instanceof final GroupWrapper gw
- && formLayoutInfo instanceof final GroupFormLayoutInfo groupFormLayoutInfo) {
-
- if (groupFormLayoutInfo.isOwnership()) {
- wizardModel.add(new Ownership(gw, pageRef));
- }
- if (groupFormLayoutInfo.isDynamicMemberships()) {
- wizardModel.add(new DynamicMemberships(gw, pageRef));
- }
- }
-
if (formLayoutInfo.isAuxClasses()) {
wizardModel.add(new ConsoleAuxClasses(modelObject, anyTypeClasses));
}
@@ -146,6 +133,10 @@ public abstract class AnyWizardBuilder<A extends AnyTO> extends AbstractAnyWizar
wizardModel.add(new DerAttrs(modelObject, anyTypeClasses, formLayoutInfo.getWhichDerAttrs()));
}
+ if (formLayoutInfo.isManager()) {
+ wizardModel.add(new Management(modelObject, pageRef));
+ }
+
// role panel step (just available for users)
if (this instanceof UserWizardBuilder
&& modelObject instanceof final UserWrapper userWrapper
diff --git a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/wizards/any/DynamicMemberships.java b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/wizards/any/DynamicMemberships.java
deleted file mode 100644
index 4f22ece31f..0000000000
--- a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/wizards/any/DynamicMemberships.java
+++ /dev/null
@@ -1,110 +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.wizards.any;
-
-import java.util.List;
-import java.util.stream.Collectors;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.syncope.client.console.panels.search.AnyObjectSearchPanel;
-import org.apache.syncope.client.console.panels.search.MapOfListModel;
-import org.apache.syncope.client.console.panels.search.UserSearchPanel;
-import org.apache.syncope.client.console.rest.AnyTypeRestClient;
-import org.apache.syncope.client.ui.commons.wicket.markup.html.bootstrap.tabs.Accordion;
-import org.apache.syncope.common.lib.to.AnyTypeTO;
-import org.apache.syncope.common.lib.types.AnyTypeKind;
-import org.apache.wicket.PageReference;
-import org.apache.wicket.extensions.markup.html.tabs.AbstractTab;
-import org.apache.wicket.extensions.wizard.WizardStep;
-import org.apache.wicket.markup.html.list.ListItem;
-import org.apache.wicket.markup.html.list.ListView;
-import org.apache.wicket.markup.html.panel.Panel;
-import org.apache.wicket.model.LoadableDetachableModel;
-import org.apache.wicket.model.Model;
-import org.apache.wicket.model.PropertyModel;
-import org.apache.wicket.model.ResourceModel;
-import org.apache.wicket.model.StringResourceModel;
-import org.apache.wicket.spring.injection.annot.SpringBean;
-
-public class DynamicMemberships extends WizardStep {
-
- private static final long serialVersionUID = 855618618337931784L;
-
- @SpringBean
- protected AnyTypeRestClient anyTypeRestClient;
-
- public DynamicMemberships(final GroupWrapper groupWrapper, final PageReference pageRef) {
- super();
-
- final LoadableDetachableModel<List<AnyTypeTO>> types = new LoadableDetachableModel<>() {
-
- private static final long serialVersionUID = 5275935387613157437L;
-
- @Override
- protected List<AnyTypeTO> load() {
- return anyTypeRestClient.listAnyTypes().stream().
- filter(type -> AnyTypeKind.USER != type.getKind() && AnyTypeKind.GROUP != type.getKind()).
- collect(Collectors.toList());
- }
- };
-
- // ------------------------
- // uDynMembershipCond
- // ------------------------
- add(new Accordion("uDynMembershipCond", List.of(
- new AbstractTab(new ResourceModel("uDynMembershipCond", "Dynamic USER Membership Conditions")) {
-
- private static final long serialVersionUID = 1037272333056449378L;
-
- @Override
- public Panel getPanel(final String panelId) {
- return new UserSearchPanel.Builder(new PropertyModel<>(groupWrapper, "uDynClauses"), pageRef).
- required(true).build(panelId);
- }
- }), Model.of(StringUtils.isBlank(groupWrapper.getUDynMembershipCond()) ? -1 : 0)).setOutputMarkupId(true));
- // ------------------------
-
- // ------------------------
- // aDynMembershipConds
- // ------------------------
- add(new ListView<>("aDynMembershipCond", types) {
-
- private static final long serialVersionUID = 9101744072914090143L;
-
- @Override
- protected void populateItem(final ListItem<AnyTypeTO> item) {
- final String key = item.getModelObject().getKey();
- item.add(new Accordion("aDynMembershipCond", List.of(
- new AbstractTab(new StringResourceModel(
- "aDynMembershipCond", this, new Model<>(item.getModelObject()))) {
-
- private static final long serialVersionUID = 1037272333056449378L;
-
- @Override
- public Panel getPanel(final String panelId) {
- return new AnyObjectSearchPanel.Builder(
- key, new MapOfListModel<>(groupWrapper, "aDynClauses", key), pageRef).
- required(false).build(panelId);
- }
- }), Model.of(StringUtils.isBlank(groupWrapper.getADynMembershipConds().get(key)) ? -1 : 0)).
- setOutputMarkupId(true));
- }
- });
- // ------------------------
- }
-}
diff --git a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/wizards/any/GroupWizardBuilder.java b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/wizards/any/GroupWizardBuilder.java
index 83995f2726..15bba40bdb 100644
--- a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/wizards/any/GroupWizardBuilder.java
+++ b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/wizards/any/GroupWizardBuilder.java
@@ -21,7 +21,6 @@ package org.apache.syncope.client.console.wizards.any;
import java.io.Serializable;
import java.util.List;
import java.util.Optional;
-import org.apache.commons.lang3.StringUtils;
import org.apache.cxf.common.util.CollectionUtils;
import org.apache.syncope.client.console.layout.GroupForm;
import org.apache.syncope.client.console.layout.GroupFormLayoutInfo;
@@ -90,9 +89,7 @@ public class GroupWizardBuilder extends AnyWizardBuilder<GroupTO> implements Gro
@Override
protected Serializable onApplyInternal(final AnyWrapper<GroupTO> modelObject) {
- GroupTO updated = modelObject instanceof GroupWrapper gw
- ? gw.fillDynamicConditions()
- : modelObject.getInnerObject();
+ GroupTO updated = modelObject.getInnerObject();
ProvisioningResult<GroupTO> result;
if (updated.getKey() == null) {
@@ -103,16 +100,8 @@ public class GroupWizardBuilder extends AnyWizardBuilder<GroupTO> implements Gro
GroupTO original = getOriginalItem().getInnerObject();
fixPlainAttrs(updated, original);
- // SYNCOPE-1170
boolean othersNotEqualsOrBlanks =
- !updated.getADynMembershipConds().equals(original.getADynMembershipConds())
- || (StringUtils.isNotBlank(original.getUDynMembershipCond())
- && StringUtils.isBlank(updated.getUDynMembershipCond()))
- || (StringUtils.isBlank(original.getUDynMembershipCond())
- && StringUtils.isNotBlank(updated.getUDynMembershipCond()))
- || StringUtils.isAllBlank(original.getUDynMembershipCond(), updated.getUDynMembershipCond())
- || !updated.getUDynMembershipCond().equals(original.getUDynMembershipCond())
- || !CollectionUtils.diff(updated.getTypeExtensions(), original.getTypeExtensions()).isEmpty();
+ !CollectionUtils.diff(updated.getTypeExtensions(), original.getTypeExtensions()).isEmpty();
GroupUR groupUR = AnyOperations.diff(updated, original, false);
diff --git a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/wizards/any/GroupWrapper.java b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/wizards/any/GroupWrapper.java
index 649083ec5c..69ed160c2a 100644
--- a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/wizards/any/GroupWrapper.java
+++ b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/wizards/any/GroupWrapper.java
@@ -18,13 +18,6 @@
*/
package org.apache.syncope.client.console.wizards.any;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import org.apache.commons.collections4.CollectionUtils;
-import org.apache.syncope.client.console.panels.search.SearchClause;
-import org.apache.syncope.client.console.panels.search.SearchUtils;
-import org.apache.syncope.client.lib.SyncopeClient;
import org.apache.syncope.client.ui.commons.wizards.any.AnyWrapper;
import org.apache.syncope.common.lib.to.GroupTO;
@@ -34,10 +27,6 @@ public class GroupWrapper extends AnyWrapper<GroupTO> {
private GroupTO previousGroupTO;
- private List<SearchClause> uDynClauses;
-
- private Map<String, List<SearchClause>> aDynClauses;
-
public GroupWrapper(final GroupTO groupTO) {
this(null, groupTO);
}
@@ -45,63 +34,9 @@ public class GroupWrapper extends AnyWrapper<GroupTO> {
public GroupWrapper(final GroupTO previousGroupTO, final GroupTO groupTO) {
super(groupTO);
this.previousGroupTO = previousGroupTO;
- getUDynClauses();
- getADynClauses();
}
public GroupTO getPreviousGroupTO() {
return previousGroupTO;
}
-
- public final List<SearchClause> getUDynClauses() {
- if (this.uDynClauses == null) {
- this.uDynClauses = SearchUtils.getSearchClauses(this.anyTO.getUDynMembershipCond());
- }
- return this.uDynClauses;
- }
-
- public void setUDynClauses(final List<SearchClause> uDynClauses) {
- this.uDynClauses = uDynClauses;
- }
-
- public final Map<String, List<SearchClause>> getADynClauses() {
- if (this.aDynClauses == null) {
- this.aDynClauses = SearchUtils.getSearchClauses(this.anyTO.getADynMembershipConds());
- }
- return this.aDynClauses;
- }
-
- public void setADynClauses(final Map<String, List<SearchClause>> aDynClauses) {
- this.aDynClauses = aDynClauses;
- }
-
- public String getUDynMembershipCond() {
- return CollectionUtils.isEmpty(this.uDynClauses)
- ? null
- : SearchUtils.buildFIQL(this.uDynClauses, SyncopeClient.getUserSearchConditionBuilder());
- }
-
- public Map<String, String> getADynMembershipConds() {
- Map<String, String> res = new HashMap<>();
- if (this.aDynClauses != null && !this.aDynClauses.isEmpty()) {
- this.aDynClauses.entrySet().stream().
- filter(entry -> CollectionUtils.isNotEmpty(entry.getValue())).
- forEach(entry -> {
- String fiql = SearchUtils.buildFIQL(entry.getValue(),
- SyncopeClient.getAnyObjectSearchConditionBuilder(entry.getKey()));
- if (fiql != null) {
- res.put(entry.getKey(), fiql);
- }
- });
- }
-
- return res;
- }
-
- public GroupTO fillDynamicConditions() {
- this.anyTO.setUDynMembershipCond(this.getUDynMembershipCond());
- this.anyTO.getADynMembershipConds().clear();
- this.anyTO.getADynMembershipConds().putAll(this.getADynMembershipConds());
- return this.anyTO;
- }
}
diff --git a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/wizards/any/Groups.java b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/wizards/any/Groups.java
index 2304d6dde4..1b3b7709f8 100644
--- a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/wizards/any/Groups.java
+++ b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/wizards/any/Groups.java
@@ -18,7 +18,6 @@
*/
package org.apache.syncope.client.console.wizards.any;
-import java.util.ArrayList;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
@@ -26,7 +25,6 @@ import java.util.Map;
import java.util.stream.Collectors;
import org.apache.commons.lang3.StringUtils;
import org.apache.cxf.jaxrs.ext.search.client.CompleteCondition;
-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.client.console.rest.SyncopeRestClient;
@@ -39,19 +37,15 @@ import org.apache.syncope.client.ui.commons.wizards.any.AnyWrapper;
import org.apache.syncope.common.lib.SyncopeConstants;
import org.apache.syncope.common.lib.search.GroupFiqlSearchConditionBuilder;
import org.apache.syncope.common.lib.to.AnyTO;
-import org.apache.syncope.common.lib.to.DynRealmTO;
import org.apache.syncope.common.lib.to.GroupTO;
import org.apache.syncope.common.lib.to.GroupableRelatableTO;
import org.apache.syncope.common.lib.to.MembershipTO;
-import org.apache.syncope.common.lib.types.IdRepoEntitlement;
import org.apache.wicket.authroles.authorization.strategies.role.metadata.ActionPermissions;
import org.apache.wicket.authroles.authorization.strategies.role.metadata.MetaDataRoleAuthorizationStrategy;
import org.apache.wicket.extensions.markup.html.repeater.util.SortParam;
-import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.form.IChoiceRenderer;
import org.apache.wicket.model.IModel;
-import org.apache.wicket.model.PropertyModel;
import org.apache.wicket.model.util.ListModel;
import org.apache.wicket.spring.injection.annot.SpringBean;
@@ -65,8 +59,6 @@ public class Groups extends AbstractGroups {
@SpringBean
protected SyncopeRestClient syncopeRestClient;
- protected final List<DynRealmTO> allDynRealms = new ArrayList<>();
-
protected final boolean templateMode;
protected final ConsoleGroupsModel groupsModel;
@@ -86,9 +78,7 @@ public class Groups extends AbstractGroups {
permissions.authorizeAll(RENDER);
// -----------------------------------------------------------------
- addDynamicGroupsContainer();
addGroupsPanel();
- addDynamicRealmsContainer();
}
protected List<GroupTO> searchAssignable(final String term) {
@@ -96,25 +86,11 @@ public class Groups extends AbstractGroups {
SyncopeConstants.ROOT_REALM, term, 1, Constants.MAX_GROUP_LIST_SIZE);
}
- @Override
- protected void addDynamicRealmsContainer() {
- dynrealmsContainer = new WebMarkupContainer("dynrealmsContainer");
- dynrealmsContainer.setOutputMarkupId(true);
- dynrealmsContainer.setOutputMarkupPlaceholderTag(true);
- dynrealmsContainer.add(new AjaxPalettePanel.Builder<>().build("dynrealms",
- new PropertyModel<>(anyTO, "dynRealms"),
- new ListModel<>(allDynRealms.stream().map(DynRealmTO::getKey).collect(Collectors.toList()))).
- hideLabel().setEnabled(false).setOutputMarkupId(true));
- add(dynrealmsContainer);
- }
-
@Override
protected void addGroupsPanel() {
if (anyTO instanceof GroupTO) {
groupsContainer.add(new Label("groups").setVisible(false));
groupsContainer.setVisible(false);
- dyngroupsContainer.add(new Label("dyngroups").setVisible(false));
- dyngroupsContainer.setVisible(false);
} else {
groups = new AjaxPalettePanel.Builder<MembershipTO>().setRenderer(new IChoiceRenderer<>() {
@@ -163,35 +139,12 @@ public class Groups extends AbstractGroups {
collect(Collectors.toList());
}
}).hideLabel().setOutputMarkupId(true));
-
- dyngroupsContainer.add(new AjaxPalettePanel.Builder<String>().setAllowOrder(true).build("dyngroups",
- new ListModel<>() {
-
- private static final long serialVersionUID = -2583290457773357445L;
-
- @Override
- public List<String> getObject() {
- return Groups.this.groupsModel.getDynMemberships();
- }
- }, new ListModel<>(groupsModel.getObject().stream().
- map(GroupTO::getName).collect(Collectors.toList()))).
- hideLabel().setEnabled(false).setOutputMarkupId(true));
}
}
- @Override
- protected void addDynamicGroupsContainer() {
- dyngroupsContainer = new WebMarkupContainer("dyngroupsContainer");
- dyngroupsContainer.setOutputMarkupId(true);
- dyngroupsContainer.setOutputMarkupPlaceholderTag(true);
- add(dyngroupsContainer);
- }
-
@Override
public boolean evaluate() {
- return (anyTO instanceof GroupTO
- ? !allDynRealms.isEmpty()
- : !allDynRealms.isEmpty() || !groupsModel.getObject().isEmpty())
+ return (!(anyTO instanceof GroupTO) || !groupsModel.getObject().isEmpty())
&& SyncopeWebApplication.get().getSecuritySettings().getAuthorizationStrategy().
isActionAuthorized(this, RENDER);
}
@@ -200,8 +153,6 @@ public class Groups extends AbstractGroups {
private static final long serialVersionUID = -4541954630939063927L;
- protected List<String> dynMemberships;
-
/**
* Retrieve the first MAX_GROUP_LIST_SIZE assignable.
*/
@@ -250,34 +201,5 @@ public class Groups extends AbstractGroups {
memberships = GroupableRelatableTO.class.cast(anyTO).getMemberships();
memberships.sort(Comparator.comparing(MembershipTO::getGroupName));
}
-
- protected void reloadDynMemberships() {
- GroupFiqlSearchConditionBuilder builder = SyncopeClient.getGroupSearchConditionBuilder();
-
- List<CompleteCondition> conditions = GroupableRelatableTO.class.cast(anyTO).getDynMemberships().
- stream().map(membership -> builder.is(Constants.KEY_FIELD_NAME).
- equalTo(membership.getGroupKey()).wrap()).toList();
-
- if (SyncopeConsoleSession.get().owns(IdRepoEntitlement.GROUP_SEARCH) && !conditions.isEmpty()) {
- dynMemberships = groupRestClient.search(
- SyncopeConstants.ROOT_REALM,
- builder.or(conditions).query(),
- 1,
- Constants.MAX_GROUP_LIST_SIZE,
- new SortParam<>(Constants.NAME_FIELD_NAME, true)).
- stream().map(GroupTO::getName).toList();
- } else {
- dynMemberships = GroupableRelatableTO.class.cast(anyTO).getDynMemberships().
- stream().map(MembershipTO::getGroupName).toList();
- }
- }
-
- @Override
- public List<String> getDynMemberships() {
- if (dynMemberships == null) {
- reloadDynMemberships();
- }
- return dynMemberships;
- }
}
}
diff --git a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/wizards/any/Ownership.java b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/wizards/any/Management.java
similarity index 73%
rename from client/idrepo/console/src/main/java/org/apache/syncope/client/console/wizards/any/Ownership.java
rename to client/idrepo/console/src/main/java/org/apache/syncope/client/console/wizards/any/Management.java
index 2d9a8683a5..cb204dd815 100644
--- a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/wizards/any/Ownership.java
+++ b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/wizards/any/Management.java
@@ -40,6 +40,7 @@ import org.apache.syncope.client.lib.SyncopeClient;
import org.apache.syncope.client.ui.commons.Constants;
import org.apache.syncope.client.ui.commons.ajax.form.IndicatorAjaxFormComponentUpdatingBehavior;
import org.apache.syncope.client.ui.commons.markup.html.form.AjaxTextFieldPanel;
+import org.apache.syncope.client.ui.commons.wizards.any.AnyWrapper;
import org.apache.syncope.common.lib.to.AnyTO;
import org.apache.syncope.common.lib.to.AnyTypeTO;
import org.apache.syncope.common.lib.to.GroupTO;
@@ -66,7 +67,7 @@ import org.apache.wicket.model.ResourceModel;
import org.apache.wicket.model.util.ListModel;
import org.apache.wicket.spring.injection.annot.SpringBean;
-public class Ownership extends WizardStep implements ICondition {
+public class Management extends WizardStep implements ICondition {
private static final long serialVersionUID = 855618618337931784L;
@@ -82,11 +83,11 @@ public class Ownership extends WizardStep implements ICondition {
@SpringBean
private GroupRestClient groupRestClient;
- private final Pattern owner = Pattern.compile("\\[\\(\\d+\\)\\] .*");
+ private final Pattern manager = Pattern.compile("\\[\\(\\d+\\)\\] .*");
- private final GroupWrapper wrapper;
+ private final AnyWrapper<? extends AnyTO> wrapper;
- private final WebMarkupContainer ownerContainer;
+ private final WebMarkupContainer managerContainer;
private final GroupSearchPanel groupSearchPanel;
@@ -100,9 +101,9 @@ public class Ownership extends WizardStep implements ICondition {
private final UserSelectionDirectoryPanel userDirectoryPanel;
- private final Model<Boolean> isGroupOwnership;
+ private final Model<Boolean> isGManager;
- public Ownership(final GroupWrapper groupWrapper, final PageReference pageRef) {
+ public Management(final AnyWrapper<? extends AnyTO> anyWrapper, final PageReference pageRef) {
super();
// -----------------------------------------------------------------
@@ -113,23 +114,23 @@ public class Ownership extends WizardStep implements ICondition {
permissions.authorize(RENDER, new Roles(IdRepoEntitlement.USER_SEARCH));
// -----------------------------------------------------------------
- setTitleModel(new ResourceModel("group.ownership"));
- this.wrapper = groupWrapper;
+ setTitleModel(new ResourceModel("manager"));
+ this.wrapper = anyWrapper;
- isGroupOwnership = Model.of(groupWrapper.getInnerObject().getGroupOwner() != null);
+ isGManager = Model.of(anyWrapper.getInnerObject().getGManager() != null);
BootstrapToggleConfig config = new BootstrapToggleConfig().
withOnStyle(BootstrapToggleConfig.Style.info).
withOffStyle(BootstrapToggleConfig.Style.warning).
withSize(BootstrapToggleConfig.Size.mini);
- add(new BootstrapToggle("ownership", new Model<>() {
+ add(new BootstrapToggle("management", new Model<>() {
private static final long serialVersionUID = 6062041315055645807L;
@Override
public Boolean getObject() {
- return isGroupOwnership.getObject();
+ return isGManager.getObject();
}
}, config) {
@@ -137,12 +138,12 @@ public class Ownership extends WizardStep implements ICondition {
@Override
protected IModel<String> getOffLabel() {
- return Model.of("USER Owner");
+ return Model.of(AnyTypeKind.USER.name());
}
@Override
protected IModel<String> getOnLabel() {
- return Model.of("GROUP Owner");
+ return Model.of(AnyTypeKind.GROUP.name());
}
@Override
@@ -154,28 +155,28 @@ public class Ownership extends WizardStep implements ICondition {
@Override
protected void onUpdate(final AjaxRequestTarget target) {
- isGroupOwnership.setObject(!isGroupOwnership.getObject());
- if (isGroupOwnership.getObject()) {
- ownerContainer.addOrReplace(groupSearchFragment);
+ isGManager.setObject(!isGManager.getObject());
+ if (isGManager.getObject()) {
+ managerContainer.addOrReplace(groupSearchFragment);
groupDirectoryPanel.search(null, target);
} else {
- ownerContainer.addOrReplace(userSearchFragment);
+ managerContainer.addOrReplace(userSearchFragment);
userDirectoryPanel.search(null, target);
}
- target.add(ownerContainer);
+ target.add(managerContainer);
}
});
return checkBox;
}
});
- ownerContainer = new WebMarkupContainer("ownerContainer");
- ownerContainer.setOutputMarkupId(true);
- add(ownerContainer);
+ managerContainer = new WebMarkupContainer("managerContainer");
+ managerContainer.setOutputMarkupId(true);
+ add(managerContainer);
groupSearchFragment = new Fragment("search", "groupSearchFragment", this);
groupSearchPanel = new GroupSearchPanel.Builder(
- new ListModel<>(new ArrayList<>()), pageRef).required(false).enableSearch(Ownership.this).
+ new ListModel<>(new ArrayList<>()), pageRef).required(false).enableSearch(Management.this).
build("groupsearch");
groupSearchFragment.add(groupSearchPanel.setRenderBodyOnly(true));
@@ -189,7 +190,7 @@ public class Ownership extends WizardStep implements ICondition {
userSearchFragment = new Fragment("search", "userSearchFragment", this);
userSearchPanel = UserSearchPanel.class.cast(new UserSearchPanel.Builder(
- new ListModel<>(new ArrayList<>()), pageRef).required(false).enableSearch(Ownership.this).
+ new ListModel<>(new ArrayList<>()), pageRef).required(false).enableSearch(Management.this).
build("usersearch"));
userSearchFragment.add(userSearchPanel.setRenderBodyOnly(true));
@@ -199,24 +200,24 @@ public class Ownership extends WizardStep implements ICondition {
build("searchResult"));
userSearchFragment.add(userDirectoryPanel);
- if (isGroupOwnership.getObject()) {
- ownerContainer.add(groupSearchFragment);
+ if (isGManager.getObject()) {
+ managerContainer.add(groupSearchFragment);
} else {
- ownerContainer.add(userSearchFragment);
+ managerContainer.add(userSearchFragment);
}
- AjaxTextFieldPanel userOwner = new AjaxTextFieldPanel(
- "userOwner", "userOwner", new PropertyModel<>(groupWrapper.getInnerObject(), "userOwner") {
+ AjaxTextFieldPanel uManager = new AjaxTextFieldPanel(
+ "uManager", "uManager", new PropertyModel<>(anyWrapper.getInnerObject(), "uManager") {
private static final long serialVersionUID = -3743432456095828573L;
@Override
public String getObject() {
- if (groupWrapper.getInnerObject().getUserOwner() == null) {
+ if (anyWrapper.getInnerObject().getUManager() == null) {
return StringUtils.EMPTY;
}
- UserTO userTO = userRestClient.read(groupWrapper.getInnerObject().getUserOwner());
+ UserTO userTO = userRestClient.read(anyWrapper.getInnerObject().getUManager());
if (userTO == null) {
return StringUtils.EMPTY;
}
@@ -227,27 +228,27 @@ public class Ownership extends WizardStep implements ICondition {
@Override
public void setObject(final String object) {
if (StringUtils.isBlank(object)) {
- groupWrapper.getInnerObject().setUserOwner(null);
+ anyWrapper.getInnerObject().setUManager(null);
} else {
- Matcher matcher = owner.matcher(object);
+ Matcher matcher = manager.matcher(object);
if (matcher.matches()) {
- groupWrapper.getInnerObject().setUserOwner(matcher.group(1));
+ anyWrapper.getInnerObject().setUManager(matcher.group(1));
}
}
}
}, false);
- userOwner.setPlaceholder("userOwner");
- userOwner.hideLabel();
- userOwner.setReadOnly(true).setOutputMarkupId(true);
- userSearchFragment.add(userOwner);
+ uManager.setPlaceholder("uManager");
+ uManager.hideLabel();
+ uManager.setReadOnly(true).setOutputMarkupId(true);
+ userSearchFragment.add(uManager);
- IndicatingAjaxLink<Void> userOwnerReset = new IndicatingAjaxLink<>("userOwnerReset") {
+ IndicatingAjaxLink<Void> uManagerReset = new IndicatingAjaxLink<>("uManagerReset") {
private static final long serialVersionUID = -7978723352517770644L;
@Override
public void onClick(final AjaxRequestTarget target) {
- send(Ownership.this, Broadcast.EXACT, new GroupSelectionDirectoryPanel.ItemSelection<>(target, null));
+ send(Management.this, Broadcast.EXACT, new GroupSelectionDirectoryPanel.ItemSelection<>(target, null));
}
@Override
@@ -256,19 +257,19 @@ public class Ownership extends WizardStep implements ICondition {
}
};
- userSearchFragment.add(userOwnerReset);
+ userSearchFragment.add(uManagerReset);
- AjaxTextFieldPanel groupOwner = new AjaxTextFieldPanel(
- "groupOwner", "groupOwner", new PropertyModel<>(groupWrapper.getInnerObject(), "groupOwner") {
+ AjaxTextFieldPanel gManager = new AjaxTextFieldPanel(
+ "gManager", "gManager", new PropertyModel<>(anyWrapper.getInnerObject(), "gManager") {
private static final long serialVersionUID = -3743432456095828573L;
@Override
public String getObject() {
- if (groupWrapper.getInnerObject().getGroupOwner() == null) {
+ if (anyWrapper.getInnerObject().getGManager() == null) {
return StringUtils.EMPTY;
} else {
- GroupTO groupTO = groupRestClient.read(groupWrapper.getInnerObject().getGroupOwner());
+ GroupTO groupTO = groupRestClient.read(anyWrapper.getInnerObject().getGManager());
if (groupTO == null) {
return StringUtils.EMPTY;
} else {
@@ -280,27 +281,27 @@ public class Ownership extends WizardStep implements ICondition {
@Override
public void setObject(final String object) {
if (StringUtils.isBlank(object)) {
- groupWrapper.getInnerObject().setGroupOwner(null);
+ anyWrapper.getInnerObject().setGManager(null);
} else {
- final Matcher matcher = owner.matcher(object);
+ final Matcher matcher = manager.matcher(object);
if (matcher.matches()) {
- groupWrapper.getInnerObject().setGroupOwner(matcher.group(1));
+ anyWrapper.getInnerObject().setGManager(matcher.group(1));
}
}
}
}, false);
- groupOwner.setPlaceholder("groupOwner");
- groupOwner.hideLabel();
- groupOwner.setReadOnly(true).setOutputMarkupId(true);
- groupSearchFragment.add(groupOwner);
+ gManager.setPlaceholder("gManager");
+ gManager.hideLabel();
+ gManager.setReadOnly(true).setOutputMarkupId(true);
+ groupSearchFragment.add(gManager);
- IndicatingAjaxLink<Void> groupOwnerReset = new IndicatingAjaxLink<>("groupOwnerReset") {
+ IndicatingAjaxLink<Void> gManagerReset = new IndicatingAjaxLink<>("gManagerReset") {
private static final long serialVersionUID = -7978723352517770644L;
@Override
public void onClick(final AjaxRequestTarget target) {
- send(Ownership.this, Broadcast.EXACT, new GroupSelectionDirectoryPanel.ItemSelection<>(target, null));
+ send(Management.this, Broadcast.EXACT, new GroupSelectionDirectoryPanel.ItemSelection<>(target, null));
}
@Override
@@ -309,14 +310,14 @@ public class Ownership extends WizardStep implements ICondition {
}
};
- groupSearchFragment.add(groupOwnerReset);
+ groupSearchFragment.add(gManagerReset);
}
@Override
public void onEvent(final IEvent<?> event) {
if (event.getPayload() instanceof SearchClausePanel.SearchEvent payload) {
AjaxRequestTarget target = payload.getTarget();
- if (Ownership.this.isGroupOwnership.getObject()) {
+ if (Management.this.isGManager.getObject()) {
String fiql = SearchUtils.buildFIQL(
groupSearchPanel.getModel().getObject(), SyncopeClient.getGroupSearchConditionBuilder());
groupDirectoryPanel.search(fiql, target);
@@ -328,16 +329,16 @@ public class Ownership extends WizardStep implements ICondition {
} else if (event.getPayload() instanceof final AnySelectionDirectoryPanel.ItemSelection<?> itemSelection) {
AnyTO sel = itemSelection.getSelection();
if (sel == null) {
- wrapper.getInnerObject().setUserOwner(null);
- wrapper.getInnerObject().setGroupOwner(null);
+ wrapper.getInnerObject().setUManager(null);
+ wrapper.getInnerObject().setGManager(null);
} else if (sel instanceof UserTO) {
- wrapper.getInnerObject().setUserOwner(sel.getKey());
- wrapper.getInnerObject().setGroupOwner(null);
+ wrapper.getInnerObject().setUManager(sel.getKey());
+ wrapper.getInnerObject().setGManager(null);
} else if (sel instanceof GroupTO) {
- wrapper.getInnerObject().setGroupOwner(sel.getKey());
- wrapper.getInnerObject().setUserOwner(null);
+ wrapper.getInnerObject().setUManager(null);
+ wrapper.getInnerObject().setGManager(sel.getKey());
}
- itemSelection.getTarget().add(ownerContainer);
+ itemSelection.getTarget().add(managerContainer);
} else {
super.onEvent(event);
}
diff --git a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/wizards/role/RoleWizardBuilder.java b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/wizards/role/RoleWizardBuilder.java
index ab836e14be..d0b1eaf89c 100644
--- a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/wizards/role/RoleWizardBuilder.java
+++ b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/wizards/role/RoleWizardBuilder.java
@@ -22,12 +22,9 @@ import java.io.Serializable;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
-import java.util.stream.Collectors;
import org.apache.commons.lang3.StringUtils;
import org.apache.syncope.client.console.SyncopeWebApplication;
import org.apache.syncope.client.console.commons.RealmsUtils;
-import org.apache.syncope.client.console.panels.search.UserSearchPanel;
-import org.apache.syncope.client.console.rest.DynRealmRestClient;
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.AjaxSearchFieldPanel;
@@ -38,17 +35,13 @@ import org.apache.syncope.client.ui.commons.markup.html.form.AjaxPalettePanel;
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.client.ui.commons.markup.html.form.MultiFieldPanel;
-import org.apache.syncope.client.ui.commons.wicket.markup.html.bootstrap.tabs.Accordion;
import org.apache.syncope.client.ui.commons.wizards.AjaxWizardBuilder;
-import org.apache.syncope.common.lib.to.DynRealmTO;
import org.apache.syncope.common.lib.to.RealmTO;
import org.apache.syncope.common.lib.to.RoleTO;
import org.apache.wicket.PageReference;
import org.apache.wicket.extensions.ajax.markup.html.autocomplete.AutoCompleteSettings;
-import org.apache.wicket.extensions.markup.html.tabs.AbstractTab;
import org.apache.wicket.extensions.wizard.WizardModel;
import org.apache.wicket.extensions.wizard.WizardStep;
-import org.apache.wicket.markup.html.panel.Panel;
import org.apache.wicket.model.Model;
import org.apache.wicket.model.PropertyModel;
import org.apache.wicket.model.ResourceModel;
@@ -62,20 +55,16 @@ public class RoleWizardBuilder extends BaseAjaxWizardBuilder<RoleWrapper> {
protected final RealmRestClient realmRestClient;
- protected final DynRealmRestClient dynRealmRestClient;
-
public RoleWizardBuilder(
final RoleTO roleTO,
final RoleRestClient roleRestClient,
final RealmRestClient realmRestClient,
- final DynRealmRestClient dynRealmRestClient,
final PageReference pageRef) {
super(new RoleWrapper(roleTO), pageRef);
this.roleRestClient = roleRestClient;
this.realmRestClient = realmRestClient;
- this.dynRealmRestClient = dynRealmRestClient;
}
/**
@@ -94,7 +83,6 @@ public class RoleWizardBuilder extends BaseAjaxWizardBuilder<RoleWrapper> {
@Override
protected Serializable onApplyInternal(final RoleWrapper modelObject) {
- modelObject.fillDynamicConditions();
if (getOriginalItem() == null || getOriginalItem().getInnerObject() == null
|| StringUtils.isBlank(getOriginalItem().getInnerObject().getKey())) {
roleRestClient.create(modelObject.getInnerObject());
@@ -109,7 +97,6 @@ public class RoleWizardBuilder extends BaseAjaxWizardBuilder<RoleWrapper> {
wizardModel.add(new Details(modelObject));
wizardModel.add(new Entitlements(modelObject.getInnerObject()));
wizardModel.add(new Realms(modelObject.getInnerObject()));
- wizardModel.add(new DynRealms(modelObject.getInnerObject()));
return wizardModel;
}
@@ -123,23 +110,6 @@ public class RoleWizardBuilder extends BaseAjaxWizardBuilder<RoleWrapper> {
Constants.KEY_FIELD_NAME,
new PropertyModel<>(modelObject.getInnerObject(), Constants.KEY_FIELD_NAME), false).
setEnabled(StringUtils.isEmpty(modelObject.getInnerObject().getKey())));
-
- // ------------------------
- // dynMembershipCond
- // ------------------------
- add(new Accordion("dynMembershipCond", List.of(
- new AbstractTab(new ResourceModel("dynMembershipCond", "Dynamic USER Membership Conditions")) {
-
- private static final long serialVersionUID = 1037272333056449378L;
-
- @Override
- public Panel getPanel(final String panelId) {
- return new UserSearchPanel.Builder(
- new PropertyModel<>(modelObject, "dynClauses"), pageRef).
- required(true).build(panelId);
- }
- }), Model.of(StringUtils.isBlank(modelObject.getDynMembershipCond()) ? -1 : 0)).setOutputMarkupId(true));
- // ------------------------
}
}
@@ -201,18 +171,4 @@ public class RoleWizardBuilder extends BaseAjaxWizardBuilder<RoleWrapper> {
(FieldPanel) realm).hideLabel());
}
}
-
- protected class DynRealms extends WizardStep {
-
- private static final long serialVersionUID = 6846234574424462255L;
-
- public DynRealms(final RoleTO modelObject) {
- setTitleModel(new ResourceModel("dynRealms"));
- add(new AjaxPalettePanel.Builder<>().build("dynRealms",
- new PropertyModel<>(modelObject, "dynRealms"),
- new ListModel<>(dynRealmRestClient.list().stream().
- map(DynRealmTO::getKey).collect(Collectors.toList()))).
- hideLabel().setOutputMarkupId(true));
- }
- }
}
diff --git a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/wizards/role/RoleWrapper.java b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/wizards/role/RoleWrapper.java
index 03ba628f51..18043c2897 100644
--- a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/wizards/role/RoleWrapper.java
+++ b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/wizards/role/RoleWrapper.java
@@ -18,11 +18,6 @@
*/
package org.apache.syncope.client.console.wizards.role;
-import java.util.List;
-import org.apache.commons.collections4.CollectionUtils;
-import org.apache.syncope.client.console.panels.search.SearchClause;
-import org.apache.syncope.client.console.panels.search.SearchUtils;
-import org.apache.syncope.client.lib.SyncopeClient;
import org.apache.syncope.client.ui.commons.wizards.any.EntityWrapper;
import org.apache.syncope.common.lib.to.RoleTO;
@@ -30,34 +25,7 @@ public class RoleWrapper extends EntityWrapper<RoleTO> {
private static final long serialVersionUID = 8058288034211558376L;
- private List<SearchClause> dynClauses;
-
public RoleWrapper(final RoleTO roleTO) {
super(roleTO);
- getDynClauses();
- }
-
- public final List<SearchClause> getDynClauses() {
- if (this.dynClauses == null) {
- this.dynClauses = SearchUtils.getSearchClauses(getInnerObject().getDynMembershipCond());
- }
- return this.dynClauses;
- }
-
- public void setDynClauses(final List<SearchClause> dynClauses) {
- this.dynClauses = dynClauses;
- }
-
- public String getDynMembershipCond() {
- if (CollectionUtils.isEmpty(this.dynClauses)) {
- return null;
- }
-
- return SearchUtils.buildFIQL(this.dynClauses, SyncopeClient.getUserSearchConditionBuilder());
- }
-
- public RoleTO fillDynamicConditions() {
- getInnerObject().setDynMembershipCond(this.getDynMembershipCond());
- return getInnerObject();
}
}
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 7aaf70ef35..24bff63fa0 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
@@ -19,7 +19,5 @@ any.realm.edit=Edit Realm ${fullPath}
inner.template.edit=Edit ${left} template for '${right.fullPath}'
afterObj=Object Link
realmLabel=Realm
-dynRealmLabel=Dynamic Realm
realms=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/Realms_fr_CA.properties
index 9a980e0093..0e35e8e7d4 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
@@ -19,7 +19,5 @@ any.realm.edit=Modifier domaine ${fullPath}
inner.template.edit=Modifier mod\u00e8le ${gauche} pour '${right.fullPath}''.
afterObj=Lien d'objet
realmLabel=Domaine
-dynRealmLabel=Domaine dynamique
realms=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/Realms_it.properties
index 135fd9aafc..c2a8049303 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
@@ -19,7 +19,5 @@ any.realm.edit=Edit Realm ${fullPath}
inner.template.edit=Modifica ${left} template per '${right.fullPath}'
afterObj=Object Link
realmLabel=Realm
-dynRealmLabel=Realm Dinamico
realms=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_ja.properties b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/pages/Realms_ja.properties
index 1c31ef35b2..d964e2a582 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
@@ -19,7 +19,5 @@ 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
-dynRealmLabel=\u52d5\u7684\u30ec\u30eb\u30e0
realms=\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/Realms_pt_BR.properties
index 7aaf70ef35..24bff63fa0 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
@@ -19,7 +19,5 @@ any.realm.edit=Edit Realm ${fullPath}
inner.template.edit=Edit ${left} template for '${right.fullPath}'
afterObj=Object Link
realmLabel=Realm
-dynRealmLabel=Dynamic Realm
realms=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_ru.properties b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/pages/Realms_ru.properties
index 66a1ce9c90..40e66a065b 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
@@ -20,7 +20,5 @@ any.realm.edit=\u0418\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u043e\u0431\u04
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
-dynRealmLabel=Dynamic Realm
realms=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/Security.properties b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/pages/Security.properties
index 8eaf418477..e1b35a5075 100644
--- a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/pages/Security.properties
+++ b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/pages/Security.properties
@@ -15,7 +15,6 @@
# specific language governing permissions and limitations
# under the License.
add=Create new Role
-dynRealms=Dynamic Realms
applications=Applications
securityQuestions=Security Questions
delegations=Delegations
diff --git a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/pages/Security_fr_CA.properties b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/pages/Security_fr_CA.properties
index 230dcb074a..17d296ba89 100644
--- a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/pages/Security_fr_CA.properties
+++ b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/pages/Security_fr_CA.properties
@@ -15,7 +15,6 @@
# specific language governing permissions and limitations
# under the License.
add=Cr\u00e9er nouveau r\u00f4le
-dynRealms=Domaines dynamiques
applications=Applications
securityQuestions=Questions de s\u00e9curit\u00e9
delegations=Delegations
diff --git a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/pages/Security_it.properties b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/pages/Security_it.properties
index f4e34b09e9..ad806d7d68 100644
--- a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/pages/Security_it.properties
+++ b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/pages/Security_it.properties
@@ -15,7 +15,6 @@
# specific language governing permissions and limitations
# under the License.
add=Crea un nuovo Ruolo
-dynRealms=Realm dinamici
applications=Applicazioni
securityQuestions=Domande di sicurezza
delegations=Deleghe
diff --git a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/pages/Security_ja.properties b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/pages/Security_ja.properties
index bb80dfbbde..94e4ad2ea2 100644
--- a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/pages/Security_ja.properties
+++ b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/pages/Security_ja.properties
@@ -15,7 +15,6 @@
# specific language governing permissions and limitations
# under the License.
add=\u65b0\u3057\u3044\u30ed\u30fc\u30eb\u3092\u8ffd\u52a0
-dynRealms=\u52d5\u7684\u30ec\u30eb\u30e0
applications=\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3
securityQuestions=\u79d8\u5bc6\u306e\u8cea\u554f
delegations=Delegations
diff --git a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/pages/Security_pt_BR.properties b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/pages/Security_pt_BR.properties
index 77c61d5355..32f7b90b7d 100644
--- a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/pages/Security_pt_BR.properties
+++ b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/pages/Security_pt_BR.properties
@@ -15,7 +15,6 @@
# specific language governing permissions and limitations
# under the License.
add=Cria um novo fun\u00e7\u00e3o
-dynRealms=Realm din\u00e2micos
applications=Applications
securityQuestions=Perguntas de seguran\u00e7a
delegations=Delegations
diff --git a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/pages/Security_ru.properties b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/pages/Security_ru.properties
index 992964f124..26bfca357e 100644
--- a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/pages/Security_ru.properties
+++ b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/pages/Security_ru.properties
@@ -16,7 +16,6 @@
# under the License.
#
add=\u0421\u043e\u0437\u0434\u0430\u0442\u044c \u0440\u043e\u043b\u044c
-dynRealms=Dynamic Realms
applications=Applications
securityQuestions=\u041a\u043e\u043d\u0442\u0440\u043e\u043b\u044c\u043d\u044b\u0435 \u0432\u043e\u043f\u0440\u043e\u0441\u044b
delegations=Delegations
diff --git a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/DynRealmDirectoryPanel.properties b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/DynRealmDirectoryPanel.properties
deleted file mode 100644
index 13fdcf958b..0000000000
--- a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/DynRealmDirectoryPanel.properties
+++ /dev/null
@@ -1,18 +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.
-any.edit=Edit ${key}
-any.new=New Dynamic Realm
diff --git a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/DynRealmDirectoryPanel_fr_CA.properties b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/DynRealmDirectoryPanel_fr_CA.properties
deleted file mode 100644
index d12847945b..0000000000
--- a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/DynRealmDirectoryPanel_fr_CA.properties
+++ /dev/null
@@ -1,18 +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.
-any.edit=Modifier ${key}
-any.new=Nouveau domaine dynamique
diff --git a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/DynRealmDirectoryPanel_it.properties b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/DynRealmDirectoryPanel_it.properties
deleted file mode 100644
index 3edddc9ac8..0000000000
--- a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/DynRealmDirectoryPanel_it.properties
+++ /dev/null
@@ -1,18 +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.
-any.edit=Modifica ${key}
-any.new=Nuovo Realm dinamico
diff --git a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/DynRealmDirectoryPanel_ja.properties b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/DynRealmDirectoryPanel_ja.properties
deleted file mode 100644
index 9b6e62a978..0000000000
--- a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/DynRealmDirectoryPanel_ja.properties
+++ /dev/null
@@ -1,18 +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.
-any.edit=${key} \u3092\u7de8\u96c6
-any.new=\u65b0\u3057\u3044\u52d5\u7684\u30ec\u30eb\u30e0
diff --git a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/DynRealmDirectoryPanel_pt_BR.properties b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/DynRealmDirectoryPanel_pt_BR.properties
deleted file mode 100644
index 4df146d3f0..0000000000
--- a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/DynRealmDirectoryPanel_pt_BR.properties
+++ /dev/null
@@ -1,18 +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.
-any.edit=Alterar ${key}
-any.new=Novo Realm din\u00e2mico
diff --git a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/DynRealmDirectoryPanel_ru.properties b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/DynRealmDirectoryPanel_ru.properties
deleted file mode 100644
index 90d72ba582..0000000000
--- a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/DynRealmDirectoryPanel_ru.properties
+++ /dev/null
@@ -1,19 +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.
-#
-any.edit=\u0418\u0437\u043c\u0435\u043d\u0438\u0442\u044c ${key}
-any.new=\u0421\u043e\u0437\u0434\u0430\u0442\u044c Dynamic Realm
diff --git a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/DynRealmModalPanel.html b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/DynRealmModalPanel.html
deleted file mode 100644
index 9f8fa4c66d..0000000000
--- a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/DynRealmModalPanel.html
+++ /dev/null
@@ -1,28 +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.
--->
-<html xmlns="http://www.w3.org/1999/xhtml" xmlns:wicket="http://wicket.apache.org">
- <wicket:extend>
- <div class="form-group">
- <span wicket:id="key"/>
- <span wicket:id="dynMembershipCond">
- <div wicket:id="dynMembershipCond"/>
- </span>
- </div>
- </wicket:extend>
-</html>
diff --git a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/wizards/any/DynamicMemberships.html b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/wizards/any/DynamicMemberships.html
deleted file mode 100644
index 9e6f5f9bdd..0000000000
--- a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/wizards/any/DynamicMemberships.html
+++ /dev/null
@@ -1,26 +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.
--->
-<html xmlns="http://www.w3.org/1999/xhtml" xmlns:wicket="http://wicket.apache.org">
- <wicket:panel>
- <div wicket:id="uDynMembershipCond" />
- <span wicket:id="aDynMembershipCond">
- <div wicket:id="aDynMembershipCond"/>
- </span>
- </wicket:panel>
-</html>
diff --git a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/wizards/any/DynamicMemberships.properties b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/wizards/any/DynamicMemberships.properties
deleted file mode 100644
index e40b2c6d41..0000000000
--- a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/wizards/any/DynamicMemberships.properties
+++ /dev/null
@@ -1,20 +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.
-uDynMembershipCond=Dynamic USER assignment
-aDynMembershipCond=Dynamic ${key} assignment
-On=AND
-Off=OR
diff --git a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/wizards/any/DynamicMemberships_fr_CA.properties b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/wizards/any/DynamicMemberships_fr_CA.properties
deleted file mode 100644
index 473269e66e..0000000000
--- a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/wizards/any/DynamicMemberships_fr_CA.properties
+++ /dev/null
@@ -1,20 +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.
-uDynMembershipCond=Affectation dynamique de l'UTILISATEUR
-aDynMembershipCond=Affectation dynamique de ${key}
-On=ET
-Off=OU
diff --git a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/wizards/any/DynamicMemberships_it.properties b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/wizards/any/DynamicMemberships_it.properties
deleted file mode 100644
index 3c92bdce37..0000000000
--- a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/wizards/any/DynamicMemberships_it.properties
+++ /dev/null
@@ -1,20 +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.
-On=AND
-Off=OR
-uDynMembershipCond=Assegnamento dinamico USER
-aDynMembershipCond=Assegnamento dinamico ${key}
diff --git a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/wizards/any/DynamicMemberships_ja.properties b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/wizards/any/DynamicMemberships_ja.properties
deleted file mode 100644
index dcc6113d7f..0000000000
--- a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/wizards/any/DynamicMemberships_ja.properties
+++ /dev/null
@@ -1,20 +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.
-uDynMembershipCond=\u52d5\u7684 \u30e6\u30fc\u30b6\u30fc \u5272\u308a\u5f53\u3066
-aDynMembershipCond=\u52d5\u7684 ${key} \u5272\u308a\u5f53\u3066
-On=\u304b\u3064
-Off=\u307e\u305f\u306f
diff --git a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/wizards/any/DynamicMemberships_pt_BR.properties b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/wizards/any/DynamicMemberships_pt_BR.properties
deleted file mode 100644
index a07746b05b..0000000000
--- a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/wizards/any/DynamicMemberships_pt_BR.properties
+++ /dev/null
@@ -1,20 +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.
-On=AND
-Off=OR
-uDynMembershipCond=Dynamic USER assignment
-aDynMembershipCond=Dynamic ${key} assignment
diff --git a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/wizards/any/DynamicMemberships_ru.properties b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/wizards/any/DynamicMemberships_ru.properties
deleted file mode 100644
index 9f8c79ac9b..0000000000
--- a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/wizards/any/DynamicMemberships_ru.properties
+++ /dev/null
@@ -1,25 +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.
-#
-# uDynMembershipCond=Динамическое назначение ПОЛЬЗОВАТЕЛЕЙ
-uDynMembershipCond=\u0414\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u041f\u041e\u041b\u042c\u0417\u041e\u0412\u0410\u0422\u0415\u041b\u0415\u0419
-# aDynMembershipCond=Динамическое назначение ${key}
-aDynMembershipCond=\u0414\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 ${key}
-# On=И
-On=\u0418
-# Off=Или
-Off=\u0418\u043b\u0438
diff --git a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/wizards/any/Groups.html b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/wizards/any/Groups.html
index ba33830b68..0b1c84ff09 100644
--- a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/wizards/any/Groups.html
+++ b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/wizards/any/Groups.html
@@ -29,29 +29,5 @@ under the License.
<span wicket:id="groups"/>
</div>
</div>
-
- <div class="col-xs-12" wicket:id="dyngroupsContainer">
- <div class="card-header">
- <h3 class="card-title">
- <wicket:message key="dyngroups.palette">[DYNAMIC GROUPS]</wicket:message>
- </h3>
- </div>
- <div class="card-body">
- <span wicket:id="dyngroups">[DYNAMIC GROUPS]</span>
- </div>
- </div>
-
- <div class="col-xs-12" wicket:id="dynrealmsContainer">
- <div class="col-xs-12">
- <div class="card-header">
- <h3 class="card-title">
- <wicket:message key="dynrealms.palette">[DYNAMIC REALMS]</wicket:message>
- </h3>
- </div>
- <div class="card-body">
- <span wicket:id="dynrealms">[DYNAMIC GROUPS]</span>
- </div>
- </div>
- </div>
</wicket:panel>
</html>
\ No newline at end of file
diff --git a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/wizards/any/Groups.properties b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/wizards/any/Groups.properties
index fe2a381612..b5e8dcfcfc 100644
--- a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/wizards/any/Groups.properties
+++ b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/wizards/any/Groups.properties
@@ -15,6 +15,4 @@
# specific language governing permissions and limitations
# under the License.
groups.palette=Groups
-dyngroups.palette=Dynamic groups
palette.available=Available (limited to the first 30 results)
-dynrealms.palette=Dynamic Realms
diff --git a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/wizards/any/Groups_fr_CA.properties b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/wizards/any/Groups_fr_CA.properties
index ba80300555..e4667fe827 100644
--- a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/wizards/any/Groups_fr_CA.properties
+++ b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/wizards/any/Groups_fr_CA.properties
@@ -15,6 +15,4 @@
# specific language governing permissions and limitations
# under the License.
groups.palette=Groupes
-dyngroups.palette=Groupes dynamiques
-palette.available=Disponible (limit� aux 30 premiers r�sultats)
-dynrealms.palette=Domaines dynamiques
+palette.available=Disponible (limit\u00e9 aux 30 premiers r\u00e9sultats)
diff --git a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/wizards/any/Groups_it.properties b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/wizards/any/Groups_it.properties
index 5c23108e95..f3b538f470 100644
--- a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/wizards/any/Groups_it.properties
+++ b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/wizards/any/Groups_it.properties
@@ -15,6 +15,4 @@
# specific language governing permissions and limitations
# under the License.
groups.palette=Gruppi
-dyngroups.palette=Gruppi dinamici
palette.available=Disponibili (limitato ai primi 30 risultati)
-dynrealms.palette=Realms dinamici
diff --git a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/wizards/any/Groups_ja.properties b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/wizards/any/Groups_ja.properties
index 08e6840e84..16b32cc3be 100644
--- a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/wizards/any/Groups_ja.properties
+++ b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/wizards/any/Groups_ja.properties
@@ -15,6 +15,4 @@
# specific language governing permissions and limitations
# under the License.
groups.palette=\u30b0\u30eb\u30fc\u30d7
-dyngroups.palette=\u52d5\u7684\u30b0\u30eb\u30fc\u30d7
palette.available=\u5229\u7528\u53ef\u80fd (\u6700\u521d\u306e 30 \u306e\u7d50\u679c\u306b\u9650\u5b9a)
-dynrealms.palette=\u52d5\u7684\u30ec\u30eb\u30e0
diff --git a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/wizards/any/Groups_pt_BR.properties b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/wizards/any/Groups_pt_BR.properties
index 2a231b4dfb..c3022b5abe 100644
--- a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/wizards/any/Groups_pt_BR.properties
+++ b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/wizards/any/Groups_pt_BR.properties
@@ -15,6 +15,4 @@
# specific language governing permissions and limitations
# under the License.
groups.palette=Grupos
-dyngroups.palette=Grupos din\u00e2micos
palette.available=Available (limited to the first 30 results)
-dynrealms.palette=Realms din\u00e2micos
diff --git a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/wizards/any/Groups_ru.properties b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/wizards/any/Groups_ru.properties
index 43c912ff88..72a0042ec6 100644
--- a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/wizards/any/Groups_ru.properties
+++ b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/wizards/any/Groups_ru.properties
@@ -16,6 +16,4 @@
# under the License.
#
groups.palette=\u0413\u0440\u0443\u043f\u043f\u044b
-dyngroups.palette=\u0414\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0433\u0440\u0443\u043f\u043f\u044b
palette.available=Available (limited to the first 30 results)
-dynrealms.palette=Dynamic Realms
diff --git a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/wizards/any/Ownership.html b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/wizards/any/Management.html
similarity index 79%
rename from client/idrepo/console/src/main/resources/org/apache/syncope/client/console/wizards/any/Ownership.html
rename to client/idrepo/console/src/main/resources/org/apache/syncope/client/console/wizards/any/Management.html
index 2ea785a1c2..07bbc0109c 100644
--- a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/wizards/any/Ownership.html
+++ b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/wizards/any/Management.html
@@ -19,18 +19,18 @@ under the License.
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:wicket="http://wicket.apache.org">
<wicket:panel>
<div id="ownership">
- <span wicket:id="ownership">[OWNERSHIP]</span>
+ <span wicket:id="management">[OWNERSHIP]</span>
</div>
- <div wicket:id="ownerContainer">
+ <div wicket:id="managerContainer">
<span wicket:id="search">[SEARCH]</span>
</div>
<wicket:fragment wicket:id="userSearchFragment">
<div class="input-group">
- <span wicket:id="userOwner"/>
+ <span wicket:id="uManager"/>
<div class="input-group-addon">
- <a href="#" wicket:id="userOwnerReset"><i class="fas fa-minus-circle" alt="reset user owner" title="Reset"></i></a>
+ <a href="#" wicket:id="uManagerReset"><i class="fas fa-minus-circle" alt="reset user manager" title="Reset"></i></a>
</div>
</div>
<span wicket:id="usersearch">[USER SEARCH]</span>
@@ -41,9 +41,9 @@ under the License.
<wicket:fragment wicket:id="groupSearchFragment">
<div class="input-group">
- <span wicket:id="groupOwner"/>
+ <span wicket:id="gManager"/>
<div class="input-group-addon">
- <a href="#" wicket:id="groupOwnerReset"><i class="fas fa-minus-circle" alt="reset group owner" title="Reset"></i></a>
+ <a href="#" wicket:id="gManagerReset"><i class="fas fa-minus-circle" alt="reset group manager" title="Reset"></i></a>
</div>
</div>
<span wicket:id="groupsearch">[GROUP SEARCH]</span>
diff --git a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/wizards/any/Ownership_pt_BR.properties b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/wizards/any/Management.properties
similarity index 96%
copy from client/idrepo/console/src/main/resources/org/apache/syncope/client/console/wizards/any/Ownership_pt_BR.properties
copy to client/idrepo/console/src/main/resources/org/apache/syncope/client/console/wizards/any/Management.properties
index 8f41856beb..41fc981ae5 100644
--- a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/wizards/any/Ownership_pt_BR.properties
+++ b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/wizards/any/Management.properties
@@ -14,4 +14,4 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
-group.ownership=Group Ownership
+manager=Manager
diff --git a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/wizards/any/Ownership.properties b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/wizards/any/Management_fr_CA.properties
similarity index 96%
rename from client/idrepo/console/src/main/resources/org/apache/syncope/client/console/wizards/any/Ownership.properties
rename to client/idrepo/console/src/main/resources/org/apache/syncope/client/console/wizards/any/Management_fr_CA.properties
index 8f41856beb..023d403bcc 100644
--- a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/wizards/any/Ownership.properties
+++ b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/wizards/any/Management_fr_CA.properties
@@ -14,4 +14,4 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
-group.ownership=Group Ownership
+manager=Gestionnaire
diff --git a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/wizards/any/Ownership_fr_CA.properties b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/wizards/any/Management_it.properties
similarity index 95%
rename from client/idrepo/console/src/main/resources/org/apache/syncope/client/console/wizards/any/Ownership_fr_CA.properties
rename to client/idrepo/console/src/main/resources/org/apache/syncope/client/console/wizards/any/Management_it.properties
index 77355f40fd..142f7242b2 100644
--- a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/wizards/any/Ownership_fr_CA.properties
+++ b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/wizards/any/Management_it.properties
@@ -14,4 +14,4 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
-group.ownership=Propri�t� du groupe
+manager=Responsabile
diff --git a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/wizards/any/Ownership_it.properties b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/wizards/any/Management_ja.properties
similarity index 95%
rename from client/idrepo/console/src/main/resources/org/apache/syncope/client/console/wizards/any/Ownership_it.properties
rename to client/idrepo/console/src/main/resources/org/apache/syncope/client/console/wizards/any/Management_ja.properties
index 6998bc47a5..41fc981ae5 100644
--- a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/wizards/any/Ownership_it.properties
+++ b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/wizards/any/Management_ja.properties
@@ -14,4 +14,4 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
-group.ownership=Proprietario del gruppo
+manager=Manager
diff --git a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/wizards/any/Ownership_pt_BR.properties b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/wizards/any/Management_pt_BR.properties
similarity index 96%
copy from client/idrepo/console/src/main/resources/org/apache/syncope/client/console/wizards/any/Ownership_pt_BR.properties
copy to client/idrepo/console/src/main/resources/org/apache/syncope/client/console/wizards/any/Management_pt_BR.properties
index 8f41856beb..ad329630f5 100644
--- a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/wizards/any/Ownership_pt_BR.properties
+++ b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/wizards/any/Management_pt_BR.properties
@@ -14,4 +14,4 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
-group.ownership=Group Ownership
+manager=Gerente
diff --git a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/wizards/any/Ownership_pt_BR.properties b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/wizards/any/Management_ru.properties
similarity index 96%
rename from client/idrepo/console/src/main/resources/org/apache/syncope/client/console/wizards/any/Ownership_pt_BR.properties
rename to client/idrepo/console/src/main/resources/org/apache/syncope/client/console/wizards/any/Management_ru.properties
index 8f41856beb..851e62c969 100644
--- a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/wizards/any/Ownership_pt_BR.properties
+++ b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/wizards/any/Management_ru.properties
@@ -14,4 +14,5 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
-group.ownership=Group Ownership
+#
+manager=Manager
diff --git a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/wizards/any/Ownership_ja.properties b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/wizards/any/Ownership_ja.properties
deleted file mode 100644
index fbdf9e08d6..0000000000
--- a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/wizards/any/Ownership_ja.properties
+++ /dev/null
@@ -1,17 +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.
-group.ownership=\u30b0\u30eb\u30fc\u30d7\u30aa\u30fc\u30ca\u30fc\u30b7\u30c3\u30d7
diff --git a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/wizards/any/Ownership_ru.properties b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/wizards/any/Ownership_ru.properties
deleted file mode 100644
index 11ac32009d..0000000000
--- a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/wizards/any/Ownership_ru.properties
+++ /dev/null
@@ -1,18 +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.
-#
-group.ownership=\u0412\u043b\u0430\u0434\u0435\u043b\u0435\u0446 \u0433\u0440\u0443\u043f\u043f\u044b
diff --git a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/wizards/role/RoleWizardBuilder$Details.html b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/wizards/role/RoleWizardBuilder$Details.html
index b3ca11ad06..0e91409af3 100644
--- a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/wizards/role/RoleWizardBuilder$Details.html
+++ b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/wizards/role/RoleWizardBuilder$Details.html
@@ -21,6 +21,5 @@ under the License.
<div class="form-group">
<span wicket:id="key">[NAME]</span>
</div>
- <div wicket:id="dynMembershipCond"/>
</wicket:panel>
</html>
diff --git a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/wizards/role/RoleWizardBuilder$DynRealms.html b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/wizards/role/RoleWizardBuilder$DynRealms.html
deleted file mode 100644
index d043a5ab88..0000000000
--- a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/wizards/role/RoleWizardBuilder$DynRealms.html
+++ /dev/null
@@ -1,25 +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.
--->
-<html xmlns="http://www.w3.org/1999/xhtml" xmlns:wicket="http://wicket.apache.org">
- <wicket:panel>
- <div class="form-group">
- <span wicket:id="dynRealms">[DYNAMIC REALMS]</span>
- </div>
- </wicket:panel>
-</html>
diff --git a/client/idrepo/enduser/src/main/java/org/apache/syncope/client/enduser/panels/any/Groups.java b/client/idrepo/enduser/src/main/java/org/apache/syncope/client/enduser/panels/any/Groups.java
index 2b1b32100d..45052d40d1 100644
--- a/client/idrepo/enduser/src/main/java/org/apache/syncope/client/enduser/panels/any/Groups.java
+++ b/client/idrepo/enduser/src/main/java/org/apache/syncope/client/enduser/panels/any/Groups.java
@@ -58,10 +58,6 @@ public class Groups extends Panel {
protected final AnyTO anyTO;
- protected WebMarkupContainer dyngroupsContainer;
-
- protected WebMarkupContainer dynrealmsContainer;
-
protected WebMarkupContainer groupsContainer;
public <T extends AnyTO> Groups(final String id, final AnyWrapper<T> modelObject) {
@@ -94,9 +90,7 @@ public class Groups extends Panel {
setOutputMarkupId(true);
- addDynamicGroupsContainer();
addGroupsPanel();
- addDynamicRealmsContainer();
}
protected SerializableFunction<AjaxRequestTarget, Boolean> getEventFunction() {
@@ -166,12 +160,6 @@ public class Groups extends Panel {
}
}
- protected void addDynamicRealmsContainer() {
- }
-
- protected void addDynamicGroupsContainer() {
- }
-
protected class EnduserGroupsModel extends AbstractGroupsModel {
private static final long serialVersionUID = -4541954630939063927L;
@@ -195,10 +183,5 @@ public class Groups extends Panel {
protected void reloadMemberships() {
memberships = GroupableRelatableTO.class.cast(anyTO).getMemberships();
}
-
- @Override
- public List<String> getDynMemberships() {
- return List.of();
- }
}
}
diff --git a/common/idrepo/lib/src/main/java/org/apache/syncope/common/lib/AnyOperations.java b/common/idrepo/lib/src/main/java/org/apache/syncope/common/lib/AnyOperations.java
index 1815e44c60..5fb557e829 100644
--- a/common/idrepo/lib/src/main/java/org/apache/syncope/common/lib/AnyOperations.java
+++ b/common/idrepo/lib/src/main/java/org/apache/syncope/common/lib/AnyOperations.java
@@ -127,7 +127,13 @@ public final class AnyOperations {
// 1. realm
result.setRealm(replacePatchItem(updated.getRealm(), original.getRealm(), new StringReplacePatchItem()));
- // 2. auxiliary classes
+ // 2. manager
+ result.setUManager(
+ replacePatchItem(updated.getUManager(), original.getUManager(), new StringReplacePatchItem()));
+ result.setGManager(
+ replacePatchItem(updated.getGManager(), original.getGManager(), new StringReplacePatchItem()));
+
+ // 3. auxiliary classes
result.getAuxClasses().clear();
if (!incremental) {
@@ -140,10 +146,10 @@ public final class AnyOperations {
forEach(auxClass -> result.getAuxClasses().add(new StringPatchItem.Builder().
operation(PatchOperation.ADD_REPLACE).value(auxClass).build()));
- // 3. relationships
+ // 4. relationships
relationships(updated, original, incremental, result.getRelationships());
- // 4. plain attributes
+ // 5. plain attributes
Map<String, Attr> updatedAttrs = EntityTOUtils.buildAttrMap(updated.getPlainAttrs());
Map<String, Attr> originalAttrs = EntityTOUtils.buildAttrMap(original.getPlainAttrs());
@@ -176,7 +182,7 @@ public final class AnyOperations {
}
});
- // 4. resources
+ // 6. resources
result.getResources().clear();
if (!incremental) {
@@ -335,17 +341,7 @@ public final class AnyOperations {
// 1. name
result.setName(replacePatchItem(updated.getName(), original.getName(), new StringReplacePatchItem()));
- // 2. ownership
- result.setUserOwner(
- replacePatchItem(updated.getUserOwner(), original.getUserOwner(), new StringReplacePatchItem()));
- result.setGroupOwner(
- replacePatchItem(updated.getGroupOwner(), original.getGroupOwner(), new StringReplacePatchItem()));
-
- // 3. dynamic membership
- result.setUDynMembershipCond(updated.getUDynMembershipCond());
- result.getADynMembershipConds().putAll(updated.getADynMembershipConds());
-
- // 4. type extensions
+ // 2. type extensions
result.getTypeExtensions().addAll(updated.getTypeExtensions());
return result;
@@ -397,7 +393,15 @@ public final class AnyOperations {
result.setRealm(req.getRealm().getValue());
}
- // 1. auxiliary classes
+ // 1. manager
+ if (req.getUManager() != null) {
+ result.setUManager(req.getUManager().getValue());
+ }
+ if (req.getGManager() != null) {
+ result.setGManager(req.getGManager().getValue());
+ }
+
+ // 2. auxiliary classes
for (StringPatchItem auxClassPatch : req.getAuxClasses()) {
switch (auxClassPatch.getOperation()) {
case ADD_REPLACE:
@@ -410,11 +414,11 @@ public final class AnyOperations {
}
}
- // 2. plain attributes
+ // 3. plain attributes
result.getPlainAttrs().clear();
result.getPlainAttrs().addAll(patch(EntityTOUtils.buildAttrMap(to.getPlainAttrs()), req.getPlainAttrs()));
- // 3. resources
+ // 4. resources
for (StringPatchItem resourcePatch : req.getResources()) {
switch (resourcePatch.getOperation()) {
case ADD_REPLACE:
@@ -471,17 +475,6 @@ public final class AnyOperations {
result.setName(groupUR.getName().getValue());
}
- if (groupUR.getUserOwner() != null) {
- result.setGroupOwner(groupUR.getUserOwner().getValue());
- }
- if (groupUR.getGroupOwner() != null) {
- result.setGroupOwner(groupUR.getGroupOwner().getValue());
- }
-
- result.setUDynMembershipCond(groupUR.getUDynMembershipCond());
- result.getADynMembershipConds().clear();
- result.getADynMembershipConds().putAll(groupUR.getADynMembershipConds());
-
relationships(groupUR.getRelationships(), result);
return result;
diff --git a/common/idrepo/lib/src/main/java/org/apache/syncope/common/lib/EntityTOUtils.java b/common/idrepo/lib/src/main/java/org/apache/syncope/common/lib/EntityTOUtils.java
index 7f10da1df0..4567d914da 100644
--- a/common/idrepo/lib/src/main/java/org/apache/syncope/common/lib/EntityTOUtils.java
+++ b/common/idrepo/lib/src/main/java/org/apache/syncope/common/lib/EntityTOUtils.java
@@ -65,6 +65,8 @@ public final class EntityTOUtils {
public static <A extends AnyTO, C extends AnyCR> void toAnyCR(final A anyTO, final C anyCR) {
anyCR.setRealm(anyTO.getRealm());
+ anyCR.setUManager(anyTO.getUManager());
+ anyCR.setGManager(anyTO.getGManager());
anyCR.getAuxClasses().addAll(anyTO.getAuxClasses());
anyCR.getPlainAttrs().addAll(anyTO.getPlainAttrs());
anyCR.getResources().addAll(anyTO.getResources());
@@ -80,10 +82,6 @@ public final class EntityTOUtils {
userCR.getRoles().addAll(userTO.getRoles());
} else if (anyCR instanceof final GroupCR groupCR && anyTO instanceof final GroupTO groupTO) {
groupCR.setName(groupTO.getName());
- groupCR.setUserOwner(groupTO.getUserOwner());
- groupCR.setGroupOwner(groupTO.getGroupOwner());
- groupCR.setUDynMembershipCond(groupTO.getUDynMembershipCond());
- groupCR.getADynMembershipConds().putAll(groupTO.getADynMembershipConds());
groupCR.getTypeExtensions().addAll(groupTO.getTypeExtensions());
} else if (anyCR instanceof final AnyObjectCR anyObjectCR && anyTO instanceof final AnyObjectTO anyObjectTO) {
anyObjectCR.setType(anyObjectTO.getType());
@@ -94,6 +92,8 @@ public final class EntityTOUtils {
public static <C extends AnyCR, A extends AnyTO> void toAnyTO(final C anyCR, final A anyTO) {
anyTO.setRealm(anyCR.getRealm());
+ anyTO.setUManager(anyCR.getUManager());
+ anyTO.setGManager(anyCR.getGManager());
anyTO.getAuxClasses().addAll(anyCR.getAuxClasses());
anyTO.getPlainAttrs().addAll(anyCR.getPlainAttrs());
anyTO.getResources().addAll(anyCR.getResources());
@@ -110,10 +110,6 @@ public final class EntityTOUtils {
} else if (anyTO instanceof final GroupTO groupTO && anyCR instanceof final GroupCR groupCR) {
groupTO.setName(groupCR.getName());
- groupTO.setUserOwner(groupCR.getUserOwner());
- groupTO.setGroupOwner(groupCR.getGroupOwner());
- groupTO.setUDynMembershipCond(groupCR.getUDynMembershipCond());
- groupTO.getADynMembershipConds().putAll(groupCR.getADynMembershipConds());
groupTO.getTypeExtensions().addAll(groupCR.getTypeExtensions());
} else if (anyTO instanceof final AnyObjectTO anyObjectTO && anyCR instanceof final AnyObjectCR anyObjectCR) {
anyObjectTO.setType(anyObjectCR.getType());
diff --git a/common/idrepo/lib/src/main/java/org/apache/syncope/common/lib/request/AnyCR.java b/common/idrepo/lib/src/main/java/org/apache/syncope/common/lib/request/AnyCR.java
index de67729df1..d7c0e77dee 100644
--- a/common/idrepo/lib/src/main/java/org/apache/syncope/common/lib/request/AnyCR.java
+++ b/common/idrepo/lib/src/main/java/org/apache/syncope/common/lib/request/AnyCR.java
@@ -61,6 +61,18 @@ public abstract class AnyCR implements BaseBean, RealmMember, RelatableTO {
return instance;
}
+ @SuppressWarnings("unchecked")
+ public B uManager(final String uManager) {
+ getInstance().setUManager(uManager);
+ return (B) this;
+ }
+
+ @SuppressWarnings("unchecked")
+ public B gManager(final String gManager) {
+ getInstance().setGManager(gManager);
+ return (B) this;
+ }
+
@SuppressWarnings("unchecked")
public B auxClass(final String auxClass) {
getInstance().getAuxClasses().add(auxClass);
@@ -143,6 +155,10 @@ public abstract class AnyCR implements BaseBean, RealmMember, RelatableTO {
private String realm;
+ private String uManager;
+
+ private String gManager;
+
private final Set<String> auxClasses = new HashSet<>();
private final Set<Attr> plainAttrs = new HashSet<>();
@@ -169,6 +185,22 @@ public abstract class AnyCR implements BaseBean, RealmMember, RelatableTO {
this.realm = realm;
}
+ public String getUManager() {
+ return uManager;
+ }
+
+ public void setUManager(final String uManager) {
+ this.uManager = uManager;
+ }
+
+ public String getGManager() {
+ return gManager;
+ }
+
+ public void setGManager(final String gManager) {
+ this.gManager = gManager;
+ }
+
@Override
public Set<String> getAuxClasses() {
return auxClasses;
@@ -220,6 +252,8 @@ public abstract class AnyCR implements BaseBean, RealmMember, RelatableTO {
return new HashCodeBuilder().
append(discriminator).
append(realm).
+ append(uManager).
+ append(gManager).
append(auxClasses).
append(plainAttrs).
append(resources).
@@ -242,6 +276,8 @@ public abstract class AnyCR implements BaseBean, RealmMember, RelatableTO {
return new EqualsBuilder().
append(discriminator, other.discriminator).
append(realm, other.realm).
+ append(uManager, other.uManager).
+ append(gManager, other.gManager).
append(auxClasses, other.auxClasses).
append(plainAttrs, other.plainAttrs).
append(resources, other.resources).
diff --git a/common/idrepo/lib/src/main/java/org/apache/syncope/common/lib/request/AnyObjectCR.java b/common/idrepo/lib/src/main/java/org/apache/syncope/common/lib/request/AnyObjectCR.java
index c35f1ffd89..69e78def88 100644
--- a/common/idrepo/lib/src/main/java/org/apache/syncope/common/lib/request/AnyObjectCR.java
+++ b/common/idrepo/lib/src/main/java/org/apache/syncope/common/lib/request/AnyObjectCR.java
@@ -109,12 +109,6 @@ public class AnyObjectCR extends AnyCR implements GroupableRelatableTO {
return memberships;
}
- @JsonIgnore
- @Override
- public List<MembershipTO> getDynMemberships() {
- return List.of();
- }
-
@Override
public int hashCode() {
return new HashCodeBuilder().
diff --git a/common/idrepo/lib/src/main/java/org/apache/syncope/common/lib/request/AnyUR.java b/common/idrepo/lib/src/main/java/org/apache/syncope/common/lib/request/AnyUR.java
index 3716ca7f83..a3c18fb0fb 100644
--- a/common/idrepo/lib/src/main/java/org/apache/syncope/common/lib/request/AnyUR.java
+++ b/common/idrepo/lib/src/main/java/org/apache/syncope/common/lib/request/AnyUR.java
@@ -62,6 +62,18 @@ public abstract class AnyUR implements BaseBean {
return (B) this;
}
+ @SuppressWarnings("unchecked")
+ public B uManager(final StringReplacePatchItem uManager) {
+ getInstance().setUManager(uManager);
+ return (B) this;
+ }
+
+ @SuppressWarnings("unchecked")
+ public B gManager(final StringReplacePatchItem gManager) {
+ getInstance().setGManager(gManager);
+ return (B) this;
+ }
+
@SuppressWarnings("unchecked")
public B auxClass(final StringPatchItem auxClass) {
getInstance().getAuxClasses().add(auxClass);
@@ -146,6 +158,10 @@ public abstract class AnyUR implements BaseBean {
private StringReplacePatchItem realm;
+ private StringReplacePatchItem uManager;
+
+ private StringReplacePatchItem gManager;
+
private final Set<StringPatchItem> auxClasses = new HashSet<>();
private final Set<AttrPatch> plainAttrs = new HashSet<>();
@@ -179,6 +195,22 @@ public abstract class AnyUR implements BaseBean {
this.realm = realm;
}
+ public StringReplacePatchItem getUManager() {
+ return uManager;
+ }
+
+ public void setUManager(final StringReplacePatchItem uManager) {
+ this.uManager = uManager;
+ }
+
+ public StringReplacePatchItem getGManager() {
+ return gManager;
+ }
+
+ public void setGManager(final StringReplacePatchItem gManager) {
+ this.gManager = gManager;
+ }
+
public Set<StringPatchItem> getAuxClasses() {
return auxClasses;
}
@@ -201,6 +233,8 @@ public abstract class AnyUR implements BaseBean {
@JsonIgnore
public boolean isEmpty() {
return realm == null
+ && uManager == null
+ && gManager == null
&& auxClasses.isEmpty()
&& plainAttrs.isEmpty()
&& resources.isEmpty()
@@ -213,6 +247,8 @@ public abstract class AnyUR implements BaseBean {
append(discriminator).
append(key).
append(realm).
+ append(uManager).
+ append(gManager).
append(auxClasses).
append(plainAttrs).
append(resources).
@@ -236,6 +272,8 @@ public abstract class AnyUR implements BaseBean {
append(discriminator, other.discriminator).
append(key, other.key).
append(realm, other.realm).
+ append(uManager, other.uManager).
+ append(gManager, other.gManager).
append(auxClasses, other.auxClasses).
append(plainAttrs, other.plainAttrs).
append(resources, other.resources).
diff --git a/common/idrepo/lib/src/main/java/org/apache/syncope/common/lib/request/GroupCR.java b/common/idrepo/lib/src/main/java/org/apache/syncope/common/lib/request/GroupCR.java
index 767f1a1a9d..8db66b98a9 100644
--- a/common/idrepo/lib/src/main/java/org/apache/syncope/common/lib/request/GroupCR.java
+++ b/common/idrepo/lib/src/main/java/org/apache/syncope/common/lib/request/GroupCR.java
@@ -23,9 +23,7 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import io.swagger.v3.oas.annotations.media.Schema;
import java.util.ArrayList;
import java.util.Collection;
-import java.util.HashMap;
import java.util.List;
-import java.util.Map;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.syncope.common.lib.to.TypeExtensionTO;
@@ -48,26 +46,6 @@ public class GroupCR extends AnyCR {
return new GroupCR();
}
- public Builder userOwner(final String userOwner) {
- getInstance().setUserOwner(userOwner);
- return this;
- }
-
- public Builder groupOwner(final String groupOwner) {
- getInstance().setGroupOwner(groupOwner);
- return this;
- }
-
- public Builder udynMembershipCond(final String udynMembershipCond) {
- getInstance().setUDynMembershipCond(udynMembershipCond);
- return this;
- }
-
- public Builder adynMembershipCond(final String type, final String fiql) {
- getInstance().getADynMembershipConds().put(type, fiql);
- return this;
- }
-
public Builder typeExtension(final TypeExtensionTO typeExtension) {
getInstance().getTypeExtensions().add(typeExtension);
return this;
@@ -86,14 +64,6 @@ public class GroupCR extends AnyCR {
private String name;
- private String userOwner;
-
- private String groupOwner;
-
- private String udynMembershipCond;
-
- private final Map<String, String> adynMembershipConds = new HashMap<>();
-
private final List<TypeExtensionTO> typeExtensions = new ArrayList<>();
@JsonProperty("_class")
@@ -113,34 +83,6 @@ public class GroupCR extends AnyCR {
this.name = name;
}
- public String getUserOwner() {
- return userOwner;
- }
-
- public void setUserOwner(final String userOwner) {
- this.userOwner = userOwner;
- }
-
- public String getGroupOwner() {
- return groupOwner;
- }
-
- public void setGroupOwner(final String groupOwner) {
- this.groupOwner = groupOwner;
- }
-
- public String getUDynMembershipCond() {
- return udynMembershipCond;
- }
-
- public void setUDynMembershipCond(final String uDynMembershipCond) {
- this.udynMembershipCond = uDynMembershipCond;
- }
-
- public Map<String, String> getADynMembershipConds() {
- return adynMembershipConds;
- }
-
public List<TypeExtensionTO> getTypeExtensions() {
return typeExtensions;
}
@@ -150,10 +92,6 @@ public class GroupCR extends AnyCR {
return new HashCodeBuilder().
appendSuper(super.hashCode()).
append(name).
- append(userOwner).
- append(groupOwner).
- append(udynMembershipCond).
- append(adynMembershipConds).
append(typeExtensions).
build();
}
@@ -173,10 +111,6 @@ public class GroupCR extends AnyCR {
return new EqualsBuilder().
appendSuper(super.equals(obj)).
append(name, other.name).
- append(userOwner, other.userOwner).
- append(groupOwner, other.groupOwner).
- append(udynMembershipCond, other.udynMembershipCond).
- append(adynMembershipConds, other.adynMembershipConds).
append(typeExtensions, other.typeExtensions).
build();
}
diff --git a/common/idrepo/lib/src/main/java/org/apache/syncope/common/lib/request/GroupUR.java b/common/idrepo/lib/src/main/java/org/apache/syncope/common/lib/request/GroupUR.java
index 38756c0469..205dc5ea74 100644
--- a/common/idrepo/lib/src/main/java/org/apache/syncope/common/lib/request/GroupUR.java
+++ b/common/idrepo/lib/src/main/java/org/apache/syncope/common/lib/request/GroupUR.java
@@ -23,9 +23,7 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import java.util.ArrayList;
import java.util.Collection;
-import java.util.HashMap;
import java.util.List;
-import java.util.Map;
import java.util.Optional;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
@@ -52,31 +50,6 @@ public class GroupUR extends AnyUR {
return this;
}
- public Builder userOwner(final StringReplacePatchItem userOwner) {
- getInstance().setUserOwner(userOwner);
- return this;
- }
-
- public Builder groupOwner(final StringReplacePatchItem groupOwner) {
- getInstance().setGroupOwner(groupOwner);
- return this;
- }
-
- public Builder udynMembershipCond(final String udynMembershipCond) {
- getInstance().setUDynMembershipCond(udynMembershipCond);
- return this;
- }
-
- public Builder adynMembershipCond(final String type, final String fiql) {
- getInstance().getADynMembershipConds().put(type, fiql);
- return this;
- }
-
- public Builder adynMembershipConds(final Map<String, String> conds) {
- getInstance().getADynMembershipConds().putAll(conds);
- return this;
- }
-
public Builder typeExtension(final TypeExtensionTO typeExtension) {
getInstance().getTypeExtensions().add(typeExtension);
return this;
@@ -95,14 +68,6 @@ public class GroupUR extends AnyUR {
private StringReplacePatchItem name;
- private StringReplacePatchItem userOwner;
-
- private StringReplacePatchItem groupOwner;
-
- private String udynMembershipCond;
-
- private final Map<String, String> adynMembershipConds = new HashMap<>();
-
private final List<TypeExtensionTO> typeExtensions = new ArrayList<>();
@JsonProperty("_class")
@@ -121,34 +86,6 @@ public class GroupUR extends AnyUR {
this.name = name;
}
- public StringReplacePatchItem getUserOwner() {
- return userOwner;
- }
-
- public void setUserOwner(final StringReplacePatchItem userOwner) {
- this.userOwner = userOwner;
- }
-
- public StringReplacePatchItem getGroupOwner() {
- return groupOwner;
- }
-
- public void setGroupOwner(final StringReplacePatchItem groupOwner) {
- this.groupOwner = groupOwner;
- }
-
- public String getUDynMembershipCond() {
- return udynMembershipCond;
- }
-
- public void setUDynMembershipCond(final String udynMembershipCond) {
- this.udynMembershipCond = udynMembershipCond;
- }
-
- public Map<String, String> getADynMembershipConds() {
- return adynMembershipConds;
- }
-
@JsonIgnore
public Optional<TypeExtensionTO> getTypeExtension(final String anyType) {
return typeExtensions.stream().filter(
@@ -162,8 +99,7 @@ public class GroupUR extends AnyUR {
@Override
public boolean isEmpty() {
return super.isEmpty()
- && name == null && userOwner == null && groupOwner == null && udynMembershipCond == null
- && adynMembershipConds.isEmpty() && typeExtensions.isEmpty();
+ && name == null && typeExtensions.isEmpty();
}
@Override
@@ -171,10 +107,6 @@ public class GroupUR extends AnyUR {
return new HashCodeBuilder().
appendSuper(super.hashCode()).
append(name).
- append(userOwner).
- append(groupOwner).
- append(udynMembershipCond).
- append(adynMembershipConds).
append(typeExtensions).
build();
}
@@ -194,10 +126,6 @@ public class GroupUR extends AnyUR {
return new EqualsBuilder().
appendSuper(super.equals(obj)).
append(name, other.name).
- append(userOwner, other.userOwner).
- append(groupOwner, other.groupOwner).
- append(udynMembershipCond, other.udynMembershipCond).
- append(adynMembershipConds, other.adynMembershipConds).
append(typeExtensions, other.typeExtensions).
build();
}
diff --git a/common/idrepo/lib/src/main/java/org/apache/syncope/common/lib/request/UserCR.java b/common/idrepo/lib/src/main/java/org/apache/syncope/common/lib/request/UserCR.java
index ba10009792..837f65403a 100644
--- a/common/idrepo/lib/src/main/java/org/apache/syncope/common/lib/request/UserCR.java
+++ b/common/idrepo/lib/src/main/java/org/apache/syncope/common/lib/request/UserCR.java
@@ -209,12 +209,6 @@ public class UserCR extends AnyCR implements GroupableRelatableTO {
return memberships;
}
- @JsonIgnore
- @Override
- public List<MembershipTO> getDynMemberships() {
- return List.of();
- }
-
public Set<String> getRoles() {
return roles;
}
diff --git a/common/idrepo/lib/src/main/java/org/apache/syncope/common/lib/search/AbstractFiqlSearchConditionBuilder.java b/common/idrepo/lib/src/main/java/org/apache/syncope/common/lib/search/AbstractFiqlSearchConditionBuilder.java
index fbeb54a36a..4a6a9c74d6 100644
--- a/common/idrepo/lib/src/main/java/org/apache/syncope/common/lib/search/AbstractFiqlSearchConditionBuilder.java
+++ b/common/idrepo/lib/src/main/java/org/apache/syncope/common/lib/search/AbstractFiqlSearchConditionBuilder.java
@@ -70,18 +70,6 @@ public abstract class AbstractFiqlSearchConditionBuilder<
return newBuilderInstance().is(property).notNullValue();
}
- public C inDynRealms(final String dynRealm, final String... moreDynRealms) {
- return newBuilderInstance().
- is(SpecialAttr.DYNREALMS.toString()).
- inDynRealms(dynRealm, moreDynRealms);
- }
-
- public C notInDynRealms(final String dynRealm, final String... moreDynRealms) {
- return newBuilderInstance().
- is(SpecialAttr.DYNREALMS.toString()).
- notInDynRealms(dynRealm, moreDynRealms);
- }
-
public C hasAuxClasses(final String auxClass, final String... moreAuxClasses) {
return newBuilderInstance().is(SpecialAttr.AUX_CLASSES.toString()).hasAuxClasses(auxClass, moreAuxClasses);
}
@@ -173,18 +161,6 @@ public abstract class AbstractFiqlSearchConditionBuilder<
return condition(FiqlParser.NEQ, resource, (Object[]) moreResources);
}
- @Override
- public C inDynRealms(final String dynRealm, final String... moreDynRealms) {
- this.result = SpecialAttr.DYNREALMS.toString();
- return condition(FiqlParser.EQ, dynRealm, (Object[]) moreDynRealms);
- }
-
- @Override
- public C notInDynRealms(final String dynRealm, final String... moreDynRealms) {
- this.result = SpecialAttr.DYNREALMS.toString();
- return condition(FiqlParser.NEQ, dynRealm, (Object[]) moreDynRealms);
- }
-
@Override
public PA and() {
super.and();
diff --git a/common/idrepo/lib/src/main/java/org/apache/syncope/common/lib/search/SearchableFields.java b/common/idrepo/lib/src/main/java/org/apache/syncope/common/lib/search/SearchableFields.java
index d9f0299386..dd2086efe0 100644
--- a/common/idrepo/lib/src/main/java/org/apache/syncope/common/lib/search/SearchableFields.java
+++ b/common/idrepo/lib/src/main/java/org/apache/syncope/common/lib/search/SearchableFields.java
@@ -35,8 +35,7 @@ import org.apache.syncope.common.lib.types.AttrSchemaType;
public final class SearchableFields {
private static final String[] ATTRIBUTES_NOTINCLUDED = {
- "serialVersionUID", "discriminator", "password", "type", "udynMembershipCond", "securityAnswer",
- "token", "tokenExpireTime"
+ "serialVersionUID", "discriminator", "password", "type", "securityAnswer", "token", "tokenExpireTime"
};
private static final Set<String> ANY_FIELDS = new HashSet<>();
diff --git a/common/idrepo/lib/src/main/java/org/apache/syncope/common/lib/search/SpecialAttr.java b/common/idrepo/lib/src/main/java/org/apache/syncope/common/lib/search/SpecialAttr.java
index ac0a74e60b..0a059d8142 100644
--- a/common/idrepo/lib/src/main/java/org/apache/syncope/common/lib/search/SpecialAttr.java
+++ b/common/idrepo/lib/src/main/java/org/apache/syncope/common/lib/search/SpecialAttr.java
@@ -55,10 +55,6 @@ public enum SpecialAttr {
* Applies to users.
*/
ROLES("$roles"),
- /**
- * Applies to users, groups and any objects.
- */
- DYNREALMS("$dynRealms"),
/**
* Applies to groups.
*/
diff --git a/common/idrepo/lib/src/main/java/org/apache/syncope/common/lib/search/SyncopeProperty.java b/common/idrepo/lib/src/main/java/org/apache/syncope/common/lib/search/SyncopeProperty.java
index 3b40a90b8c..99741c7c59 100644
--- a/common/idrepo/lib/src/main/java/org/apache/syncope/common/lib/search/SyncopeProperty.java
+++ b/common/idrepo/lib/src/main/java/org/apache/syncope/common/lib/search/SyncopeProperty.java
@@ -94,22 +94,4 @@ public interface SyncopeProperty<C extends SyncopeCompleteCondition<?, ?>> exten
* @return updated condition
*/
C hasNotResources(String resource, String... moreResources);
-
- /**
- * Is user, group or any object in the given dynamic realm(s)?
- *
- * @param dynRealm first dynamic realm
- * @param moreDynRealms more dynamic realms
- * @return updated condition
- */
- C inDynRealms(String dynRealm, String... moreDynRealms);
-
- /**
- * Is user, group or any object not in the given dynamic realm(s)?
- *
- * @param dynRealm first dynamic realm
- * @param moreDynRealms more dynamic realms
- * @return updated condition
- */
- C notInDynRealms(String dynRealm, String... moreDynRealms);
}
diff --git a/common/idrepo/lib/src/main/java/org/apache/syncope/common/lib/to/AnyObjectTO.java b/common/idrepo/lib/src/main/java/org/apache/syncope/common/lib/to/AnyObjectTO.java
index e588ed853e..db91153bfb 100644
--- a/common/idrepo/lib/src/main/java/org/apache/syncope/common/lib/to/AnyObjectTO.java
+++ b/common/idrepo/lib/src/main/java/org/apache/syncope/common/lib/to/AnyObjectTO.java
@@ -36,8 +36,6 @@ public class AnyObjectTO extends AnyTO implements GroupableRelatableTO {
private final List<MembershipTO> memberships = new ArrayList<>();
- private final List<MembershipTO> dynMemberships = new ArrayList<>();
-
@JsonProperty("_class")
@Schema(name = "_class", requiredMode = Schema.RequiredMode.REQUIRED,
example = "org.apache.syncope.common.lib.to.AnyObjectTO")
@@ -65,18 +63,12 @@ public class AnyObjectTO extends AnyTO implements GroupableRelatableTO {
return memberships;
}
- @Override
- public List<MembershipTO> getDynMemberships() {
- return dynMemberships;
- }
-
@Override
public int hashCode() {
return new HashCodeBuilder().
appendSuper(super.hashCode()).
append(name).
append(memberships).
- append(dynMemberships).
build();
}
@@ -96,7 +88,6 @@ public class AnyObjectTO extends AnyTO implements GroupableRelatableTO {
appendSuper(super.equals(obj)).
append(name, other.name).
append(memberships, other.memberships).
- append(dynMemberships, other.dynMemberships).
build();
}
}
diff --git a/common/idrepo/lib/src/main/java/org/apache/syncope/common/lib/to/AnyTO.java b/common/idrepo/lib/src/main/java/org/apache/syncope/common/lib/to/AnyTO.java
index e76ea4ab30..b92d5d522c 100644
--- a/common/idrepo/lib/src/main/java/org/apache/syncope/common/lib/to/AnyTO.java
+++ b/common/idrepo/lib/src/main/java/org/apache/syncope/common/lib/to/AnyTO.java
@@ -75,7 +75,9 @@ public abstract class AnyTO implements EntityTO, RealmMember, RelatableTO {
private String realm;
- private final List<String> dynRealms = new ArrayList<>();
+ private String uManager;
+
+ private String gManager;
private String status;
@@ -181,8 +183,20 @@ public abstract class AnyTO implements EntityTO, RealmMember, RelatableTO {
this.realm = realm;
}
- public List<String> getDynRealms() {
- return dynRealms;
+ public String getUManager() {
+ return uManager;
+ }
+
+ public void setUManager(final String uManager) {
+ this.uManager = uManager;
+ }
+
+ public String getGManager() {
+ return gManager;
+ }
+
+ public void setGManager(final String gManager) {
+ this.gManager = gManager;
}
public String getStatus() {
@@ -250,7 +264,8 @@ public abstract class AnyTO implements EntityTO, RealmMember, RelatableTO {
append(key).
append(type).
append(realm).
- append(dynRealms).
+ append(uManager).
+ append(gManager).
append(status).
append(auxClasses).
append(plainAttrs).
@@ -282,7 +297,8 @@ public abstract class AnyTO implements EntityTO, RealmMember, RelatableTO {
append(key, other.key).
append(type, other.type).
append(realm, other.realm).
- append(dynRealms, other.dynRealms).
+ append(uManager, other.uManager).
+ append(gManager, other.gManager).
append(status, other.status).
append(auxClasses, other.auxClasses).
append(plainAttrs, other.plainAttrs).
diff --git a/common/idrepo/lib/src/main/java/org/apache/syncope/common/lib/to/DynRealmTO.java b/common/idrepo/lib/src/main/java/org/apache/syncope/common/lib/to/DynRealmTO.java
deleted file mode 100644
index 96276eac02..0000000000
--- a/common/idrepo/lib/src/main/java/org/apache/syncope/common/lib/to/DynRealmTO.java
+++ /dev/null
@@ -1,47 +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.common.lib.to;
-
-import jakarta.ws.rs.PathParam;
-import java.util.HashMap;
-import java.util.Map;
-
-public class DynRealmTO implements EntityTO {
-
- private static final long serialVersionUID = 4560822655754800031L;
-
- private String key;
-
- private final Map<String, String> dynMembershipConds = new HashMap<>();
-
- @Override
- public String getKey() {
- return key;
- }
-
- @PathParam("key")
- @Override
- public void setKey(final String key) {
- this.key = key;
- }
-
- public Map<String, String> getDynMembershipConds() {
- return dynMembershipConds;
- }
-}
diff --git a/common/idrepo/lib/src/main/java/org/apache/syncope/common/lib/to/GroupTO.java b/common/idrepo/lib/src/main/java/org/apache/syncope/common/lib/to/GroupTO.java
index 80305b712f..8d52ed3a3c 100644
--- a/common/idrepo/lib/src/main/java/org/apache/syncope/common/lib/to/GroupTO.java
+++ b/common/idrepo/lib/src/main/java/org/apache/syncope/common/lib/to/GroupTO.java
@@ -22,9 +22,7 @@ import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import java.util.ArrayList;
-import java.util.HashMap;
import java.util.List;
-import java.util.Map;
import java.util.Optional;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
@@ -37,21 +35,9 @@ public class GroupTO extends AnyTO implements TypeExtensionHolderTO {
private String name;
- private String userOwner;
+ private long userMembershipCount;
- private String groupOwner;
-
- private String udynMembershipCond;
-
- private long staticUserMembershipCount;
-
- private long dynamicUserMembershipCount;
-
- private long staticAnyObjectMembershipCount;
-
- private long dynamicAnyObjectMembershipCount;
-
- private final Map<String, String> adynMembershipConds = new HashMap<>();
+ private long anyObjectMembershipCount;
private final List<TypeExtensionTO> typeExtensions = new ArrayList<>();
@@ -81,64 +67,20 @@ public class GroupTO extends AnyTO implements TypeExtensionHolderTO {
this.name = name;
}
- public String getUserOwner() {
- return userOwner;
- }
-
- public void setUserOwner(final String userOwner) {
- this.userOwner = userOwner;
- }
-
- public String getGroupOwner() {
- return groupOwner;
- }
-
- public void setGroupOwner(final String groupOwner) {
- this.groupOwner = groupOwner;
- }
-
- public String getUDynMembershipCond() {
- return udynMembershipCond;
- }
-
- public void setUDynMembershipCond(final String uDynMembershipCond) {
- this.udynMembershipCond = uDynMembershipCond;
- }
-
- public long getStaticUserMembershipCount() {
- return staticUserMembershipCount;
- }
-
- public void setStaticUserMembershipCount(final long staticUserMembershipCount) {
- this.staticUserMembershipCount = staticUserMembershipCount;
- }
-
- public long getDynamicUserMembershipCount() {
- return dynamicUserMembershipCount;
- }
-
- public void setDynamicUserMembershipCount(final long dynamicUserMembershipCount) {
- this.dynamicUserMembershipCount = dynamicUserMembershipCount;
- }
-
- public long getStaticAnyObjectMembershipCount() {
- return staticAnyObjectMembershipCount;
- }
-
- public void setStaticAnyObjectMembershipCount(final long staticAnyObjectMembershipCount) {
- this.staticAnyObjectMembershipCount = staticAnyObjectMembershipCount;
+ public long getUserMembershipCount() {
+ return userMembershipCount;
}
- public long getDynamicAnyObjectMembershipCount() {
- return dynamicAnyObjectMembershipCount;
+ public void setUserMembershipCount(final long userMembershipCount) {
+ this.userMembershipCount = userMembershipCount;
}
- public void setDynamicAnyObjectMembershipCount(final long dynamicAnyObjectMembershipCount) {
- this.dynamicAnyObjectMembershipCount = dynamicAnyObjectMembershipCount;
+ public long getAnyObjectMembershipCount() {
+ return anyObjectMembershipCount;
}
- public Map<String, String> getADynMembershipConds() {
- return adynMembershipConds;
+ public void setAnyObjectMembershipCount(final long anyObjectMembershipCount) {
+ this.anyObjectMembershipCount = anyObjectMembershipCount;
}
@JsonIgnore
@@ -159,10 +101,6 @@ public class GroupTO extends AnyTO implements TypeExtensionHolderTO {
return new HashCodeBuilder().
appendSuper(super.hashCode()).
append(name).
- append(userOwner).
- append(groupOwner).
- append(udynMembershipCond).
- append(adynMembershipConds).
append(typeExtensions).
build();
}
@@ -182,10 +120,6 @@ public class GroupTO extends AnyTO implements TypeExtensionHolderTO {
return new EqualsBuilder().
appendSuper(super.equals(obj)).
append(name, other.name).
- append(userOwner, other.userOwner).
- append(groupOwner, other.groupOwner).
- append(udynMembershipCond, other.udynMembershipCond).
- append(adynMembershipConds, other.adynMembershipConds).
append(typeExtensions, other.typeExtensions).
build();
}
diff --git a/common/idrepo/lib/src/main/java/org/apache/syncope/common/lib/to/GroupableRelatableTO.java b/common/idrepo/lib/src/main/java/org/apache/syncope/common/lib/to/GroupableRelatableTO.java
index e9e9e5f5d3..17c6980b53 100644
--- a/common/idrepo/lib/src/main/java/org/apache/syncope/common/lib/to/GroupableRelatableTO.java
+++ b/common/idrepo/lib/src/main/java/org/apache/syncope/common/lib/to/GroupableRelatableTO.java
@@ -26,6 +26,4 @@ public interface GroupableRelatableTO extends RelatableTO {
Optional<MembershipTO> getMembership(String groupKey);
List<MembershipTO> getMemberships();
-
- List<MembershipTO> getDynMemberships();
}
diff --git a/common/idrepo/lib/src/main/java/org/apache/syncope/common/lib/to/RoleTO.java b/common/idrepo/lib/src/main/java/org/apache/syncope/common/lib/to/RoleTO.java
index e5d18ea307..c818550b62 100644
--- a/common/idrepo/lib/src/main/java/org/apache/syncope/common/lib/to/RoleTO.java
+++ b/common/idrepo/lib/src/main/java/org/apache/syncope/common/lib/to/RoleTO.java
@@ -36,10 +36,6 @@ public class RoleTO implements EntityTO {
private final List<String> realms = new ArrayList<>();
- private final List<String> dynRealms = new ArrayList<>();
-
- private String dynMembershipCond;
-
@Override
public String getKey() {
return key;
@@ -59,18 +55,6 @@ public class RoleTO implements EntityTO {
return realms;
}
- public List<String> getDynRealms() {
- return dynRealms;
- }
-
- public String getDynMembershipCond() {
- return dynMembershipCond;
- }
-
- public void setDynMembershipCond(final String dynMembershipCond) {
- this.dynMembershipCond = dynMembershipCond;
- }
-
@Override
public boolean equals(final Object obj) {
if (this == obj) {
@@ -87,8 +71,6 @@ public class RoleTO implements EntityTO {
append(key, other.key).
append(entitlements, other.entitlements).
append(realms, other.realms).
- append(dynRealms, other.dynRealms).
- append(dynMembershipCond, other.dynMembershipCond).
build();
}
@@ -98,8 +80,6 @@ public class RoleTO implements EntityTO {
append(key).
append(entitlements).
append(realms).
- append(dynRealms).
- append(dynMembershipCond).
build();
}
}
diff --git a/common/idrepo/lib/src/main/java/org/apache/syncope/common/lib/to/UserTO.java b/common/idrepo/lib/src/main/java/org/apache/syncope/common/lib/to/UserTO.java
index 9a4d224944..2b58a9eebe 100644
--- a/common/idrepo/lib/src/main/java/org/apache/syncope/common/lib/to/UserTO.java
+++ b/common/idrepo/lib/src/main/java/org/apache/syncope/common/lib/to/UserTO.java
@@ -58,8 +58,6 @@ public class UserTO extends AnyTO implements GroupableRelatableTO {
private final List<MembershipTO> memberships = new ArrayList<>();
- private final List<MembershipTO> dynMemberships = new ArrayList<>();
-
private final List<String> roles = new ArrayList<>();
private final List<String> dynRoles = new ArrayList<>();
@@ -188,11 +186,6 @@ public class UserTO extends AnyTO implements GroupableRelatableTO {
return memberships;
}
- @Override
- public List<MembershipTO> getDynMemberships() {
- return dynMemberships;
- }
-
public List<String> getRoles() {
return roles;
}
@@ -232,7 +225,6 @@ public class UserTO extends AnyTO implements GroupableRelatableTO {
append(suspended).
append(mustChangePassword).
append(memberships).
- append(dynMemberships).
append(linkedAccounts).
append(delegatingDelegations).
append(delegatedDelegations).
@@ -266,7 +258,6 @@ public class UserTO extends AnyTO implements GroupableRelatableTO {
append(suspended, other.suspended).
append(mustChangePassword, other.mustChangePassword).
append(memberships, other.memberships).
- append(dynMemberships, other.dynMemberships).
append(linkedAccounts, other.linkedAccounts).
append(delegatingDelegations, other.delegatingDelegations).
append(delegatedDelegations, other.delegatedDelegations).
diff --git a/common/idrepo/lib/src/main/java/org/apache/syncope/common/lib/types/ClientExceptionType.java b/common/idrepo/lib/src/main/java/org/apache/syncope/common/lib/types/ClientExceptionType.java
index 9ff64d1c31..2b006fbfe9 100644
--- a/common/idrepo/lib/src/main/java/org/apache/syncope/common/lib/types/ClientExceptionType.java
+++ b/common/idrepo/lib/src/main/java/org/apache/syncope/common/lib/types/ClientExceptionType.java
@@ -58,7 +58,6 @@ public enum ClientExceptionType {
InvalidMapping(Response.Status.BAD_REQUEST),
InvalidMembership(Response.Status.BAD_REQUEST),
InvalidRealm(Response.Status.BAD_REQUEST),
- InvalidDynRealm(Response.Status.BAD_REQUEST),
InvalidRole(Response.Status.BAD_REQUEST),
InvalidUser(Response.Status.BAD_REQUEST),
InvalidExternalResource(Response.Status.BAD_REQUEST),
@@ -70,7 +69,7 @@ public enum ClientExceptionType {
RealmContains(Response.Status.BAD_REQUEST),
RequiredValuesMissing(Response.Status.BAD_REQUEST),
RESTValidation(Response.Status.BAD_REQUEST),
- GroupOwnership(Response.Status.BAD_REQUEST),
+ Management(Response.Status.BAD_REQUEST),
InUse(Response.Status.BAD_REQUEST),
Scheduling(Response.Status.BAD_REQUEST),
DelegatedAdministration(Response.Status.FORBIDDEN),
diff --git a/common/idrepo/lib/src/main/java/org/apache/syncope/common/lib/types/EntityViolationType.java b/common/idrepo/lib/src/main/java/org/apache/syncope/common/lib/types/EntityViolationType.java
index 439cca4e81..eff1ad2dcf 100644
--- a/common/idrepo/lib/src/main/java/org/apache/syncope/common/lib/types/EntityViolationType.java
+++ b/common/idrepo/lib/src/main/java/org/apache/syncope/common/lib/types/EntityViolationType.java
@@ -22,7 +22,6 @@ public enum EntityViolationType {
Standard,
InvalidAnyType,
- InvalidADynMemberships,
InvalidConnInstanceLocation,
InvalidConnPoolConf,
InvalidFormPropertyDef,
@@ -33,10 +32,9 @@ public enum EntityViolationType {
InvalidPolicy,
InvalidPropagationTask,
InvalidRealm,
- InvalidDynRealm,
InvalidReport,
InvalidResource,
- InvalidGroupOwner,
+ InvalidManager,
InvalidSchema,
InvalidSchedTask,
InvalidProvisioningTask,
diff --git a/common/idrepo/lib/src/main/java/org/apache/syncope/common/lib/types/IdRepoEntitlement.java b/common/idrepo/lib/src/main/java/org/apache/syncope/common/lib/types/IdRepoEntitlement.java
index 76a8726ab1..5073ae6a10 100644
--- a/common/idrepo/lib/src/main/java/org/apache/syncope/common/lib/types/IdRepoEntitlement.java
+++ b/common/idrepo/lib/src/main/java/org/apache/syncope/common/lib/types/IdRepoEntitlement.java
@@ -86,14 +86,6 @@ public final class IdRepoEntitlement {
public static final String ROLE_DELETE = "ROLE_DELETE";
- public static final String DYNREALM_CREATE = "DYNREALM_CREATE";
-
- public static final String DYNREALM_READ = "DYNREALM_READ";
-
- public static final String DYNREALM_UPDATE = "DYNREALM_UPDATE";
-
- public static final String DYNREALM_DELETE = "DYNREALM_DELETE";
-
public static final String SCHEMA_CREATE = "SCHEMA_CREATE";
public static final String SCHEMA_UPDATE = "SCHEMA_UPDATE";
diff --git a/common/idrepo/lib/src/test/java/org/apache/syncope/common/lib/SerializationTest.java b/common/idrepo/lib/src/test/java/org/apache/syncope/common/lib/SerializationTest.java
index bd82ee2b3f..d3c66473cf 100644
--- a/common/idrepo/lib/src/test/java/org/apache/syncope/common/lib/SerializationTest.java
+++ b/common/idrepo/lib/src/test/java/org/apache/syncope/common/lib/SerializationTest.java
@@ -78,8 +78,6 @@ public class SerializationTest {
public void map() throws IOException {
GroupUR req = new GroupUR();
req.setKey(UUID.randomUUID().toString());
- req.getADynMembershipConds().put("key1", "value1");
- req.getADynMembershipConds().put("key2", "value2");
StringWriter writer = new StringWriter();
MAPPER.writeValue(writer, req);
@@ -115,7 +113,6 @@ public class SerializationTest {
group.setName(UUID.randomUUID().toString());
group.setRealm(SyncopeConstants.ROOT_REALM);
group.getPlainAttrs().add(new Attr.Builder("style").value("cool").value("great").build());
- group.getADynMembershipConds().put("USER", "username==a*");
PagedResult<GroupTO> original = new PagedResult<>();
original.getResult().add(group);
@@ -135,7 +132,6 @@ public class SerializationTest {
GroupTO group = new GroupTO();
group.setName(UUID.randomUUID().toString());
group.setRealm(SyncopeConstants.ROOT_REALM);
- group.getADynMembershipConds().put("USER", "username==a*");
ProvisioningResult<GroupTO> original = new ProvisioningResult<>();
original.setEntity(group);
diff --git a/common/idrepo/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/DynRealmService.java b/common/idrepo/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/DynRealmService.java
deleted file mode 100644
index 3836e4f648..0000000000
--- a/common/idrepo/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/DynRealmService.java
+++ /dev/null
@@ -1,123 +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.common.rest.api.service;
-
-import io.swagger.v3.oas.annotations.Parameter;
-import io.swagger.v3.oas.annotations.enums.ParameterIn;
-import io.swagger.v3.oas.annotations.headers.Header;
-import io.swagger.v3.oas.annotations.media.Schema;
-import io.swagger.v3.oas.annotations.responses.ApiResponse;
-import io.swagger.v3.oas.annotations.responses.ApiResponses;
-import io.swagger.v3.oas.annotations.security.SecurityRequirement;
-import io.swagger.v3.oas.annotations.security.SecurityRequirements;
-import io.swagger.v3.oas.annotations.tags.Tag;
-import jakarta.validation.constraints.NotNull;
-import jakarta.ws.rs.Consumes;
-import jakarta.ws.rs.DELETE;
-import jakarta.ws.rs.GET;
-import jakarta.ws.rs.POST;
-import jakarta.ws.rs.PUT;
-import jakarta.ws.rs.Path;
-import jakarta.ws.rs.PathParam;
-import jakarta.ws.rs.Produces;
-import jakarta.ws.rs.core.HttpHeaders;
-import jakarta.ws.rs.core.MediaType;
-import jakarta.ws.rs.core.Response;
-import java.util.List;
-import org.apache.syncope.common.lib.to.DynRealmTO;
-import org.apache.syncope.common.rest.api.RESTHeaders;
-
-/**
- * REST operations for dynamic realms.
- */
-@Tag(name = "DynamicRealms")
-@SecurityRequirements({
- @SecurityRequirement(name = "BasicAuthentication"),
- @SecurityRequirement(name = "Bearer") })
-@Path("dynRealms")
-public interface DynRealmService extends JAXRSService {
-
- /**
- * Returns a list of all dynamic realms.
- *
- * @return list of all dynamic realms.
- */
- @GET
- @Produces({ MediaType.APPLICATION_JSON })
- List<DynRealmTO> list();
-
- /**
- * Returns dynamic realm with matching key.
- *
- * @param key dynamic realm key to be read
- * @return dynamic realm with matching key
- */
- @GET
- @Path("{key}")
- @Produces({ MediaType.APPLICATION_JSON })
- DynRealmTO read(@NotNull @PathParam("key") String key);
-
- /**
- * Creates a new dynamic realm.
- *
- * @param dynDynRealmTO dynamic realm to be created
- * @return Response object featuring Location header of created dynamic realm
- */
- @ApiResponses(
- @ApiResponse(responseCode = "201",
- description = "DynRealm successfully created", headers = {
- @Header(name = RESTHeaders.RESOURCE_KEY, schema =
- @Schema(type = "string"),
- description = "Key value for the entity created"),
- @Header(name = HttpHeaders.LOCATION, schema =
- @Schema(type = "string"),
- description = "URL of the entity created") }))
- @POST
- @Consumes({ MediaType.APPLICATION_JSON })
- @Produces({ MediaType.APPLICATION_JSON })
- Response create(@NotNull DynRealmTO dynDynRealmTO);
-
- /**
- * Updates the dynamic realm matching the provided key.
- *
- * @param dynDynRealmTO dynamic realm to be stored
- */
- @Parameter(name = "key", description = "DynRealm's key", in = ParameterIn.PATH, schema =
- @Schema(type = "string"))
- @ApiResponses(
- @ApiResponse(responseCode = "204", description = "Operation was successful"))
- @PUT
- @Path("{key}")
- @Consumes({ MediaType.APPLICATION_JSON })
- @Produces({ MediaType.APPLICATION_JSON })
- void update(@NotNull DynRealmTO dynDynRealmTO);
-
- /**
- * Deletes the dynamic realm matching the provided key.
- *
- * @param key dynamic realm key to be deleted
- */
- @ApiResponses(
- @ApiResponse(responseCode = "204", description = "Operation was successful"))
- @DELETE
- @Path("{key}")
- @Produces({ MediaType.APPLICATION_JSON })
- void delete(@NotNull @PathParam("key") String key);
-
-}
diff --git a/core/idrepo/logic/src/main/java/org/apache/syncope/core/logic/DynRealmLogic.java b/core/idrepo/logic/src/main/java/org/apache/syncope/core/logic/DynRealmLogic.java
deleted file mode 100644
index 889a38ddf1..0000000000
--- a/core/idrepo/logic/src/main/java/org/apache/syncope/core/logic/DynRealmLogic.java
+++ /dev/null
@@ -1,108 +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.core.logic;
-
-import java.lang.reflect.Method;
-import java.util.List;
-import org.apache.commons.lang3.ArrayUtils;
-import org.apache.syncope.common.lib.to.DynRealmTO;
-import org.apache.syncope.common.lib.types.IdRepoEntitlement;
-import org.apache.syncope.core.persistence.api.dao.DynRealmDAO;
-import org.apache.syncope.core.persistence.api.dao.NotFoundException;
-import org.apache.syncope.core.persistence.api.entity.DynRealm;
-import org.apache.syncope.core.provisioning.api.data.DynRealmDataBinder;
-import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.transaction.annotation.Transactional;
-
-public class DynRealmLogic extends AbstractTransactionalLogic<DynRealmTO> {
-
- protected final DynRealmDataBinder binder;
-
- protected final DynRealmDAO dynRealmDAO;
-
- public DynRealmLogic(final DynRealmDataBinder binder, final DynRealmDAO dynRealmDAO) {
- this.binder = binder;
- this.dynRealmDAO = dynRealmDAO;
- }
-
- @PreAuthorize("hasRole('" + IdRepoEntitlement.DYNREALM_READ + "')")
- @Transactional(readOnly = true)
- public DynRealmTO read(final String key) {
- DynRealm dynRealm = dynRealmDAO.findById(key).
- orElseThrow(() -> new NotFoundException("DynRealm " + key));
-
- return binder.getDynRealmTO(dynRealm);
- }
-
- @Transactional(readOnly = true)
- public List<DynRealmTO> list() {
- return dynRealmDAO.findAll().stream().map(binder::getDynRealmTO).toList();
- }
-
- @PreAuthorize("hasRole('" + IdRepoEntitlement.DYNREALM_CREATE + "')")
- public DynRealmTO create(final DynRealmTO dynRealmTO) {
- return binder.getDynRealmTO(binder.create(dynRealmTO));
- }
-
- @PreAuthorize("hasRole('" + IdRepoEntitlement.DYNREALM_UPDATE + "')")
- public DynRealmTO update(final DynRealmTO dynRealmTO) {
- DynRealm dynRealm = dynRealmDAO.findById(dynRealmTO.getKey()).
- orElseThrow(() -> new NotFoundException("DynRealm " + dynRealmTO.getKey()));
-
- return binder.getDynRealmTO(binder.update(dynRealm, dynRealmTO));
- }
-
- @PreAuthorize("hasRole('" + IdRepoEntitlement.DYNREALM_DELETE + "')")
- public DynRealmTO delete(final String key) {
- DynRealm dynRealm = dynRealmDAO.findById(key).
- orElseThrow(() -> new NotFoundException("DynRealm " + key));
-
- DynRealmTO deleted = binder.getDynRealmTO(dynRealm);
- dynRealmDAO.deleteById(key);
- return deleted;
- }
-
- @Override
- protected DynRealmTO resolveReference(final Method method, final Object... args)
- throws UnresolvedReferenceException {
-
- String key = null;
-
- if (ArrayUtils.isNotEmpty(args)) {
- for (int i = 0; key == null && i < args.length; i++) {
- if (args[i] instanceof String string) {
- key = string;
- } else if (args[i] instanceof DynRealmTO dynRealmTO) {
- key = dynRealmTO.getKey();
- }
- }
- }
-
- if (key != null) {
- try {
- return binder.getDynRealmTO(dynRealmDAO.findById(key).orElseThrow());
- } catch (Throwable ignore) {
- LOG.debug("Unresolved reference", ignore);
- throw new UnresolvedReferenceException(ignore);
- }
- }
-
- throw new UnresolvedReferenceException();
- }
-}
diff --git a/core/idrepo/logic/src/main/java/org/apache/syncope/core/logic/GroupLogic.java b/core/idrepo/logic/src/main/java/org/apache/syncope/core/logic/GroupLogic.java
index 1acd1039ff..e9b26d2528 100644
--- a/core/idrepo/logic/src/main/java/org/apache/syncope/core/logic/GroupLogic.java
+++ b/core/idrepo/logic/src/main/java/org/apache/syncope/core/logic/GroupLogic.java
@@ -254,12 +254,8 @@ public class GroupLogic extends AbstractAnyLogic<GroupTO, GroupCR, GroupUR> {
before.key().getKey(),
before.key().getRealm());
- List<Group> ownedGroups = groupDAO.findOwnedByGroup(before.key().getKey());
- if (!ownedGroups.isEmpty()) {
- SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.GroupOwnership);
- sce.getElements().addAll(ownedGroups.stream().
- map(g -> g.getKey() + ' ' + g.getName()).toList());
- throw sce;
+ if (groupDAO.isManager(before.key().getKey())) {
+ throw SyncopeClientException.build(ClientExceptionType.Management);
}
List<PropagationStatus> statuses = provisioningManager.delete(
@@ -295,12 +291,10 @@ public class GroupLogic extends AbstractAnyLogic<GroupTO, GroupCR, GroupUR> {
public GroupTO unlink(final String key, final Collection<String> resources) {
GroupTO groupTO = updateChecks(key);
- GroupUR req = new GroupUR.Builder(key).
+ GroupUR req = new GroupUR.Builder(groupTO.getKey()).
resources(resources.stream().
map(r -> new StringPatchItem.Builder().operation(PatchOperation.DELETE).value(r).build()).
toList()).
- udynMembershipCond(groupTO.getUDynMembershipCond()).
- adynMembershipConds(groupTO.getADynMembershipConds()).
build();
return binder.getGroupTO(provisioningManager.unlink(req, AuthContextUtils.getUsername(), REST_CONTEXT));
@@ -311,12 +305,10 @@ public class GroupLogic extends AbstractAnyLogic<GroupTO, GroupCR, GroupUR> {
public GroupTO link(final String key, final Collection<String> resources) {
GroupTO groupTO = updateChecks(key);
- GroupUR req = new GroupUR.Builder(key).
+ GroupUR req = new GroupUR.Builder(groupTO.getKey()).
resources(resources.stream().
map(r -> new StringPatchItem.Builder().operation(PatchOperation.ADD_REPLACE).value(r).build()).
toList()).
- udynMembershipCond(groupTO.getUDynMembershipCond()).
- adynMembershipConds(groupTO.getADynMembershipConds()).
build();
return binder.getGroupTO(provisioningManager.link(req, AuthContextUtils.getUsername(), REST_CONTEXT));
@@ -329,12 +321,10 @@ public class GroupLogic extends AbstractAnyLogic<GroupTO, GroupCR, GroupUR> {
GroupTO groupTO = updateChecks(key);
- GroupUR req = new GroupUR.Builder(key).
+ GroupUR req = new GroupUR.Builder(groupTO.getKey()).
resources(resources.stream().
map(r -> new StringPatchItem.Builder().operation(PatchOperation.DELETE).value(r).build()).
toList()).
- udynMembershipCond(groupTO.getUDynMembershipCond()).
- adynMembershipConds(groupTO.getADynMembershipConds()).
build();
return update(req, nullPriorityAsync);
@@ -351,12 +341,10 @@ public class GroupLogic extends AbstractAnyLogic<GroupTO, GroupCR, GroupUR> {
GroupTO groupTO = updateChecks(key);
- GroupUR req = new GroupUR.Builder(key).
+ GroupUR req = new GroupUR.Builder(groupTO.getKey()).
resources(resources.stream().
map(r -> new StringPatchItem.Builder().operation(PatchOperation.ADD_REPLACE).value(r).build()).
toList()).
- udynMembershipCond(groupTO.getUDynMembershipCond()).
- adynMembershipConds(groupTO.getADynMembershipConds()).
build();
return update(req, nullPriorityAsync);
diff --git a/core/idrepo/logic/src/main/java/org/apache/syncope/core/logic/IdRepoLogicContext.java b/core/idrepo/logic/src/main/java/org/apache/syncope/core/logic/IdRepoLogicContext.java
index 2567396373..da28428c7a 100644
--- a/core/idrepo/logic/src/main/java/org/apache/syncope/core/logic/IdRepoLogicContext.java
+++ b/core/idrepo/logic/src/main/java/org/apache/syncope/core/logic/IdRepoLogicContext.java
@@ -36,7 +36,6 @@ import org.apache.syncope.core.persistence.api.dao.AuditEventDAO;
import org.apache.syncope.core.persistence.api.dao.CASSPClientAppDAO;
import org.apache.syncope.core.persistence.api.dao.DelegationDAO;
import org.apache.syncope.core.persistence.api.dao.DerSchemaDAO;
-import org.apache.syncope.core.persistence.api.dao.DynRealmDAO;
import org.apache.syncope.core.persistence.api.dao.ExternalResourceDAO;
import org.apache.syncope.core.persistence.api.dao.FIQLQueryDAO;
import org.apache.syncope.core.persistence.api.dao.GroupDAO;
@@ -72,7 +71,6 @@ import org.apache.syncope.core.provisioning.api.data.AnyTypeClassDataBinder;
import org.apache.syncope.core.provisioning.api.data.AnyTypeDataBinder;
import org.apache.syncope.core.provisioning.api.data.AuditDataBinder;
import org.apache.syncope.core.provisioning.api.data.DelegationDataBinder;
-import org.apache.syncope.core.provisioning.api.data.DynRealmDataBinder;
import org.apache.syncope.core.provisioning.api.data.FIQLQueryDataBinder;
import org.apache.syncope.core.provisioning.api.data.GroupDataBinder;
import org.apache.syncope.core.provisioning.api.data.ImplementationDataBinder;
@@ -242,15 +240,6 @@ public class IdRepoLogicContext {
return new DelegationLogic(binder, delegationDAO, userDAO);
}
- @ConditionalOnMissingBean
- @Bean
- public DynRealmLogic dynRealmLogic(
- final DynRealmDataBinder binder,
- final DynRealmDAO dynRealmDAO) {
-
- return new DynRealmLogic(binder, dynRealmDAO);
- }
-
@ConditionalOnMissingBean
@Bean
public GroupLogic groupLogic(
diff --git a/core/idrepo/logic/src/main/java/org/apache/syncope/core/logic/RoleLogic.java b/core/idrepo/logic/src/main/java/org/apache/syncope/core/logic/RoleLogic.java
index 1bc3332442..518f08a3b3 100644
--- a/core/idrepo/logic/src/main/java/org/apache/syncope/core/logic/RoleLogic.java
+++ b/core/idrepo/logic/src/main/java/org/apache/syncope/core/logic/RoleLogic.java
@@ -22,9 +22,7 @@ import java.lang.reflect.Method;
import java.util.List;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.StringUtils;
-import org.apache.syncope.common.lib.SyncopeClientException;
import org.apache.syncope.common.lib.to.RoleTO;
-import org.apache.syncope.common.lib.types.ClientExceptionType;
import org.apache.syncope.common.lib.types.IdRepoEntitlement;
import org.apache.syncope.core.persistence.api.dao.NotFoundException;
import org.apache.syncope.core.persistence.api.dao.RoleDAO;
@@ -73,12 +71,6 @@ public class RoleLogic extends AbstractTransactionalLogic<RoleTO> {
@PreAuthorize("hasRole('" + IdRepoEntitlement.ROLE_DELETE + "')")
public RoleTO delete(final String key) {
- if (RoleDAO.GROUP_OWNER_ROLE.equals(key)) {
- SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.InvalidRole);
- sce.getElements().add("This Role cannot be deleted");
- throw sce;
- }
-
Role role = roleDAO.findById(key).orElseThrow(() -> new NotFoundException("Role " + key));
RoleTO deleted = binder.getRoleTO(role);
diff --git a/core/idrepo/logic/src/main/java/org/apache/syncope/core/logic/UserLogic.java b/core/idrepo/logic/src/main/java/org/apache/syncope/core/logic/UserLogic.java
index 87a9fecdac..da968b1a5d 100644
--- a/core/idrepo/logic/src/main/java/org/apache/syncope/core/logic/UserLogic.java
+++ b/core/idrepo/logic/src/main/java/org/apache/syncope/core/logic/UserLogic.java
@@ -63,7 +63,6 @@ import org.apache.syncope.core.persistence.api.dao.search.SearchCond;
import org.apache.syncope.core.persistence.api.entity.Entity;
import org.apache.syncope.core.persistence.api.entity.ExternalResource;
import org.apache.syncope.core.persistence.api.entity.Realm;
-import org.apache.syncope.core.persistence.api.entity.group.Group;
import org.apache.syncope.core.persistence.api.entity.policy.AccountPolicy;
import org.apache.syncope.core.persistence.api.entity.policy.PasswordPolicy;
import org.apache.syncope.core.persistence.api.entity.user.User;
@@ -494,12 +493,8 @@ public class UserLogic extends AbstractAnyLogic<UserTO, UserCR, UserUR> {
groups(before.key()));
}
- List<Group> ownedGroups = groupDAO.findOwnedByUser(before.key().getKey());
- if (!ownedGroups.isEmpty()) {
- SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.GroupOwnership);
- sce.getElements().addAll(ownedGroups.stream().
- map(group -> group.getKey() + ' ' + group.getName()).toList());
- throw sce;
+ if (userDAO.isManager(before.key().getKey())) {
+ throw SyncopeClientException.build(ClientExceptionType.Management);
}
List<PropagationStatus> statuses = provisioningManager.delete(
diff --git a/core/idrepo/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/IdRepoRESTCXFContext.java b/core/idrepo/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/IdRepoRESTCXFContext.java
index 884b1a7736..b27846b3f8 100644
--- a/core/idrepo/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/IdRepoRESTCXFContext.java
+++ b/core/idrepo/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/IdRepoRESTCXFContext.java
@@ -51,7 +51,6 @@ import org.apache.syncope.common.rest.api.service.AnyTypeService;
import org.apache.syncope.common.rest.api.service.AuditService;
import org.apache.syncope.common.rest.api.service.CommandService;
import org.apache.syncope.common.rest.api.service.DelegationService;
-import org.apache.syncope.common.rest.api.service.DynRealmService;
import org.apache.syncope.common.rest.api.service.FIQLQueryService;
import org.apache.syncope.common.rest.api.service.GroupService;
import org.apache.syncope.common.rest.api.service.ImplementationService;
@@ -76,7 +75,6 @@ import org.apache.syncope.core.logic.AnyTypeLogic;
import org.apache.syncope.core.logic.AuditLogic;
import org.apache.syncope.core.logic.CommandLogic;
import org.apache.syncope.core.logic.DelegationLogic;
-import org.apache.syncope.core.logic.DynRealmLogic;
import org.apache.syncope.core.logic.FIQLQueryLogic;
import org.apache.syncope.core.logic.GroupLogic;
import org.apache.syncope.core.logic.ImplementationLogic;
@@ -106,7 +104,6 @@ import org.apache.syncope.core.rest.cxf.service.AnyTypeServiceImpl;
import org.apache.syncope.core.rest.cxf.service.AuditServiceImpl;
import org.apache.syncope.core.rest.cxf.service.CommandServiceImpl;
import org.apache.syncope.core.rest.cxf.service.DelegationServiceImpl;
-import org.apache.syncope.core.rest.cxf.service.DynRealmServiceImpl;
import org.apache.syncope.core.rest.cxf.service.FIQLQueryServiceImpl;
import org.apache.syncope.core.rest.cxf.service.GroupServiceImpl;
import org.apache.syncope.core.rest.cxf.service.ImplementationServiceImpl;
@@ -367,12 +364,6 @@ public class IdRepoRESTCXFContext {
return new DelegationServiceImpl(delegationLogic);
}
- @ConditionalOnMissingBean
- @Bean
- public DynRealmService dynRealmService(final DynRealmLogic dynRealmLogic) {
- return new DynRealmServiceImpl(dynRealmLogic);
- }
-
@ConditionalOnMissingBean
@Bean
public GroupService groupService(final GroupDAO groupDAO, final GroupLogic groupLogic,
diff --git a/core/idrepo/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/DynRealmServiceImpl.java b/core/idrepo/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/DynRealmServiceImpl.java
deleted file mode 100644
index 7a970bddd3..0000000000
--- a/core/idrepo/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/DynRealmServiceImpl.java
+++ /dev/null
@@ -1,66 +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.core.rest.cxf.service;
-
-import jakarta.ws.rs.core.Response;
-import java.net.URI;
-import java.util.List;
-import org.apache.syncope.common.lib.to.DynRealmTO;
-import org.apache.syncope.common.rest.api.RESTHeaders;
-import org.apache.syncope.common.rest.api.service.DynRealmService;
-import org.apache.syncope.core.logic.DynRealmLogic;
-
-public class DynRealmServiceImpl extends AbstractService implements DynRealmService {
-
- protected final DynRealmLogic logic;
-
- public DynRealmServiceImpl(final DynRealmLogic logic) {
- this.logic = logic;
- }
-
- @Override
- public List<DynRealmTO> list() {
- return logic.list();
- }
-
- @Override
- public DynRealmTO read(final String key) {
- return logic.read(key);
- }
-
- @Override
- public Response create(final DynRealmTO roleTO) {
- DynRealmTO created = logic.create(roleTO);
- URI location = uriInfo.getAbsolutePathBuilder().path(created.getKey()).build();
- return Response.created(location).
- header(RESTHeaders.RESOURCE_KEY, created.getKey()).
- build();
- }
-
- @Override
- public void update(final DynRealmTO roleTO) {
- logic.update(roleTO);
- }
-
- @Override
- public void delete(final String key) {
- logic.delete(key);
- }
-
-}
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/AnyDAO.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/AnyDAO.java
index 038c318c7d..c0fc074c7b 100644
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/AnyDAO.java
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/AnyDAO.java
@@ -71,8 +71,6 @@ public interface AnyDAO<A extends Any> extends DAO<A> {
<S extends Schema> AllowedSchemas<S> findAllowedSchemas(A any, Class<S> reference);
- List<String> findDynRealms(String key);
-
Collection<String> findAllResourceKeys(String key);
void deleteRelationship(Relationship<? extends A, AnyObject> relationship);
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/AnyObjectDAO.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/AnyObjectDAO.java
index 681e74239c..1483adc78f 100644
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/AnyObjectDAO.java
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/AnyObjectDAO.java
@@ -61,8 +61,6 @@ public interface AnyObjectDAO extends AnyDAO<AnyObject> {
void deleteMembership(AMembership membership);
- List<Group> findDynGroups(String key);
-
List<Relationship<Any, AnyObject>> findAllRelationships(AnyObject anyObject);
Collection<Group> findAllGroups(AnyObject anyObject);
@@ -70,6 +68,4 @@ public interface AnyObjectDAO extends AnyDAO<AnyObject> {
Collection<String> findAllGroupKeys(AnyObject anyObject);
Collection<ExternalResource> findAllResources(AnyObject anyObject);
-
- GroupDAO.DynMembershipInfo saveAndGetDynGroupMembs(AnyObject anyObject);
}
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/DynRealmDAO.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/DynRealmDAO.java
deleted file mode 100644
index e49f88b769..0000000000
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/DynRealmDAO.java
+++ /dev/null
@@ -1,31 +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.core.persistence.api.dao;
-
-import org.apache.syncope.core.persistence.api.entity.Any;
-import org.apache.syncope.core.persistence.api.entity.DynRealm;
-
-public interface DynRealmDAO extends DAO<DynRealm> {
-
- DynRealm saveAndRefreshDynMemberships(DynRealm dynRealm);
-
- void refreshDynMemberships(Any any);
-
- void removeDynMemberships(String anyKey);
-}
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/GroupDAO.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/GroupDAO.java
index 4970ba7b8d..c92aa39317 100644
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/GroupDAO.java
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/GroupDAO.java
@@ -34,10 +34,6 @@ import org.springframework.data.domain.Pageable;
public interface GroupDAO extends AnyDAO<Group> {
- record DynMembershipInfo(Set<String> before, Set<String> after) {
-
- }
-
Optional<String> findKey(String name);
Optional<? extends Group> findByName(String name);
@@ -55,13 +51,17 @@ public interface GroupDAO extends AnyDAO<Group> {
*/
void securityChecks(Set<String> authRealms, String key, String realm);
- Map<String, Long> countByRealm();
+ boolean isManager(String key);
- List<String> findKeysByNamePattern(String pattern);
+ List<User> findManagedUsers(String key);
- List<Group> findOwnedByUser(String userKey);
+ List<Group> findManagedGroups(String key);
- List<Group> findOwnedByGroup(String groupKey);
+ List<AnyObject> findManagedAnyObjects(String key);
+
+ Map<String, Long> countByRealm();
+
+ List<String> findKeysByNamePattern(String pattern);
List<AMembership> findAMemberships(Group group);
@@ -75,61 +75,9 @@ public interface GroupDAO extends AnyDAO<Group> {
boolean existsUMembership(String userKey, String groupKey);
- List<String> findADynMembers(Group group);
-
- List<String> findUDynMembers(Group group);
-
long countAMembers(String groupKey);
long countUMembers(String groupKey);
- long countADynMembers(Group group);
-
- long countUDynMembers(Group group);
-
- void clearADynMembers(Group group);
-
- void clearUDynMembers(Group group);
-
- /**
- * Evaluates all the dynamic group membership conditions against the given anyObject (invoked during save).
- *
- * @param anyObject anyObject being saved
- * @return pair of groups dynamically assigned before and after refresh
- */
- DynMembershipInfo refreshDynMemberships(AnyObject anyObject);
-
- /**
- * Evaluates all the dynamic group membership conditions against the given user (invoked during save).
- *
- * @param user user being saved
- * @return pair of groups dynamically assigned before and after refresh
- */
- DynMembershipInfo refreshDynMemberships(User user);
-
- /**
- * Removes the dynamic group memberships of the given anyObject (invoked during delete).
- *
- * @param anyObject anyObject being deleted
- * @return groups dynamically assigned before refresh
- */
- Set<String> removeDynMemberships(AnyObject anyObject);
-
- /**
- * Removes the dynamic group memberships of the given user (invoked during delete).
- *
- * @param user user being deleted
- * @return groups dynamically assigned before refresh
- */
- Set<String> removeDynMemberships(User user);
-
- /**
- * Saves the provided group and refreshes all User and AnyObject members.
- *
- * @param group group to save
- * @return merged group
- */
- Group saveAndRefreshDynMemberships(Group group);
-
List<GroupTypeExtension> findTypeExtensions(AnyTypeClass anyTypeClass);
}
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/RoleDAO.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/RoleDAO.java
index b3ba4087ac..9d4e064900 100644
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/RoleDAO.java
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/RoleDAO.java
@@ -21,21 +21,8 @@ package org.apache.syncope.core.persistence.api.dao;
import java.util.List;
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.user.User;
public interface RoleDAO extends DAO<Role> {
- String GROUP_OWNER_ROLE = "GROUP_OWNER";
-
List<Role> findByRealms(Realm realm);
-
- Role saveAndRefreshDynMemberships(Role role);
-
- List<String> findDynMembers(Role role);
-
- void clearDynMembers(Role role);
-
- void refreshDynMemberships(User user);
-
- void removeDynMemberships(String key);
}
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/UserDAO.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/UserDAO.java
index 540c72f80f..38adb15061 100644
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/UserDAO.java
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/UserDAO.java
@@ -25,6 +25,7 @@ import java.util.Optional;
import java.util.Set;
import org.apache.syncope.core.persistence.api.entity.ExternalResource;
import org.apache.syncope.core.persistence.api.entity.Role;
+import org.apache.syncope.core.persistence.api.entity.anyobject.AnyObject;
import org.apache.syncope.core.persistence.api.entity.group.Group;
import org.apache.syncope.core.persistence.api.entity.user.LinkedAccount;
import org.apache.syncope.core.persistence.api.entity.user.SecurityQuestion;
@@ -48,6 +49,14 @@ public interface UserDAO extends AnyDAO<User> {
*/
void securityChecks(Set<String> authRealms, String key, String realm, Collection<String> groups);
+ boolean isManager(String key);
+
+ List<User> findManagedUsers(String key);
+
+ List<Group> findManagedGroups(String key);
+
+ List<AnyObject> findManagedAnyObjects(String key);
+
Map<String, Long> countByRealm();
Map<String, Long> countByStatus();
@@ -60,12 +69,8 @@ public interface UserDAO extends AnyDAO<User> {
void deleteMembership(UMembership membership);
- List<Role> findDynRoles(String key);
-
Collection<Role> findAllRoles(User user);
- List<Group> findDynGroups(String key);
-
Collection<Group> findAllGroups(User user);
Collection<String> findAllGroupKeys(User user);
@@ -81,6 +86,4 @@ public interface UserDAO extends AnyDAO<User> {
List<LinkedAccount> findLinkedAccounts(String userKey);
List<LinkedAccount> findLinkedAccountsByResource(ExternalResource resource);
-
- GroupDAO.DynMembershipInfo saveAndGetDynGroupMembs(User user);
}
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/search/DynRealmCond.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/search/DynRealmCond.java
deleted file mode 100644
index 20057f8c3e..0000000000
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/search/DynRealmCond.java
+++ /dev/null
@@ -1,74 +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.core.persistence.api.dao.search;
-
-import org.apache.commons.lang3.builder.EqualsBuilder;
-import org.apache.commons.lang3.builder.HashCodeBuilder;
-import org.apache.commons.lang3.builder.ToStringBuilder;
-
-public class DynRealmCond extends AbstractSearchCond {
-
- private static final long serialVersionUID = 9110213614796095482L;
-
- private String dynRealm;
-
- public String getDynRealm() {
- return dynRealm;
- }
-
- public void setDynRealm(final String dynRealm) {
- this.dynRealm = dynRealm;
- }
-
- @Override
- public final boolean isValid() {
- return dynRealm != null;
- }
-
- @Override
- public int hashCode() {
- return new HashCodeBuilder().
- append(dynRealm).
- build();
- }
-
- @Override
- public boolean equals(final Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
- final DynRealmCond other = (DynRealmCond) obj;
- return new EqualsBuilder().
- append(dynRealm, other.dynRealm).
- build();
- }
-
- @Override
- public String toString() {
- return new ToStringBuilder(this).
- append(dynRealm).
- build();
- }
-}
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/Any.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/Any.java
index 5147ae8090..3e6e8c4150 100644
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/Any.java
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/Any.java
@@ -20,6 +20,8 @@ package org.apache.syncope.core.persistence.api.entity;
import java.time.OffsetDateTime;
import java.util.List;
+import org.apache.syncope.core.persistence.api.entity.group.Group;
+import org.apache.syncope.core.persistence.api.entity.user.User;
public interface Any extends Attributable, Entity {
@@ -55,6 +57,14 @@ public interface Any extends Attributable, Entity {
void setRealm(Realm realm);
+ User getUManager();
+
+ void setUManager(User manager);
+
+ Group getGManager();
+
+ void setGManager(Group manager);
+
String getStatus();
void setStatus(String status);
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/DynGroupMembership.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/DynGroupMembership.java
deleted file mode 100644
index 58c6cb96e2..0000000000
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/DynGroupMembership.java
+++ /dev/null
@@ -1,28 +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.core.persistence.api.entity;
-
-import org.apache.syncope.core.persistence.api.entity.group.Group;
-
-public interface DynGroupMembership<A extends Any> extends DynMembership<A> {
-
- Group getGroup();
-
- void setGroup(Group group);
-}
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/DynMembership.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/DynMembership.java
deleted file mode 100644
index 0334322808..0000000000
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/DynMembership.java
+++ /dev/null
@@ -1,26 +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.core.persistence.api.entity;
-
-public interface DynMembership<A extends Any> extends Entity {
-
- String getFIQLCond();
-
- void setFIQLCond(String fiql);
-}
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/DynRealm.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/DynRealm.java
deleted file mode 100644
index 711d251970..0000000000
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/DynRealm.java
+++ /dev/null
@@ -1,32 +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.core.persistence.api.entity;
-
-import java.util.List;
-import java.util.Optional;
-
-public interface DynRealm extends ProvidedKeyEntity {
-
- boolean add(DynRealmMembership dynRealmMembership);
-
- Optional<? extends DynRealmMembership> getDynMembership(AnyType anyType);
-
- List<? extends DynRealmMembership> getDynMemberships();
-
-}
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/DynRealmMembership.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/DynRealmMembership.java
deleted file mode 100644
index 90a5d0a41b..0000000000
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/DynRealmMembership.java
+++ /dev/null
@@ -1,31 +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.core.persistence.api.entity;
-
-public interface DynRealmMembership extends DynMembership<Any> {
-
- DynRealm getDynRealm();
-
- void setDynRealm(DynRealm dynRealm);
-
- AnyType getAnyType();
-
- void setAnyType(AnyType anyType);
-
-}
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/Role.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/Role.java
index 4191c00a60..73f89b74fb 100644
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/Role.java
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/Role.java
@@ -29,14 +29,6 @@ public interface Role extends ProvidedKeyEntity {
List<? extends Realm> getRealms();
- boolean add(DynRealm dynRealm);
-
- List<? extends DynRealm> getDynRealms();
-
- String getDynMembershipCond();
-
- void setDynMembershipCond(String dynMembershipCond);
-
String getAnyLayout();
void setAnyLayout(String anyLayout);
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/anyobject/ADynGroupMembership.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/anyobject/ADynGroupMembership.java
deleted file mode 100644
index 19723cf887..0000000000
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/anyobject/ADynGroupMembership.java
+++ /dev/null
@@ -1,29 +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.core.persistence.api.entity.anyobject;
-
-import org.apache.syncope.core.persistence.api.entity.AnyType;
-import org.apache.syncope.core.persistence.api.entity.DynGroupMembership;
-
-public interface ADynGroupMembership extends DynGroupMembership<AnyObject> {
-
- AnyType getAnyType();
-
- void setAnyType(AnyType anyType);
-}
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/group/Group.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/group/Group.java
index d2a9a79ef5..ef4346cb54 100644
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/group/Group.java
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/group/Group.java
@@ -22,9 +22,6 @@ import java.util.List;
import java.util.Optional;
import org.apache.syncope.core.persistence.api.entity.AnyType;
import org.apache.syncope.core.persistence.api.entity.Relatable;
-import org.apache.syncope.core.persistence.api.entity.anyobject.ADynGroupMembership;
-import org.apache.syncope.core.persistence.api.entity.user.UDynGroupMembership;
-import org.apache.syncope.core.persistence.api.entity.user.User;
public interface Group extends Relatable<Group, GRelationship> {
@@ -32,24 +29,6 @@ public interface Group extends Relatable<Group, GRelationship> {
void setName(String name);
- Group getGroupOwner();
-
- User getUserOwner();
-
- void setGroupOwner(Group groupOwner);
-
- void setUserOwner(User userOwner);
-
- UDynGroupMembership getUDynMembership();
-
- void setUDynMembership(UDynGroupMembership uDynMembership);
-
- boolean add(ADynGroupMembership dynGroupMembership);
-
- Optional<? extends ADynGroupMembership> getADynMembership(AnyType anyType);
-
- List<? extends ADynGroupMembership> getADynMemberships();
-
boolean add(GroupTypeExtension typeExtension);
Optional<? extends GroupTypeExtension> getTypeExtension(AnyType anyType);
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/user/UDynGroupMembership.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/user/UDynGroupMembership.java
deleted file mode 100644
index efec3f17dc..0000000000
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/user/UDynGroupMembership.java
+++ /dev/null
@@ -1,25 +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.core.persistence.api.entity.user;
-
-import org.apache.syncope.core.persistence.api.entity.DynGroupMembership;
-
-public interface UDynGroupMembership extends DynGroupMembership<User> {
-
-}
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/search/SearchCondVisitor.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/search/SearchCondVisitor.java
index e5f3f32797..2f1a5adfae 100644
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/search/SearchCondVisitor.java
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/search/SearchCondVisitor.java
@@ -36,7 +36,6 @@ import org.apache.syncope.core.persistence.api.dao.search.AnyCond;
import org.apache.syncope.core.persistence.api.dao.search.AnyTypeCond;
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.DynRealmCond;
import org.apache.syncope.core.persistence.api.dao.search.MemberCond;
import org.apache.syncope.core.persistence.api.dao.search.MembershipCond;
import org.apache.syncope.core.persistence.api.dao.search.RelationshipCond;
@@ -178,12 +177,6 @@ public class SearchCondVisitor extends AbstractSearchConditionVisitor<SearchBean
leaf = SearchCond.of(roleCond);
break;
- case DYNREALMS:
- DynRealmCond dynRealmCond = new DynRealmCond();
- dynRealmCond.setDynRealm(value);
- leaf = SearchCond.of(dynRealmCond);
- break;
-
case MEMBER:
MemberCond memberCond = new MemberCond();
memberCond.setMember(value);
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/utils/RealmUtils.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/utils/RealmUtils.java
index cf28cf5838..2c450abba3 100644
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/utils/RealmUtils.java
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/utils/RealmUtils.java
@@ -30,22 +30,22 @@ import java.util.Set;
import java.util.function.Predicate;
import java.util.stream.Collectors;
import org.apache.commons.lang3.ClassUtils;
-import org.apache.syncope.common.lib.SyncopeConstants;
+import org.apache.syncope.common.lib.types.AnyTypeKind;
import org.apache.syncope.core.persistence.api.entity.EntityFactory;
public class RealmUtils {
- public record GroupOwnerRealm(String realmPath, String groupKey) {
+ public record ManagerRealm(String realmPath, AnyTypeKind kind, String anyKey) {
- public static Optional<GroupOwnerRealm> of(final String input) {
+ public static Optional<ManagerRealm> of(final String input) {
String[] split = input.split("@");
- return split == null || split.length < 2
+ return split == null || split.length < 3
? Optional.empty()
- : Optional.of(new GroupOwnerRealm(split[0], split[1]));
+ : Optional.of(new ManagerRealm(split[0], AnyTypeKind.valueOf(split[1]), split[2]));
}
public String output() {
- return realmPath + '@' + groupKey;
+ return realmPath + '@' + kind + '@' + anyKey;
}
}
@@ -67,22 +67,22 @@ public class RealmUtils {
return !dontAdd;
}
- public record NormalizedRealms(Set<String> realms, Set<String> groupOwnerRealms) {
+ public record NormalizedRealms(Set<String> realms, Set<String> managerRealms) {
public static NormalizedRealms of(final Collection<String> input) {
Set<String> realms = new HashSet<>();
- Set<String> groupOwnerRealms = new HashSet<>();
+ Set<String> managerRealms = new HashSet<>();
if (input != null) {
input.forEach(realm -> {
if (realm.indexOf('@') == -1) {
normalizingAddTo(realms, realm);
} else {
- groupOwnerRealms.add(realm);
+ managerRealms.add(realm);
}
});
}
- return new NormalizedRealms(realms, groupOwnerRealms);
+ return new NormalizedRealms(realms, managerRealms);
}
}
@@ -100,8 +100,6 @@ public class RealmUtils {
}
}
- private static final Predicate<String> DYN_REALMS_PREDICATE = r -> !r.startsWith(SyncopeConstants.ROOT_REALM);
-
public static Set<String> getEffective(final Set<String> allowedRealms, final String requestedRealm) {
NormalizedRealms normalized = NormalizedRealms.of(allowedRealms);
@@ -114,13 +112,8 @@ public class RealmUtils {
effective.addAll(requested.stream().filter(normalizedFilter).collect(Collectors.toSet()));
effective.addAll(normalized.realms().stream().filter(requestedFilter).collect(Collectors.toSet()));
- // includes group ownership
- effective.addAll(normalized.groupOwnerRealms());
-
- // includes dynamic realms
- if (allowedRealms != null) {
- effective.addAll(allowedRealms.stream().filter(DYN_REALMS_PREDICATE).collect(Collectors.toSet()));
- }
+ // includes manager
+ effective.addAll(normalized.managerRealms());
return effective;
}
diff --git a/core/persistence-api/src/test/java/org/apache/syncope/core/persistence/api/search/FilterConverterTest.java b/core/persistence-api/src/test/java/org/apache/syncope/core/persistence/api/search/FilterConverterTest.java
index eee355e6cc..9de775ef00 100644
--- a/core/persistence-api/src/test/java/org/apache/syncope/core/persistence/api/search/FilterConverterTest.java
+++ b/core/persistence-api/src/test/java/org/apache/syncope/core/persistence/api/search/FilterConverterTest.java
@@ -172,26 +172,6 @@ public class FilterConverterTest {
assertTrue(equals(filter, FilterConverter.convert(fiql)));
}
- @Test
- public void inDynRealms() {
- try {
- FilterConverter.convert(SpecialAttr.DYNREALMS + "==realm");
- fail();
- } catch (SyncopeClientException e) {
- assertEquals(ClientExceptionType.InvalidSearchParameters, e.getType());
- }
- }
-
- @Test
- public void notInDynRealms() {
- try {
- FilterConverter.convert(SpecialAttr.DYNREALMS + "!=realm");
- fail();
- } catch (SyncopeClientException e) {
- assertEquals(ClientExceptionType.InvalidSearchParameters, e.getType());
- }
- }
-
@Test
public void hasAuxClasses() {
try {
diff --git a/core/persistence-api/src/test/java/org/apache/syncope/core/persistence/api/search/SearchCondConverterTest.java b/core/persistence-api/src/test/java/org/apache/syncope/core/persistence/api/search/SearchCondConverterTest.java
index 6cb723c0cb..34dc473efc 100644
--- a/core/persistence-api/src/test/java/org/apache/syncope/core/persistence/api/search/SearchCondConverterTest.java
+++ b/core/persistence-api/src/test/java/org/apache/syncope/core/persistence/api/search/SearchCondConverterTest.java
@@ -20,7 +20,6 @@ package org.apache.syncope.core.persistence.api.search;
import static org.junit.jupiter.api.Assertions.assertEquals;
-import java.util.UUID;
import org.apache.syncope.common.lib.search.AnyObjectFiqlSearchConditionBuilder;
import org.apache.syncope.common.lib.search.GroupFiqlSearchConditionBuilder;
import org.apache.syncope.common.lib.search.SpecialAttr;
@@ -29,7 +28,6 @@ import org.apache.syncope.core.persistence.api.dao.search.AnyCond;
import org.apache.syncope.core.persistence.api.dao.search.AnyTypeCond;
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.DynRealmCond;
import org.apache.syncope.core.persistence.api.dao.search.MemberCond;
import org.apache.syncope.core.persistence.api.dao.search.MembershipCond;
import org.apache.syncope.core.persistence.api.dao.search.RelationshipCond;
@@ -200,19 +198,6 @@ public class SearchCondConverterTest {
assertEquals(leaf, SearchCondConverter.convert(VISITOR, fiql));
}
- @Test
- public void dynRealms() {
- String dynRealm = UUID.randomUUID().toString();
- String fiql = new UserFiqlSearchConditionBuilder().inDynRealms(dynRealm).query();
- assertEquals(SpecialAttr.DYNREALMS + "==" + dynRealm, fiql);
-
- DynRealmCond dynRealmCond = new DynRealmCond();
- dynRealmCond.setDynRealm(dynRealm);
- SearchCond leaf = SearchCond.of(dynRealmCond);
-
- assertEquals(leaf, SearchCondConverter.convert(VISITOR, fiql));
- }
-
@Test
public void auxClasses() {
String fiql = new UserFiqlSearchConditionBuilder().hasAuxClasses("clazz1").query();
diff --git a/core/persistence-api/src/test/java/org/apache/syncope/core/persistence/api/utils/RealmUtilsTest.java b/core/persistence-api/src/test/java/org/apache/syncope/core/persistence/api/utils/RealmUtilsTest.java
index 8e29befdba..2e9ce5ea51 100644
--- a/core/persistence-api/src/test/java/org/apache/syncope/core/persistence/api/utils/RealmUtilsTest.java
+++ b/core/persistence-api/src/test/java/org/apache/syncope/core/persistence/api/utils/RealmUtilsTest.java
@@ -25,23 +25,26 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.HashSet;
import java.util.Optional;
import java.util.Set;
+import org.apache.syncope.common.lib.types.AnyTypeKind;
import org.junit.jupiter.api.Test;
public class RealmUtilsTest extends AbstractTest {
@Test
- public void getGroupOwnerRealm() {
+ public void getManagerRealm() {
String realmPath = "realmPath";
String groupKey = "groupKey";
- assertEquals(realmPath + "@" + groupKey, new RealmUtils.GroupOwnerRealm(realmPath, groupKey).output());
+ assertEquals(
+ realmPath + "@GROUP@" + groupKey,
+ new RealmUtils.ManagerRealm(realmPath, AnyTypeKind.GROUP, groupKey).output());
}
@Test
public void parseGroupOwnerRealm() {
assertEquals(
- Optional.of(new RealmUtils.GroupOwnerRealm("realmPath", "groupKey")),
- RealmUtils.GroupOwnerRealm.of("realmPath@groupKey"));
- assertFalse(RealmUtils.GroupOwnerRealm.of("realmPath").isPresent());
+ Optional.of(new RealmUtils.ManagerRealm("realmPath", AnyTypeKind.GROUP, "groupKey")),
+ RealmUtils.ManagerRealm.of("realmPath@GROUP@groupKey"));
+ assertFalse(RealmUtils.ManagerRealm.of("realmPath").isPresent());
}
@Test
@@ -63,13 +66,12 @@ public class RealmUtilsTest extends AbstractTest {
@Test
public void getEffective() {
- Set<String> allowedRealms = new HashSet<>();
- String requestedRealm = "requestedRealm";
- allowedRealms.add("testRealm1");
- allowedRealms.add("testRealm2");
- allowedRealms.add("testRealm3");
- allowedRealms.add("requestedRealm");
- Set<String> effective = RealmUtils.getEffective(allowedRealms, requestedRealm);
+ Set<String> allowedRealms = Set.of(
+ "testRealm1@k1",
+ "testRealm2@k2",
+ "testRealm3@k3",
+ "requestedRealm");
+ Set<String> effective = RealmUtils.getEffective(allowedRealms, "requestedRealm");
assertEquals(allowedRealms, effective);
}
}
diff --git a/core/persistence-common/src/main/java/org/apache/syncope/core/persistence/common/dao/AbstractAnyMatchDAO.java b/core/persistence-common/src/main/java/org/apache/syncope/core/persistence/common/dao/AbstractAnyMatchDAO.java
index c0471cd262..7b19f5e6c4 100644
--- a/core/persistence-common/src/main/java/org/apache/syncope/core/persistence/common/dao/AbstractAnyMatchDAO.java
+++ b/core/persistence-common/src/main/java/org/apache/syncope/core/persistence/common/dao/AbstractAnyMatchDAO.java
@@ -45,7 +45,6 @@ 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.AnyTypeCond;
import org.apache.syncope.core.persistence.api.dao.search.AttrCond;
-import org.apache.syncope.core.persistence.api.dao.search.DynRealmCond;
import org.apache.syncope.core.persistence.api.dao.search.MemberCond;
import org.apache.syncope.core.persistence.api.dao.search.MembershipCond;
import org.apache.syncope.core.persistence.api.dao.search.RelationshipCond;
@@ -157,12 +156,6 @@ public abstract class AbstractAnyMatchDAO implements AnyMatchDAO {
orElse(null);
}
- if (match == null) {
- match = cond.asLeaf(DynRealmCond.class).
- map(leaf -> matches(any, leaf, not)).
- orElse(null);
- }
-
if (match == null) {
match = cond.asLeaf(MemberCond.class).
filter(leaf -> any instanceof Group).
@@ -244,11 +237,7 @@ public abstract class AbstractAnyMatchDAO implements AnyMatchDAO {
: groupDAO.findKey(cond.getGroup()).
orElseThrow(() -> new NotFoundException("Group " + cond.getGroup()));
- boolean found = any.getMembership(group).isPresent()
- || (any instanceof User
- ? userDAO.findDynGroups(any.getKey())
- : anyObjectDAO.findDynGroups(any.getKey())).stream().
- anyMatch(item -> item.getKey().equals(group));
+ boolean found = any.getMembership(group).isPresent();
return not ? !found : found;
}
@@ -257,12 +246,6 @@ public abstract class AbstractAnyMatchDAO implements AnyMatchDAO {
return not ? !found : found;
}
- protected boolean matches(final Any any, final DynRealmCond cond, final boolean not) {
- boolean found = anyUtilsFactory.getInstance(any).dao().findDynRealms(any.getKey()).stream().
- anyMatch(dynRealm -> dynRealm.equals(cond.getDynRealm()));
- return not ? !found : found;
- }
-
protected boolean matches(final Group group, final MemberCond cond, final boolean not) {
boolean found = false;
@@ -271,13 +254,11 @@ public abstract class AbstractAnyMatchDAO implements AnyMatchDAO {
any = anyObjectDAO.findById(cond.getMember()).orElse(null);
if (any != null) {
found = groupDAO.findAMemberships(group).stream().
- anyMatch(memb -> memb.getLeftEnd().getKey().equals(cond.getMember()))
- || groupDAO.findADynMembers(group).contains(cond.getMember());
+ anyMatch(memb -> memb.getLeftEnd().getKey().equals(cond.getMember()));
}
} else {
found = groupDAO.findUMemberships(group, Pageable.unpaged()).stream().
- anyMatch(memb -> memb.getLeftEnd().getKey().equals(cond.getMember()))
- || groupDAO.findUDynMembers(group).contains(cond.getMember());
+ anyMatch(memb -> memb.getLeftEnd().getKey().equals(cond.getMember()));
}
return not ? !found : found;
diff --git a/core/persistence-common/src/main/java/org/apache/syncope/core/persistence/common/dao/AbstractAnySearchDAO.java b/core/persistence-common/src/main/java/org/apache/syncope/core/persistence/common/dao/AbstractAnySearchDAO.java
index c3c1d89e35..da73786c60 100644
--- a/core/persistence-common/src/main/java/org/apache/syncope/core/persistence/common/dao/AbstractAnySearchDAO.java
+++ b/core/persistence-common/src/main/java/org/apache/syncope/core/persistence/common/dao/AbstractAnySearchDAO.java
@@ -29,21 +29,20 @@ import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
import org.apache.commons.lang3.ArrayUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.lang3.tuple.Pair;
import org.apache.syncope.common.lib.SyncopeConstants;
import org.apache.syncope.common.lib.types.AnyTypeKind;
import org.apache.syncope.common.lib.types.AttrSchemaType;
import org.apache.syncope.core.persistence.api.attrvalue.PlainAttrValidationManager;
import org.apache.syncope.core.persistence.api.dao.AnyObjectDAO;
import org.apache.syncope.core.persistence.api.dao.AnySearchDAO;
-import org.apache.syncope.core.persistence.api.dao.DynRealmDAO;
import org.apache.syncope.core.persistence.api.dao.GroupDAO;
import org.apache.syncope.core.persistence.api.dao.PlainSchemaDAO;
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.AbstractSearchCond;
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.DynRealmCond;
import org.apache.syncope.core.persistence.api.dao.search.MemberCond;
import org.apache.syncope.core.persistence.api.dao.search.MembershipCond;
import org.apache.syncope.core.persistence.api.dao.search.RelationshipCond;
@@ -77,42 +76,31 @@ public abstract class AbstractAnySearchDAO implements AnySearchDAO {
"serialVersionUID", "password", "securityQuestion", "securityAnswer", "token", "tokenExpireTime"
};
- protected static final String[] RELATIONSHIP_FIELDS = { "realm", "userOwner", "groupOwner" };
+ protected static final String[] RELATIONSHIP_FIELDS = { "realm", "uManager", "gManager" };
protected static SearchCond buildEffectiveCond(
final SearchCond cond,
- final Set<String> dynRealmKeys,
- final Set<String> groupOwners,
+ final Set<Pair<AnyTypeKind, String>> managed,
final AnyTypeKind kind) {
List<SearchCond> result = new ArrayList<>();
result.add(cond);
- List<SearchCond> dynRealmConds = dynRealmKeys.stream().map(key -> {
- DynRealmCond dynRealmCond = new DynRealmCond();
- dynRealmCond.setDynRealm(key);
- return SearchCond.of(dynRealmCond);
- }).toList();
- if (!dynRealmConds.isEmpty()) {
- result.add(SearchCond.or(dynRealmConds));
- }
-
- List<SearchCond> groupOwnerConds = groupOwners.stream().map(key -> {
- AbstractSearchCond asc;
- if (kind == AnyTypeKind.GROUP) {
+ List<SearchCond> managerConds = new ArrayList<>();
+ managed.forEach(pair -> {
+ if (kind == pair.getLeft()) {
AnyCond anyCond = new AnyCond(AttrCond.Type.EQ);
anyCond.setSchema("id");
- anyCond.setExpression(key);
- asc = anyCond;
- } else {
+ anyCond.setExpression(pair.getRight());
+ managerConds.add(SearchCond.of(anyCond));
+ } else if (pair.getLeft() == AnyTypeKind.GROUP) {
MembershipCond membershipCond = new MembershipCond();
- membershipCond.setGroup(key);
- asc = membershipCond;
+ membershipCond.setGroup(pair.getRight());
+ managerConds.add(SearchCond.of(membershipCond));
}
- return SearchCond.of(asc);
- }).toList();
- if (!groupOwnerConds.isEmpty()) {
- result.add(SearchCond.or(groupOwnerConds));
+ });
+ if (!managerConds.isEmpty()) {
+ result.add(SearchCond.or(managerConds));
}
return SearchCond.and(result);
@@ -150,8 +138,6 @@ public abstract class AbstractAnySearchDAO implements AnySearchDAO {
protected final RealmSearchDAO realmSearchDAO;
- protected final DynRealmDAO dynRealmDAO;
-
protected final UserDAO userDAO;
protected final GroupDAO groupDAO;
@@ -168,7 +154,6 @@ public abstract class AbstractAnySearchDAO implements AnySearchDAO {
public AbstractAnySearchDAO(
final RealmSearchDAO realmSearchDAO,
- final DynRealmDAO dynRealmDAO,
final UserDAO userDAO,
final GroupDAO groupDAO,
final AnyObjectDAO anyObjectDAO,
@@ -178,7 +163,6 @@ public abstract class AbstractAnySearchDAO implements AnySearchDAO {
final PlainAttrValidationManager validator) {
this.realmSearchDAO = realmSearchDAO;
- this.dynRealmDAO = dynRealmDAO;
this.userDAO = userDAO;
this.groupDAO = groupDAO;
this.anyObjectDAO = anyObjectDAO;
@@ -310,6 +294,19 @@ public abstract class AbstractAnySearchDAO implements AnySearchDAO {
if (ArrayUtils.contains(RELATIONSHIP_FIELDS, computed.getSchema())) {
computed.setSchema(computed.getSchema() + "_id");
schema.setType(AttrSchemaType.String);
+
+ if (!SyncopeConstants.UUID_PATTERN.matcher(computed.getExpression()).matches()) {
+ switch (StringUtils.substringBefore(computed.getSchema(), "_id")) {
+ case "uManager" ->
+ userDAO.findKey(computed.getExpression()).ifPresent(computed::setExpression);
+
+ case "gManager" ->
+ groupDAO.findKey(computed.getExpression()).ifPresent(computed::setExpression);
+
+ default -> {
+ }
+ }
+ }
}
PlainAttrValue attrValue = new PlainAttrValue();
diff --git a/core/persistence-common/src/main/java/org/apache/syncope/core/persistence/common/validation/AnyValidator.java b/core/persistence-common/src/main/java/org/apache/syncope/core/persistence/common/validation/AnyValidator.java
index 766f6fcca8..9471252245 100644
--- a/core/persistence-common/src/main/java/org/apache/syncope/core/persistence/common/validation/AnyValidator.java
+++ b/core/persistence-common/src/main/java/org/apache/syncope/core/persistence/common/validation/AnyValidator.java
@@ -38,6 +38,14 @@ public class AnyValidator extends AbstractValidator<AnyCheck, Any> {
public boolean isValid(final Any any, final ConstraintValidatorContext context) {
context.disableDefaultConstraintViolation();
+ if (any.getUManager() != null && any.getGManager() != null) {
+ context.buildConstraintViolationWithTemplate(
+ getTemplate(EntityViolationType.InvalidManager,
+ "Must either be managed by an user or by a group, not both")).
+ addPropertyNode("manager").addConstraintViolation();
+ return false;
+ }
+
AllowedSchemas<PlainSchema> allowedPlainSchemas =
ApplicationContextProvider.getApplicationContext().getBean(AnyUtilsFactory.class).
getInstance(any.getType().getKind()).dao().findAllowedSchemas(any, PlainSchema.class);
diff --git a/core/persistence-common/src/main/java/org/apache/syncope/core/persistence/common/validation/DynRealmCheck.java b/core/persistence-common/src/main/java/org/apache/syncope/core/persistence/common/validation/DynRealmCheck.java
deleted file mode 100644
index 9f3beb0e7c..0000000000
--- a/core/persistence-common/src/main/java/org/apache/syncope/core/persistence/common/validation/DynRealmCheck.java
+++ /dev/null
@@ -1,40 +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.core.persistence.common.validation;
-
-import jakarta.validation.Constraint;
-import jakarta.validation.Payload;
-import java.lang.annotation.Documented;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-@Target({ ElementType.TYPE })
-@Retention(RetentionPolicy.RUNTIME)
-@Constraint(validatedBy = DynRealmValidator.class)
-@Documented
-public @interface DynRealmCheck {
-
- String message() default "{org.apache.syncope.core.persistence.validation.dynrealm}";
-
- Class<?>[] groups() default {};
-
- Class<? extends Payload>[] payload() default {};
-}
diff --git a/core/persistence-common/src/main/java/org/apache/syncope/core/persistence/common/validation/DynRealmValidator.java b/core/persistence-common/src/main/java/org/apache/syncope/core/persistence/common/validation/DynRealmValidator.java
deleted file mode 100644
index c926147a09..0000000000
--- a/core/persistence-common/src/main/java/org/apache/syncope/core/persistence/common/validation/DynRealmValidator.java
+++ /dev/null
@@ -1,47 +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.core.persistence.common.validation;
-
-import jakarta.validation.ConstraintValidatorContext;
-import java.util.regex.Pattern;
-import org.apache.syncope.common.lib.types.EntityViolationType;
-import org.apache.syncope.core.persistence.api.entity.DynRealm;
-
-public class DynRealmValidator extends AbstractValidator<DynRealmCheck, DynRealm> {
-
- private static final Pattern REALM_KEY_PATTERN = Pattern.compile("^[A-Za-z0-9]+");
-
- @Override
- public boolean isValid(final DynRealm dynRealm, final ConstraintValidatorContext context) {
- context.disableDefaultConstraintViolation();
-
- boolean isValid = true;
-
- if (dynRealm.getKey().startsWith("/") || !REALM_KEY_PATTERN.matcher(dynRealm.getKey()).matches()) {
- isValid = false;
-
- context.buildConstraintViolationWithTemplate(
- getTemplate(EntityViolationType.InvalidDynRealm,
- "Only letters and numbers are allowed in dynamic realm key, and must not start with /")).
- addPropertyNode("key").addConstraintViolation();
- }
-
- return isValid;
- }
-}
diff --git a/core/persistence-common/src/main/java/org/apache/syncope/core/persistence/common/validation/GroupValidator.java b/core/persistence-common/src/main/java/org/apache/syncope/core/persistence/common/validation/GroupValidator.java
index ca993f9406..f624ef15c5 100644
--- a/core/persistence-common/src/main/java/org/apache/syncope/core/persistence/common/validation/GroupValidator.java
+++ b/core/persistence-common/src/main/java/org/apache/syncope/core/persistence/common/validation/GroupValidator.java
@@ -19,13 +19,8 @@
package org.apache.syncope.core.persistence.common.validation;
import jakarta.validation.ConstraintValidatorContext;
-import java.util.HashSet;
-import java.util.Set;
-import org.apache.syncope.common.lib.types.AnyTypeKind;
import org.apache.syncope.common.lib.types.EntityViolationType;
-import org.apache.syncope.core.persistence.api.entity.AnyType;
import org.apache.syncope.core.persistence.api.entity.Entity;
-import org.apache.syncope.core.persistence.api.entity.anyobject.ADynGroupMembership;
import org.apache.syncope.core.persistence.api.entity.group.Group;
public class GroupValidator extends AbstractValidator<GroupCheck, Group> {
@@ -36,15 +31,6 @@ public class GroupValidator extends AbstractValidator<GroupCheck, Group> {
boolean isValid = true;
- if (group.getUserOwner() != null && group.getGroupOwner() != null) {
- isValid = false;
-
- context.buildConstraintViolationWithTemplate(
- getTemplate(EntityViolationType.InvalidGroupOwner,
- "A group must either be owned by an user or a group, not both")).
- addPropertyNode("owner").addConstraintViolation();
- }
-
if (isValid && (group.getName() == null || !Entity.ID_PATTERN.matcher(group.getName()).matches())) {
isValid = false;
@@ -53,32 +39,6 @@ public class GroupValidator extends AbstractValidator<GroupCheck, Group> {
addPropertyNode("name").addConstraintViolation();
}
- if (isValid) {
- Set<AnyType> anyTypes = new HashSet<>();
- for (ADynGroupMembership memb : group.getADynMemberships()) {
- anyTypes.add(memb.getAnyType());
-
- if (memb.getAnyType().getKind() != AnyTypeKind.ANY_OBJECT) {
- isValid = false;
-
- context.buildConstraintViolationWithTemplate(
- getTemplate(EntityViolationType.InvalidADynMemberships,
- "No user or group dynamic membership condition are allowed here")).
- addPropertyNode("aDynMemberships").addConstraintViolation();
- }
- }
-
- if (isValid && anyTypes.size() < group.getADynMemberships().size()) {
- context.buildConstraintViolationWithTemplate(
- getTemplate(EntityViolationType.InvalidADynMemberships,
- "Each dynamic membership condition requires a different "
- + AnyType.class.getSimpleName())).
- addPropertyNode("aDynMemberships").addConstraintViolation();
- return false;
- }
-
- }
-
return isValid;
}
}
diff --git a/core/persistence-common/src/main/java/org/apache/syncope/core/persistence/common/validation/RoleValidator.java b/core/persistence-common/src/main/java/org/apache/syncope/core/persistence/common/validation/RoleValidator.java
index 7a8e279982..d599f364f1 100644
--- a/core/persistence-common/src/main/java/org/apache/syncope/core/persistence/common/validation/RoleValidator.java
+++ b/core/persistence-common/src/main/java/org/apache/syncope/core/persistence/common/validation/RoleValidator.java
@@ -20,7 +20,6 @@ package org.apache.syncope.core.persistence.common.validation;
import jakarta.validation.ConstraintValidatorContext;
import org.apache.syncope.common.lib.types.EntityViolationType;
-import org.apache.syncope.core.persistence.api.dao.RoleDAO;
import org.apache.syncope.core.persistence.api.entity.Entity;
import org.apache.syncope.core.persistence.api.entity.Role;
@@ -30,10 +29,7 @@ public class RoleValidator extends AbstractValidator<RoleCheck, Role> {
public boolean isValid(final Role role, final ConstraintValidatorContext context) {
context.disableDefaultConstraintViolation();
- if (role.getKey() == null
- || (!RoleDAO.GROUP_OWNER_ROLE.equals(role.getKey())
- && !Entity.ID_PATTERN.matcher(role.getKey()).matches())) {
-
+ if (role.getKey() == null || !Entity.ID_PATTERN.matcher(role.getKey()).matches()) {
context.buildConstraintViolationWithTemplate(
getTemplate(EntityViolationType.InvalidKey, role.getKey())).
addPropertyNode("key").addConstraintViolation();
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/MariaDBPersistenceContext.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/MariaDBPersistenceContext.java
index 4af10b53c3..be3e51bc99 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/MariaDBPersistenceContext.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/MariaDBPersistenceContext.java
@@ -23,7 +23,6 @@ import jakarta.persistence.EntityManagerFactory;
import org.apache.syncope.core.persistence.api.attrvalue.PlainAttrValidationManager;
import org.apache.syncope.core.persistence.api.dao.AnyObjectDAO;
import org.apache.syncope.core.persistence.api.dao.AnySearchDAO;
-import org.apache.syncope.core.persistence.api.dao.DynRealmDAO;
import org.apache.syncope.core.persistence.api.dao.ExternalResourceDAO;
import org.apache.syncope.core.persistence.api.dao.GroupDAO;
import org.apache.syncope.core.persistence.api.dao.PlainSchemaDAO;
@@ -56,7 +55,6 @@ public class MariaDBPersistenceContext {
@Bean
public AnySearchDAO anySearchDAO(
final @Lazy RealmSearchDAO realmSearchDAO,
- final @Lazy DynRealmDAO dynRealmDAO,
final @Lazy UserDAO userDAO,
final @Lazy GroupDAO groupDAO,
final @Lazy AnyObjectDAO anyObjectDAO,
@@ -69,7 +67,6 @@ public class MariaDBPersistenceContext {
return new MariaDBJPAAnySearchDAO(
realmSearchDAO,
- dynRealmDAO,
userDAO,
groupDAO,
anyObjectDAO,
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/MySQLPersistenceContext.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/MySQLPersistenceContext.java
index 2a3b61b322..531cc1ce76 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/MySQLPersistenceContext.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/MySQLPersistenceContext.java
@@ -23,7 +23,6 @@ import jakarta.persistence.EntityManagerFactory;
import org.apache.syncope.core.persistence.api.attrvalue.PlainAttrValidationManager;
import org.apache.syncope.core.persistence.api.dao.AnyObjectDAO;
import org.apache.syncope.core.persistence.api.dao.AnySearchDAO;
-import org.apache.syncope.core.persistence.api.dao.DynRealmDAO;
import org.apache.syncope.core.persistence.api.dao.ExternalResourceDAO;
import org.apache.syncope.core.persistence.api.dao.GroupDAO;
import org.apache.syncope.core.persistence.api.dao.PlainSchemaDAO;
@@ -56,7 +55,6 @@ public class MySQLPersistenceContext {
@Bean
public AnySearchDAO anySearchDAO(
final @Lazy RealmSearchDAO realmSearchDAO,
- final @Lazy DynRealmDAO dynRealmDAO,
final @Lazy UserDAO userDAO,
final @Lazy GroupDAO groupDAO,
final @Lazy AnyObjectDAO anyObjectDAO,
@@ -69,7 +67,6 @@ public class MySQLPersistenceContext {
return new MySQLJPAAnySearchDAO(
realmSearchDAO,
- dynRealmDAO,
userDAO,
groupDAO,
anyObjectDAO,
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/OraclePersistenceContext.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/OraclePersistenceContext.java
index 89b284e597..ea26e5fc89 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/OraclePersistenceContext.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/OraclePersistenceContext.java
@@ -23,7 +23,6 @@ import jakarta.persistence.EntityManagerFactory;
import org.apache.syncope.core.persistence.api.attrvalue.PlainAttrValidationManager;
import org.apache.syncope.core.persistence.api.dao.AnyObjectDAO;
import org.apache.syncope.core.persistence.api.dao.AnySearchDAO;
-import org.apache.syncope.core.persistence.api.dao.DynRealmDAO;
import org.apache.syncope.core.persistence.api.dao.ExternalResourceDAO;
import org.apache.syncope.core.persistence.api.dao.GroupDAO;
import org.apache.syncope.core.persistence.api.dao.PlainSchemaDAO;
@@ -56,7 +55,6 @@ public class OraclePersistenceContext {
@Bean
public AnySearchDAO anySearchDAO(
final @Lazy RealmSearchDAO realmSearchDAO,
- final @Lazy DynRealmDAO dynRealmDAO,
final @Lazy UserDAO userDAO,
final @Lazy GroupDAO groupDAO,
final @Lazy AnyObjectDAO anyObjectDAO,
@@ -69,7 +67,6 @@ public class OraclePersistenceContext {
return new OracleJPAAnySearchDAO(
realmSearchDAO,
- dynRealmDAO,
userDAO,
groupDAO,
anyObjectDAO,
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/PGPersistenceContext.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/PGPersistenceContext.java
index 6b3640ae1b..4fbad459f6 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/PGPersistenceContext.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/PGPersistenceContext.java
@@ -23,7 +23,6 @@ import jakarta.persistence.EntityManagerFactory;
import org.apache.syncope.core.persistence.api.attrvalue.PlainAttrValidationManager;
import org.apache.syncope.core.persistence.api.dao.AnyObjectDAO;
import org.apache.syncope.core.persistence.api.dao.AnySearchDAO;
-import org.apache.syncope.core.persistence.api.dao.DynRealmDAO;
import org.apache.syncope.core.persistence.api.dao.ExternalResourceDAO;
import org.apache.syncope.core.persistence.api.dao.GroupDAO;
import org.apache.syncope.core.persistence.api.dao.PlainSchemaDAO;
@@ -57,7 +56,6 @@ public class PGPersistenceContext {
@Bean
public AnySearchDAO anySearchDAO(
final @Lazy RealmSearchDAO realmSearchDAO,
- final @Lazy DynRealmDAO dynRealmDAO,
final @Lazy UserDAO userDAO,
final @Lazy GroupDAO groupDAO,
final @Lazy AnyObjectDAO anyObjectDAO,
@@ -70,7 +68,6 @@ public class PGPersistenceContext {
return new PGJPAAnySearchDAO(
realmSearchDAO,
- dynRealmDAO,
userDAO,
groupDAO,
anyObjectDAO,
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/PersistenceContext.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/PersistenceContext.java
index f4b537eef9..6f96ed5e39 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/PersistenceContext.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/PersistenceContext.java
@@ -46,7 +46,6 @@ import org.apache.syncope.core.persistence.api.dao.CASSPClientAppDAO;
import org.apache.syncope.core.persistence.api.dao.ConnInstanceDAO;
import org.apache.syncope.core.persistence.api.dao.DelegationDAO;
import org.apache.syncope.core.persistence.api.dao.DerSchemaDAO;
-import org.apache.syncope.core.persistence.api.dao.DynRealmDAO;
import org.apache.syncope.core.persistence.api.dao.EntityCacheDAO;
import org.apache.syncope.core.persistence.api.dao.ExternalResourceDAO;
import org.apache.syncope.core.persistence.api.dao.FIQLQueryDAO;
@@ -82,7 +81,6 @@ import org.apache.syncope.core.persistence.api.dao.keymaster.NetworkServiceDAO;
import org.apache.syncope.core.persistence.api.entity.AnyUtilsFactory;
import org.apache.syncope.core.persistence.api.entity.EntityFactory;
import org.apache.syncope.core.persistence.api.entity.task.TaskUtilsFactory;
-import org.apache.syncope.core.persistence.api.search.SearchCondVisitor;
import org.apache.syncope.core.persistence.common.CommonPersistenceContext;
import org.apache.syncope.core.persistence.common.RuntimeDomainLoader;
import org.apache.syncope.core.persistence.common.dao.AnyFinder;
@@ -132,9 +130,6 @@ import org.apache.syncope.core.persistence.jpa.dao.repo.DerSchemaRepo;
import org.apache.syncope.core.persistence.jpa.dao.repo.DerSchemaRepoExt;
import org.apache.syncope.core.persistence.jpa.dao.repo.DerSchemaRepoExtImpl;
import org.apache.syncope.core.persistence.jpa.dao.repo.DomainRepo;
-import org.apache.syncope.core.persistence.jpa.dao.repo.DynRealmRepo;
-import org.apache.syncope.core.persistence.jpa.dao.repo.DynRealmRepoExt;
-import org.apache.syncope.core.persistence.jpa.dao.repo.DynRealmRepoExtImpl;
import org.apache.syncope.core.persistence.jpa.dao.repo.ExternalResourceRepo;
import org.apache.syncope.core.persistence.jpa.dao.repo.ExternalResourceRepoExt;
import org.apache.syncope.core.persistence.jpa.dao.repo.ExternalResourceRepoExtImpl;
@@ -419,7 +414,6 @@ public class PersistenceContext {
@Bean
public AnyObjectRepoExt anyObjectRepoExt(
final AnyUtilsFactory anyUtilsFactory,
- final @Lazy DynRealmDAO dynRealmDAO,
final @Lazy PlainSchemaDAO plainSchemaDAO,
final @Lazy UserDAO userDAO,
final @Lazy GroupDAO groupDAO,
@@ -428,7 +422,6 @@ public class PersistenceContext {
return new AnyObjectRepoExtImpl(
anyUtilsFactory,
- dynRealmDAO,
plainSchemaDAO,
userDAO,
groupDAO,
@@ -620,38 +613,6 @@ public class PersistenceContext {
return jpaRepositoryFactory.getRepository(DerSchemaRepo.class, derSchemaRepoExt);
}
- @ConditionalOnMissingBean
- @Bean
- public DynRealmRepoExt dynRealmRepoExt(
- final ApplicationEventPublisher publisher,
- final @Lazy UserDAO userDAO,
- final @Lazy GroupDAO groupDAO,
- final @Lazy AnyObjectDAO anyObjectDAO,
- final AnySearchDAO anySearchDAO,
- final AnyMatchDAO anyMatchDAO,
- final SearchCondVisitor searchCondVisitor,
- final EntityManager entityManager) {
-
- return new DynRealmRepoExtImpl(
- publisher,
- userDAO,
- groupDAO,
- anyObjectDAO,
- anySearchDAO,
- anyMatchDAO,
- searchCondVisitor,
- entityManager);
- }
-
- @ConditionalOnMissingBean
- @Bean
- public DynRealmDAO dynRealmDAO(
- final JpaRepositoryFactory jpaRepositoryFactory,
- final DynRealmRepoExt dynRealmRepoExt) {
-
- return jpaRepositoryFactory.getRepository(DynRealmRepo.class, dynRealmRepoExt);
- }
-
@ConditionalOnMissingBean
@Bean
public EntityCacheDAO entityCacheDAO(final EntityManagerFactory entityManagerFactory) {
@@ -678,28 +639,20 @@ public class PersistenceContext {
public GroupRepoExt groupRepoExt(
final ApplicationEventPublisher publisher,
final AnyUtilsFactory anyUtilsFactory,
- final @Lazy DynRealmDAO dynRealmDAO,
final @Lazy PlainSchemaDAO plainSchemaDAO,
final @Lazy RealmDAO realmDAO,
- final AnyMatchDAO anyMatchDAO,
final @Lazy UserDAO userDAO,
final @Lazy AnyObjectDAO anyObjectDAO,
- final AnySearchDAO anySearchDAO,
- final SearchCondVisitor searchCondVisitor,
final EntityManager entityManager,
final AnyFinder anyFinder) {
return new GroupRepoExtImpl(
anyUtilsFactory,
publisher,
- dynRealmDAO,
plainSchemaDAO,
realmDAO,
- anyMatchDAO,
userDAO,
anyObjectDAO,
- anySearchDAO,
- searchCondVisitor,
entityManager,
anyFinder);
}
@@ -920,18 +873,12 @@ public class PersistenceContext {
@Bean
public RoleRepoExt roleRepoExt(
final ApplicationEventPublisher publisher,
- final @Lazy AnyMatchDAO anyMatchDAO,
- final @Lazy AnySearchDAO anySearchDAO,
final DelegationDAO delegationDAO,
- final SearchCondVisitor searchCondVisitor,
final EntityManager entityManager) {
return new RoleRepoExtImpl(
publisher,
- anyMatchDAO,
- anySearchDAO,
delegationDAO,
- searchCondVisitor,
entityManager);
}
@@ -1016,7 +963,6 @@ public class PersistenceContext {
public UserRepoExt userRepoExt(
final SecurityProperties securityProperties,
final AnyUtilsFactory anyUtilsFactory,
- final @Lazy DynRealmDAO dynRealmDAO,
final @Lazy PlainSchemaDAO plainSchemaDAO,
final RoleDAO roleDAO,
final AccessTokenDAO accessTokenDAO,
@@ -1028,7 +974,6 @@ public class PersistenceContext {
return new UserRepoExtImpl(
anyUtilsFactory,
- dynRealmDAO,
plainSchemaDAO,
roleDAO,
accessTokenDAO,
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/AbstractJPAAnySearchDAO.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/AbstractJPAAnySearchDAO.java
index 8b700b82b6..645920bcb9 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/AbstractJPAAnySearchDAO.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/AbstractJPAAnySearchDAO.java
@@ -33,6 +33,7 @@ import java.util.function.Supplier;
import java.util.stream.Collectors;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.lang3.tuple.Pair;
import org.apache.openjpa.jdbc.meta.MappingRepository;
import org.apache.openjpa.jdbc.sql.OracleDictionary;
import org.apache.openjpa.persistence.OpenJPAEntityManagerFactorySPI;
@@ -44,7 +45,6 @@ import org.apache.syncope.common.lib.types.ClientExceptionType;
import org.apache.syncope.common.rest.api.service.JAXRSService;
import org.apache.syncope.core.persistence.api.attrvalue.PlainAttrValidationManager;
import org.apache.syncope.core.persistence.api.dao.AnyObjectDAO;
-import org.apache.syncope.core.persistence.api.dao.DynRealmDAO;
import org.apache.syncope.core.persistence.api.dao.GroupDAO;
import org.apache.syncope.core.persistence.api.dao.PlainSchemaDAO;
import org.apache.syncope.core.persistence.api.dao.RealmSearchDAO;
@@ -53,7 +53,6 @@ import org.apache.syncope.core.persistence.api.dao.search.AnyCond;
import org.apache.syncope.core.persistence.api.dao.search.AnyTypeCond;
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.DynRealmCond;
import org.apache.syncope.core.persistence.api.dao.search.MemberCond;
import org.apache.syncope.core.persistence.api.dao.search.MembershipCond;
import org.apache.syncope.core.persistence.api.dao.search.RelationshipCond;
@@ -79,7 +78,7 @@ import org.springframework.data.domain.Sort;
*/
abstract class AbstractJPAAnySearchDAO extends AbstractAnySearchDAO {
- protected record AdminRealmsFilter(AnySearchNode.Leaf filter, Set<String> dynRealmKeys, Set<String> groupOwners) {
+ protected record AdminRealmsFilter(AnySearchNode.Leaf filter, Set<Pair<AnyTypeKind, String>> managed) {
}
@@ -127,7 +126,6 @@ abstract class AbstractJPAAnySearchDAO extends AbstractAnySearchDAO {
protected AbstractJPAAnySearchDAO(
final RealmSearchDAO realmSearchDAO,
- final DynRealmDAO dynRealmDAO,
final UserDAO userDAO,
final GroupDAO groupDAO,
final AnyObjectDAO anyObjectDAO,
@@ -140,7 +138,6 @@ abstract class AbstractJPAAnySearchDAO extends AbstractAnySearchDAO {
super(
realmSearchDAO,
- dynRealmDAO,
userDAO,
groupDAO,
anyObjectDAO,
@@ -233,11 +230,6 @@ abstract class AbstractJPAAnySearchDAO extends AbstractAnySearchDAO {
map(leaf -> getQuery(leaf, not, parameters, svs));
}
- if (node.isEmpty()) {
- node = cond.asLeaf(DynRealmCond.class).
- map(leaf -> getQuery(leaf, not, parameters, svs));
- }
-
if (node.isEmpty()) {
node = cond.asLeaf(ResourceCond.class).
map(leaf -> getQuery(leaf, not, parameters, svs));
@@ -412,18 +404,7 @@ abstract class AbstractJPAAnySearchDAO extends AbstractAnySearchDAO {
clause.append("SELECT DISTINCT any_id FROM ").
append(svs.membership().name()).append(" WHERE ").
append(subwhere).
- append(") ");
-
- if (not) {
- clause.append("AND ").append(anyId(svs)).append(" NOT IN (");
- } else {
- clause.append("OR ").append(anyId(svs)).append(" IN (");
- }
-
- clause.append("SELECT DISTINCT any_id FROM ").
- append(svs.dyngroupmembership().name()).append(" WHERE ").
- append(subwhere).
- append("))");
+ append(")) ");
return new AnySearchNode.Leaf(defaultSV(svs), clause.toString());
}
@@ -445,40 +426,7 @@ abstract class AbstractJPAAnySearchDAO extends AbstractAnySearchDAO {
clause.append("SELECT DISTINCT any_id FROM ").
append(svs.role().name()).append(" WHERE ").
append("role_id=?").append(setParameter(parameters, cond.getRole())).
- append(") ");
-
- if (not) {
- clause.append("AND ").append(anyId(svs)).append(" NOT IN (");
- } else {
- clause.append("OR ").append(anyId(svs)).append(" IN (");
- }
-
- clause.append("SELECT DISTINCT any_id FROM ").
- append(SearchSupport.dynrolemembership().name()).append(" WHERE ").
- append("role_id=?").append(setParameter(parameters, cond.getRole())).
- append("))");
-
- return new AnySearchNode.Leaf(defaultSV(svs), clause.toString());
- }
-
- protected AnySearchNode getQuery(
- final DynRealmCond cond,
- final boolean not,
- final List<Object> parameters,
- final SearchSupport svs) {
-
- StringBuilder clause = new StringBuilder("(");
-
- if (not) {
- clause.append(anyId(svs)).append(" NOT IN (");
- } else {
- clause.append(anyId(svs)).append(" IN (");
- }
-
- clause.append("SELECT DISTINCT any_id FROM ").
- append(SearchSupport.dynrealmmembership().name()).append(" WHERE ").
- append("dynRealm_id=?").append(setParameter(parameters, cond.getDynRealm())).
- append("))");
+ append(")) ");
return new AnySearchNode.Leaf(defaultSV(svs), clause.toString());
}
@@ -786,38 +734,28 @@ abstract class AbstractJPAAnySearchDAO extends AbstractAnySearchDAO {
final SearchSupport svs) {
Set<String> realmKeys = new HashSet<>();
- Set<String> dynRealmKeys = new HashSet<>();
- Set<String> groupOwners = new HashSet<>();
+ Set<Pair<AnyTypeKind, String>> managed = new HashSet<>();
if (recursive) {
- adminRealms.forEach(realmPath -> RealmUtils.GroupOwnerRealm.of(realmPath).ifPresentOrElse(
- goRealm -> groupOwners.add(goRealm.groupKey()),
+ adminRealms.forEach(realmPath -> RealmUtils.ManagerRealm.of(realmPath).ifPresentOrElse(
+ realm -> managed.add(Pair.of(realm.kind(), realm.anyKey())),
() -> {
- if (realmPath.startsWith("/")) {
- Realm realm = realmSearchDAO.findByFullPath(realmPath).orElseThrow(() -> {
- SyncopeClientException noRealm =
- SyncopeClientException.build(ClientExceptionType.InvalidRealm);
- noRealm.getElements().add("Invalid realm specified: " + realmPath);
- return noRealm;
- });
+ Realm realm = realmSearchDAO.findByFullPath(realmPath).orElseThrow(() -> {
+ SyncopeClientException noRealm =
+ SyncopeClientException.build(ClientExceptionType.InvalidRealm);
+ noRealm.getElements().add("Invalid realm specified: " + realmPath);
+ return noRealm;
+ });
- realmKeys.addAll(realmSearchDAO.findDescendants(realm.getFullPath(), base.getFullPath()));
- } else {
- dynRealmDAO.findById(realmPath).ifPresentOrElse(
- dynRealm -> dynRealmKeys.add(dynRealm.getKey()),
- () -> LOG.warn("Ignoring invalid dynamic realm {}", realmPath));
- }
+ realmKeys.addAll(realmSearchDAO.findDescendants(realm.getFullPath(), base.getFullPath()));
}));
- if (!dynRealmKeys.isEmpty()) {
- realmKeys.clear();
- }
} else {
if (adminRealms.stream().anyMatch(r -> r.startsWith(base.getFullPath()))) {
realmKeys.add(base.getKey());
}
}
- return new AdminRealmsFilter(buildAdminRealmsFilter(realmKeys, svs, parameters), dynRealmKeys, groupOwners);
+ return new AdminRealmsFilter(buildAdminRealmsFilter(realmKeys, svs, parameters), managed);
}
protected void visitNode(
@@ -928,7 +866,7 @@ abstract class AbstractJPAAnySearchDAO extends AbstractAnySearchDAO {
// 2. transform search condition
QueryInfo queryInfo = getQuery(
- buildEffectiveCond(cond, filter.dynRealmKeys(), filter.groupOwners(), kind), parameters, svs).
+ buildEffectiveCond(cond, filter.managed(), kind), parameters, svs).
orElse(null);
if (queryInfo == null) {
LOG.error("Invalid search condition: {}", cond);
@@ -1120,7 +1058,7 @@ abstract class AbstractJPAAnySearchDAO extends AbstractAnySearchDAO {
// 2. transform search condition
QueryInfo queryInfo = getQuery(
- buildEffectiveCond(cond, filter.dynRealmKeys(), filter.groupOwners(), kind), parameters, svs).
+ buildEffectiveCond(cond, filter.managed(), kind), parameters, svs).
orElse(null);
if (queryInfo == null) {
LOG.error("Invalid search condition: {}", cond);
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/MariaDBJPAAnySearchDAO.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/MariaDBJPAAnySearchDAO.java
index 7e627b7e3f..ab768e1d75 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/MariaDBJPAAnySearchDAO.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/MariaDBJPAAnySearchDAO.java
@@ -22,7 +22,6 @@ import jakarta.persistence.EntityManager;
import jakarta.persistence.EntityManagerFactory;
import org.apache.syncope.core.persistence.api.attrvalue.PlainAttrValidationManager;
import org.apache.syncope.core.persistence.api.dao.AnyObjectDAO;
-import org.apache.syncope.core.persistence.api.dao.DynRealmDAO;
import org.apache.syncope.core.persistence.api.dao.GroupDAO;
import org.apache.syncope.core.persistence.api.dao.PlainSchemaDAO;
import org.apache.syncope.core.persistence.api.dao.RealmSearchDAO;
@@ -34,7 +33,6 @@ public class MariaDBJPAAnySearchDAO extends MySQLJPAAnySearchDAO {
public MariaDBJPAAnySearchDAO(
final RealmSearchDAO realmSearchDAO,
- final DynRealmDAO dynRealmDAO,
final UserDAO userDAO,
final GroupDAO groupDAO,
final AnyObjectDAO anyObjectDAO,
@@ -47,7 +45,6 @@ public class MariaDBJPAAnySearchDAO extends MySQLJPAAnySearchDAO {
super(
realmSearchDAO,
- dynRealmDAO,
userDAO,
groupDAO,
anyObjectDAO,
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/MySQLJPAAnySearchDAO.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/MySQLJPAAnySearchDAO.java
index 31f8cebd69..e9c4f007b3 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/MySQLJPAAnySearchDAO.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/MySQLJPAAnySearchDAO.java
@@ -26,7 +26,6 @@ import java.util.Optional;
import org.apache.syncope.common.lib.types.AttrSchemaType;
import org.apache.syncope.core.persistence.api.attrvalue.PlainAttrValidationManager;
import org.apache.syncope.core.persistence.api.dao.AnyObjectDAO;
-import org.apache.syncope.core.persistence.api.dao.DynRealmDAO;
import org.apache.syncope.core.persistence.api.dao.GroupDAO;
import org.apache.syncope.core.persistence.api.dao.PlainSchemaDAO;
import org.apache.syncope.core.persistence.api.dao.RealmSearchDAO;
@@ -44,7 +43,6 @@ public class MySQLJPAAnySearchDAO extends AbstractJPAAnySearchDAO {
public MySQLJPAAnySearchDAO(
final RealmSearchDAO realmSearchDAO,
- final DynRealmDAO dynRealmDAO,
final UserDAO userDAO,
final GroupDAO groupDAO,
final AnyObjectDAO anyObjectDAO,
@@ -57,7 +55,6 @@ public class MySQLJPAAnySearchDAO extends AbstractJPAAnySearchDAO {
super(
realmSearchDAO,
- dynRealmDAO,
userDAO,
groupDAO,
anyObjectDAO,
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/OracleJPAAnySearchDAO.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/OracleJPAAnySearchDAO.java
index ad63eb5260..6ee2ebf412 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/OracleJPAAnySearchDAO.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/OracleJPAAnySearchDAO.java
@@ -29,7 +29,6 @@ import org.apache.commons.lang3.StringUtils;
import org.apache.syncope.common.lib.types.AttrSchemaType;
import org.apache.syncope.core.persistence.api.attrvalue.PlainAttrValidationManager;
import org.apache.syncope.core.persistence.api.dao.AnyObjectDAO;
-import org.apache.syncope.core.persistence.api.dao.DynRealmDAO;
import org.apache.syncope.core.persistence.api.dao.GroupDAO;
import org.apache.syncope.core.persistence.api.dao.PlainSchemaDAO;
import org.apache.syncope.core.persistence.api.dao.RealmSearchDAO;
@@ -61,7 +60,6 @@ public class OracleJPAAnySearchDAO extends AbstractJPAAnySearchDAO {
public OracleJPAAnySearchDAO(
final RealmSearchDAO realmSearchDAO,
- final DynRealmDAO dynRealmDAO,
final UserDAO userDAO,
final GroupDAO groupDAO,
final AnyObjectDAO anyObjectDAO,
@@ -74,7 +72,6 @@ public class OracleJPAAnySearchDAO extends AbstractJPAAnySearchDAO {
super(
realmSearchDAO,
- dynRealmDAO,
userDAO,
groupDAO,
anyObjectDAO,
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/PGJPAAnySearchDAO.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/PGJPAAnySearchDAO.java
index 28cd12b1ba..01a6a25d79 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/PGJPAAnySearchDAO.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/PGJPAAnySearchDAO.java
@@ -30,7 +30,6 @@ import org.apache.commons.lang3.StringUtils;
import org.apache.syncope.common.lib.types.AttrSchemaType;
import org.apache.syncope.core.persistence.api.attrvalue.PlainAttrValidationManager;
import org.apache.syncope.core.persistence.api.dao.AnyObjectDAO;
-import org.apache.syncope.core.persistence.api.dao.DynRealmDAO;
import org.apache.syncope.core.persistence.api.dao.GroupDAO;
import org.apache.syncope.core.persistence.api.dao.PlainSchemaDAO;
import org.apache.syncope.core.persistence.api.dao.RealmSearchDAO;
@@ -62,7 +61,6 @@ public class PGJPAAnySearchDAO extends AbstractJPAAnySearchDAO {
public PGJPAAnySearchDAO(
final RealmSearchDAO realmSearchDAO,
- final DynRealmDAO dynRealmDAO,
final UserDAO userDAO,
final GroupDAO groupDAO,
final AnyObjectDAO anyObjectDAO,
@@ -75,7 +73,6 @@ public class PGJPAAnySearchDAO extends AbstractJPAAnySearchDAO {
super(
realmSearchDAO,
- dynRealmDAO,
userDAO,
groupDAO,
anyObjectDAO,
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/SearchSupport.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/SearchSupport.java
index ff01f4f04f..c5fbcdffac 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/SearchSupport.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/SearchSupport.java
@@ -19,9 +19,6 @@
package org.apache.syncope.core.persistence.jpa.dao;
import org.apache.syncope.common.lib.types.AnyTypeKind;
-import org.apache.syncope.core.persistence.jpa.dao.repo.DynRealmRepoExt;
-import org.apache.syncope.core.persistence.jpa.dao.repo.GroupRepoExt;
-import org.apache.syncope.core.persistence.jpa.dao.repo.RoleRepoExt;
import org.apache.syncope.core.persistence.jpa.entity.anyobject.JPAAnyObject;
import org.apache.syncope.core.persistence.jpa.entity.group.JPAGroup;
import org.apache.syncope.core.persistence.jpa.entity.user.JPAUser;
@@ -92,23 +89,10 @@ public class SearchSupport {
return new SearchView("sv" + kind + 'm', field().name + '_' + kind + "membership");
}
- public SearchView dyngroupmembership() {
- return new SearchView("sv" + anyTypeKind.name() + "dgm",
- anyTypeKind == AnyTypeKind.USER ? GroupRepoExt.UDYNMEMB_TABLE : GroupRepoExt.ADYNMEMB_TABLE);
- }
-
public SearchView role() {
return new SearchView("svr", field().name + "_role");
}
- public static SearchView dynrolemembership() {
- return new SearchView("svdr", RoleRepoExt.DYNMEMB_TABLE);
- }
-
- public static SearchView dynrealmmembership() {
- return new SearchView("svdrealm", DynRealmRepoExt.DYNMEMB_TABLE);
- }
-
public SearchView auxClass() {
return new SearchView("svac", field().name + "_auxClass");
}
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/repo/AbstractAnyRepoExt.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/repo/AbstractAnyRepoExt.java
index c97c3d1de4..08fae58f16 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/repo/AbstractAnyRepoExt.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/repo/AbstractAnyRepoExt.java
@@ -19,7 +19,6 @@
package org.apache.syncope.core.persistence.jpa.dao.repo;
import jakarta.persistence.EntityManager;
-import jakarta.persistence.Query;
import java.time.OffsetDateTime;
import java.util.ArrayList;
import java.util.Collection;
@@ -33,14 +32,12 @@ import javax.sql.DataSource;
import org.apache.openjpa.persistence.OpenJPAEntityManagerFactorySPI;
import org.apache.syncope.core.persistence.api.dao.AllowedSchemas;
import org.apache.syncope.core.persistence.api.dao.DuplicateException;
-import org.apache.syncope.core.persistence.api.dao.DynRealmDAO;
import org.apache.syncope.core.persistence.api.dao.NotFoundException;
import org.apache.syncope.core.persistence.api.dao.PlainSchemaDAO;
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.AnyUtils;
import org.apache.syncope.core.persistence.api.entity.DerSchema;
-import org.apache.syncope.core.persistence.api.entity.DynRealm;
import org.apache.syncope.core.persistence.api.entity.PlainSchema;
import org.apache.syncope.core.persistence.api.entity.Relationship;
import org.apache.syncope.core.persistence.api.entity.RelationshipType;
@@ -64,8 +61,6 @@ public abstract class AbstractAnyRepoExt<A extends Any> implements AnyRepoExt<A>
protected static final Logger LOG = LoggerFactory.getLogger(AnyRepoExt.class);
- protected final DynRealmDAO dynRealmDAO;
-
protected final PlainSchemaDAO plainSchemaDAO;
protected final EntityManager entityManager;
@@ -77,13 +72,11 @@ public abstract class AbstractAnyRepoExt<A extends Any> implements AnyRepoExt<A>
protected final String table;
protected AbstractAnyRepoExt(
- final DynRealmDAO dynRealmDAO,
final PlainSchemaDAO plainSchemaDAO,
final EntityManager entityManager,
final AnyFinder anyFinder,
final AnyUtils anyUtils) {
- this.dynRealmDAO = dynRealmDAO;
this.plainSchemaDAO = plainSchemaDAO;
this.entityManager = entityManager;
this.anyFinder = anyFinder;
@@ -221,23 +214,6 @@ public abstract class AbstractAnyRepoExt<A extends Any> implements AnyRepoExt<A>
return result;
}
- @Transactional(readOnly = true)
- @Override
- public List<String> findDynRealms(final String key) {
- Query query = entityManager.createNativeQuery(
- "SELECT dynRealm_id FROM " + DynRealmRepoExt.DYNMEMB_TABLE + " WHERE any_id=?");
- query.setParameter(1, key);
-
- @SuppressWarnings("unchecked")
- List<Object> result = query.getResultList();
- return result.stream().
- map(dynRealm -> dynRealmDAO.findById(dynRealm.toString())).
- flatMap(Optional::stream).
- map(DynRealm::getKey).
- distinct().
- toList();
- }
-
@Override
public void deleteRelationship(final Relationship<? extends A, AnyObject> relationship) {
entityManager.remove(relationship);
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/repo/AnyObjectRepoExt.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/repo/AnyObjectRepoExt.java
index 0a4554d7e1..743a344286 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/repo/AnyObjectRepoExt.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/repo/AnyObjectRepoExt.java
@@ -22,7 +22,6 @@ import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Set;
-import org.apache.syncope.core.persistence.api.dao.GroupDAO;
import org.apache.syncope.core.persistence.api.entity.Any;
import org.apache.syncope.core.persistence.api.entity.ExternalResource;
import org.apache.syncope.core.persistence.api.entity.Relationship;
@@ -40,8 +39,6 @@ public interface AnyObjectRepoExt extends AnyRepoExt<AnyObject> {
void deleteMembership(AMembership membership);
- List<Group> findDynGroups(String key);
-
List<Relationship<Any, AnyObject>> findAllRelationships(AnyObject anyObject);
Collection<Group> findAllGroups(AnyObject anyObject);
@@ -50,8 +47,6 @@ public interface AnyObjectRepoExt extends AnyRepoExt<AnyObject> {
Collection<ExternalResource> findAllResources(AnyObject anyObject);
- GroupDAO.DynMembershipInfo saveAndGetDynGroupMembs(AnyObject anyObject);
-
@Override
<S extends AnyObject> S save(S anyObject);
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/repo/AnyObjectRepoExtImpl.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/repo/AnyObjectRepoExtImpl.java
index 699486b3dd..71bfc62fc1 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/repo/AnyObjectRepoExtImpl.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/repo/AnyObjectRepoExtImpl.java
@@ -29,13 +29,10 @@ import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
-import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors;
-import org.apache.commons.lang3.tuple.Pair;
import org.apache.syncope.common.lib.types.AnyEntitlement;
import org.apache.syncope.common.lib.types.AnyTypeKind;
-import org.apache.syncope.core.persistence.api.dao.DynRealmDAO;
import org.apache.syncope.core.persistence.api.dao.GroupDAO;
import org.apache.syncope.core.persistence.api.dao.PlainSchemaDAO;
import org.apache.syncope.core.persistence.api.dao.UserDAO;
@@ -66,7 +63,6 @@ public class AnyObjectRepoExtImpl extends AbstractAnyRepoExt<AnyObject> implemen
public AnyObjectRepoExtImpl(
final AnyUtilsFactory anyUtilsFactory,
- final DynRealmDAO dynRealmDAO,
final PlainSchemaDAO plainSchemaDAO,
final UserDAO userDAO,
final GroupDAO groupDAO,
@@ -74,7 +70,6 @@ public class AnyObjectRepoExtImpl extends AbstractAnyRepoExt<AnyObject> implemen
final AnyFinder anyFinder) {
super(
- dynRealmDAO,
plainSchemaDAO,
entityManager,
anyFinder,
@@ -123,18 +118,21 @@ public class AnyObjectRepoExtImpl extends AbstractAnyRepoExt<AnyObject> implemen
final String realm,
final Collection<String> groups) {
- // 1. check if AuthContextUtils.getUsername() is owner of at least one group of which anyObject is member
+ // 0. check if AuthContextUtils.getUsername() is manager of the given anyObject
boolean authorized = authRealms.stream().
- map(authRealm -> RealmUtils.GroupOwnerRealm.of(authRealm).orElse(null)).
+ map(authRealm -> RealmUtils.ManagerRealm.of(authRealm).orElse(null)).
filter(Objects::nonNull).
- anyMatch(pair -> groups.contains(pair.groupKey()));
+ anyMatch(managerRealm -> key.equals(managerRealm.anyKey()));
- // 2. check if anyObject is in at least one DynRealm for which AuthContextUtils.getUsername() owns entitlement
- if (!authorized && key != null) {
- authorized = findDynRealms(key).stream().anyMatch(authRealms::contains);
+ // 1. check if AuthContextUtils.getUsername() is manager of at least one group of which anyObject is member
+ if (!authorized) {
+ authorized = authRealms.stream().
+ map(authRealm -> RealmUtils.ManagerRealm.of(authRealm).orElse(null)).
+ filter(Objects::nonNull).
+ anyMatch(managerRealm -> groups.contains(managerRealm.anyKey()));
}
- // 3. check if anyObject is in Realm (or descendants) for which AuthContextUtils.getUsername() owns entitlement
+ // 2. check if anyObject is in Realm (or descendants) for which AuthContextUtils.getUsername() owns entitlement
if (!authorized) {
authorized = authRealms.stream().anyMatch(realm::startsWith);
}
@@ -180,29 +178,17 @@ public class AnyObjectRepoExtImpl extends AbstractAnyRepoExt<AnyObject> implemen
return result;
}
- protected Pair<AnyObject, GroupDAO.DynMembershipInfo> doSave(final AnyObject anyObject) {
- AnyObject merged = entityManager.merge(anyObject);
-
- // ensure that entity listeners are invoked at this point
- entityManager.flush();
-
- GroupDAO.DynMembershipInfo dynGroupMembs = groupDAO.refreshDynMemberships(merged);
- dynRealmDAO.refreshDynMemberships(merged);
-
- return Pair.of(merged, dynGroupMembs);
- }
-
@Override
@SuppressWarnings("unchecked")
public <S extends AnyObject> S save(final S anyObject) {
checkBeforeSave((JPAAnyObject) anyObject);
- return (S) doSave(anyObject).getLeft();
- }
- @Override
- public GroupDAO.DynMembershipInfo saveAndGetDynGroupMembs(final AnyObject anyObject) {
- checkBeforeSave((JPAAnyObject) anyObject);
- return doSave(anyObject).getRight();
+ AnyObject merged = entityManager.merge(anyObject);
+
+ // ensure that entity listeners are invoked at this point
+ entityManager.flush();
+
+ return (S) merged;
}
protected List<ARelationship> findARelationships(final AnyObject anyObject) {
@@ -223,31 +209,10 @@ public class AnyObjectRepoExtImpl extends AbstractAnyRepoExt<AnyObject> implemen
return query.getResultList();
}
- @Transactional(propagation = Propagation.REQUIRES_NEW, readOnly = true)
- @Override
- public List<Group> findDynGroups(final String key) {
- Query query = entityManager.createNativeQuery(
- "SELECT group_id FROM " + GroupRepoExt.ADYNMEMB_TABLE + " WHERE any_id=?");
- query.setParameter(1, key);
-
- @SuppressWarnings("unchecked")
- List<Object> result = query.getResultList();
- return result.stream().
- map(groupKey -> groupDAO.findById(groupKey.toString())).
- flatMap(Optional::stream).
- distinct().
- collect(Collectors.toList());
- }
-
@Transactional(propagation = Propagation.REQUIRES_NEW, readOnly = true)
@Override
public Collection<Group> findAllGroups(final AnyObject anyObject) {
- Set<Group> result = new HashSet<>();
- result.addAll(anyObject.getMemberships().stream().
- map(AMembership::getRightEnd).collect(Collectors.toSet()));
- result.addAll(findDynGroups(anyObject.getKey()));
-
- return result;
+ return anyObject.getMemberships().stream().map(AMembership::getRightEnd).collect(Collectors.toSet());
}
@Transactional(propagation = Propagation.REQUIRES_NEW, readOnly = true)
@@ -274,9 +239,6 @@ public class AnyObjectRepoExtImpl extends AbstractAnyRepoExt<AnyObject> implemen
@Override
public void delete(final AnyObject anyObject) {
- groupDAO.removeDynMemberships(anyObject);
- dynRealmDAO.removeDynMemberships(anyObject.getKey());
-
findARelationships(anyObject).forEach(relationship -> {
relationship.getLeftEnd().remove(relationship);
save(relationship.getLeftEnd());
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/repo/AnyRepoExt.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/repo/AnyRepoExt.java
index 46f65686d1..f41d5cb3a3 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/repo/AnyRepoExt.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/repo/AnyRepoExt.java
@@ -38,8 +38,6 @@ public interface AnyRepoExt<A extends Any> {
<S extends Schema> AllowedSchemas<S> findAllowedSchemas(A any, Class<S> reference);
- List<String> findDynRealms(String key);
-
Collection<String> findAllResourceKeys(String key);
void deleteRelationship(Relationship<? extends A, AnyObject> relationship);
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/repo/DynRealmRepo.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/repo/DynRealmRepo.java
deleted file mode 100644
index f0458c3e32..0000000000
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/repo/DynRealmRepo.java
+++ /dev/null
@@ -1,28 +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.core.persistence.jpa.dao.repo;
-
-import org.apache.syncope.core.persistence.api.dao.DynRealmDAO;
-import org.apache.syncope.core.persistence.jpa.entity.JPADynRealm;
-import org.springframework.data.repository.ListCrudRepository;
-
-public interface DynRealmRepo
- extends ListCrudRepository<JPADynRealm, String>, DynRealmRepoExt, DynRealmDAO {
-
-}
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/repo/DynRealmRepoExt.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/repo/DynRealmRepoExt.java
deleted file mode 100644
index 1b5c56703d..0000000000
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/repo/DynRealmRepoExt.java
+++ /dev/null
@@ -1,35 +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.core.persistence.jpa.dao.repo;
-
-import org.apache.syncope.core.persistence.api.entity.Any;
-import org.apache.syncope.core.persistence.api.entity.DynRealm;
-
-public interface DynRealmRepoExt {
-
- String DYNMEMB_TABLE = "DynRealmMembers";
-
- DynRealm saveAndRefreshDynMemberships(DynRealm dynRealm);
-
- void refreshDynMemberships(Any any);
-
- void removeDynMemberships(String anyKey);
-
- void deleteById(String key);
-}
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/repo/DynRealmRepoExtImpl.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/repo/DynRealmRepoExtImpl.java
deleted file mode 100644
index 9f8f476281..0000000000
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/repo/DynRealmRepoExtImpl.java
+++ /dev/null
@@ -1,190 +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.core.persistence.jpa.dao.repo;
-
-import jakarta.persistence.EntityManager;
-import jakarta.persistence.Query;
-import java.util.List;
-import java.util.Optional;
-import java.util.stream.Collectors;
-import org.apache.syncope.core.persistence.api.dao.AnyMatchDAO;
-import org.apache.syncope.core.persistence.api.dao.AnyObjectDAO;
-import org.apache.syncope.core.persistence.api.dao.AnySearchDAO;
-import org.apache.syncope.core.persistence.api.dao.GroupDAO;
-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.DynRealm;
-import org.apache.syncope.core.persistence.api.search.SearchCondConverter;
-import org.apache.syncope.core.persistence.api.search.SearchCondVisitor;
-import org.apache.syncope.core.persistence.jpa.entity.JPADynRealm;
-import org.apache.syncope.core.provisioning.api.event.EntityLifecycleEvent;
-import org.apache.syncope.core.spring.security.AuthContextUtils;
-import org.identityconnectors.framework.common.objects.SyncDeltaType;
-import org.springframework.context.ApplicationEventPublisher;
-import org.springframework.transaction.annotation.Transactional;
-
-public class DynRealmRepoExtImpl implements DynRealmRepoExt {
-
- protected final ApplicationEventPublisher publisher;
-
- protected final UserDAO userDAO;
-
- protected final GroupDAO groupDAO;
-
- protected final AnyObjectDAO anyObjectDAO;
-
- protected final AnySearchDAO searchDAO;
-
- protected final AnyMatchDAO anyMatchDAO;
-
- protected final SearchCondVisitor searchCondVisitor;
-
- protected final EntityManager entityManager;
-
- public DynRealmRepoExtImpl(
- final ApplicationEventPublisher publisher,
- final UserDAO userDAO,
- final GroupDAO groupDAO,
- final AnyObjectDAO anyObjectDAO,
- final AnySearchDAO searchDAO,
- final AnyMatchDAO anyMatchDAO,
- final SearchCondVisitor searchCondVisitor,
- final EntityManager entityManager) {
-
- this.publisher = publisher;
- this.userDAO = userDAO;
- this.groupDAO = groupDAO;
- this.anyObjectDAO = anyObjectDAO;
- this.searchDAO = searchDAO;
- this.anyMatchDAO = anyMatchDAO;
- this.searchCondVisitor = searchCondVisitor;
- this.entityManager = entityManager;
- }
-
- protected List<String> clearDynMembers(final DynRealm dynRealm) {
- Query find = entityManager.createNativeQuery(
- "SELECT any_id FROM " + DYNMEMB_TABLE + " WHERE dynRealm_id=?");
- find.setParameter(1, dynRealm.getKey());
-
- @SuppressWarnings("unchecked")
- List<Object> result = find.getResultList();
- List<String> cleared = result.stream().
- map(Object::toString).
- collect(Collectors.toList());
-
- @SuppressWarnings("unchecked")
- Query delete = entityManager.createNativeQuery("DELETE FROM " + DYNMEMB_TABLE + " WHERE dynRealm_id=?");
- delete.setParameter(1, dynRealm.getKey());
- delete.executeUpdate();
-
- return cleared;
- }
-
- protected void notifyDynMembershipRemoval(final List<String> anyKeys) {
- anyKeys.forEach(key -> {
- Optional<? extends Any> any = userDAO.findById(key);
- if (any.isEmpty()) {
- any = groupDAO.findById(key);
- }
- if (any.isEmpty()) {
- any = anyObjectDAO.findById(key);
- }
- any.ifPresent(entity -> publisher.publishEvent(
- new EntityLifecycleEvent<>(this, SyncDeltaType.UPDATE, entity, AuthContextUtils.getDomain())));
- });
- }
-
- @Override
- public DynRealm saveAndRefreshDynMemberships(final DynRealm dynRealm) {
- DynRealm merged = entityManager.merge(dynRealm);
-
- // refresh dynamic memberships
- List<String> cleared = clearDynMembers(merged);
-
- merged.getDynMemberships().stream().map(memb -> searchDAO.search(
- SearchCondConverter.convert(searchCondVisitor, memb.getFIQLCond()), memb.getAnyType().getKind())).
- forEach(matching -> matching.forEach(any -> {
-
- Query insert = entityManager.createNativeQuery("INSERT INTO " + DYNMEMB_TABLE + " VALUES(?, ?)");
- insert.setParameter(1, any.getKey());
- insert.setParameter(2, merged.getKey());
- insert.executeUpdate();
-
- publisher.publishEvent(
- new EntityLifecycleEvent<>(this, SyncDeltaType.UPDATE, any, AuthContextUtils.getDomain()));
- cleared.remove(any.getKey());
- }));
-
- notifyDynMembershipRemoval(cleared);
-
- return merged;
- }
-
- @Override
- public void deleteById(final String key) {
- DynRealm dynRealm = entityManager.find(JPADynRealm.class, key);
- if (dynRealm == null) {
- return;
- }
-
- notifyDynMembershipRemoval(clearDynMembers(dynRealm));
-
- entityManager.remove(dynRealm);
- }
-
- @Transactional
- @Override
- public void refreshDynMemberships(final Any any) {
- entityManager.createQuery(
- "SELECT e FROM " + JPADynRealm.class.getSimpleName() + " e ", DynRealm.class).getResultStream().
- forEach(dynRealm -> dynRealm.getDynMembership(any.getType()).ifPresent(memb -> {
-
- boolean matches = anyMatchDAO.matches(
- any, SearchCondConverter.convert(searchCondVisitor, memb.getFIQLCond()));
-
- Query query = entityManager.createNativeQuery(
- "SELECT COUNT(dynRealm_id) FROM " + DYNMEMB_TABLE + " WHERE any_id=? AND dynRealm_id=?");
- query.setParameter(1, any.getKey());
- query.setParameter(2, dynRealm.getKey());
- boolean existing = ((Number) query.getSingleResult()).longValue() > 0;
-
- if (matches && !existing) {
- Query insert = entityManager.
- createNativeQuery("INSERT INTO " + DYNMEMB_TABLE + " VALUES(?, ?)");
- insert.setParameter(1, any.getKey());
- insert.setParameter(2, dynRealm.getKey());
- insert.executeUpdate();
- } else if (!matches && existing) {
- Query delete = entityManager.createNativeQuery(
- "DELETE FROM " + DYNMEMB_TABLE + " WHERE dynRealm_id=? AND any_id=?");
- delete.setParameter(1, dynRealm.getKey());
- delete.setParameter(2, any.getKey());
- delete.executeUpdate();
- }
- }));
- }
-
- @Override
- public void removeDynMemberships(final String anyKey) {
- Query delete = entityManager.
- createNativeQuery("DELETE FROM " + DYNMEMB_TABLE + " WHERE any_id=?");
- delete.setParameter(1, anyKey);
- delete.executeUpdate();
- }
-}
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/repo/GroupRepo.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/repo/GroupRepo.java
index 6540bed6b4..d992d45aa0 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/repo/GroupRepo.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/repo/GroupRepo.java
@@ -42,10 +42,6 @@ public interface GroupRepo
@Override
List<Group> findByKeys(@Param("keys") List<String> keys);
- @Query("SELECT e FROM #{#entityName} e WHERE e.groupOwner.id = :groupKey")
- @Override
- List<Group> findOwnedByGroup(@Param("groupKey") String groupKey);
-
@Query("SELECT DISTINCT e.leftEnd.id FROM JPAAMembership e WHERE e.rightEnd.id = :groupKey")
@Override
List<String> findAMembers(@Param("groupKey") String groupKey);
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/repo/GroupRepoExt.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/repo/GroupRepoExt.java
index 2068fea120..2a4cd46d99 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/repo/GroupRepoExt.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/repo/GroupRepoExt.java
@@ -21,7 +21,6 @@ package org.apache.syncope.core.persistence.jpa.dao.repo;
import java.util.List;
import java.util.Map;
import java.util.Set;
-import org.apache.syncope.core.persistence.api.dao.GroupDAO;
import org.apache.syncope.core.persistence.api.entity.AnyTypeClass;
import org.apache.syncope.core.persistence.api.entity.anyobject.AMembership;
import org.apache.syncope.core.persistence.api.entity.anyobject.AnyObject;
@@ -33,15 +32,17 @@ import org.springframework.data.domain.Pageable;
public interface GroupRepoExt extends AnyRepoExt<Group> {
- String ADYNMEMB_TABLE = "ADynGroupMembers";
+ void securityChecks(Set<String> authRealms, String key, String realm);
- String UDYNMEMB_TABLE = "UDynGroupMembers";
+ boolean isManager(String key);
- void securityChecks(Set<String> authRealms, String key, String realm);
+ List<User> findManagedUsers(String key);
- Map<String, Long> countByRealm();
+ List<Group> findManagedGroups(String key);
+
+ List<AnyObject> findManagedAnyObjects(String key);
- List<Group> findOwnedByUser(String userKey);
+ Map<String, Long> countByRealm();
boolean existsAMembership(String anyObjectKey, String groupKey);
@@ -51,30 +52,8 @@ public interface GroupRepoExt extends AnyRepoExt<Group> {
List<UMembership> findUMemberships(Group group, Pageable pageable);
- Group saveAndRefreshDynMemberships(Group group);
-
List<GroupTypeExtension> findTypeExtensions(AnyTypeClass anyTypeClass);
- long countADynMembers(Group group);
-
- long countUDynMembers(Group group);
-
- List<String> findADynMembers(Group group);
-
- List<String> findUDynMembers(Group group);
-
- void clearADynMembers(Group group);
-
- void clearUDynMembers(Group group);
-
- GroupDAO.DynMembershipInfo refreshDynMemberships(AnyObject anyObject);
-
- Set<String> removeDynMemberships(AnyObject anyObject);
-
- GroupDAO.DynMembershipInfo refreshDynMemberships(User user);
-
- Set<String> removeDynMemberships(User user);
-
@Override
<S extends Group> S save(S group);
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/repo/GroupRepoExtImpl.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/repo/GroupRepoExtImpl.java
index 54820640cb..6b9d62339e 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/repo/GroupRepoExtImpl.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/repo/GroupRepoExtImpl.java
@@ -21,56 +21,42 @@ package org.apache.syncope.core.persistence.jpa.dao.repo;
import jakarta.persistence.EntityManager;
import jakarta.persistence.Query;
import jakarta.persistence.TypedQuery;
-import java.util.ArrayList;
import java.util.Collection;
-import java.util.HashSet;
import java.util.List;
import java.util.Map;
+import java.util.Objects;
import java.util.Set;
import java.util.stream.Collectors;
-import org.apache.syncope.common.lib.SyncopeConstants;
import org.apache.syncope.common.lib.types.AnyTypeKind;
import org.apache.syncope.common.lib.types.IdRepoEntitlement;
-import org.apache.syncope.core.persistence.api.dao.AnyDAO;
-import org.apache.syncope.core.persistence.api.dao.AnyMatchDAO;
import org.apache.syncope.core.persistence.api.dao.AnyObjectDAO;
-import org.apache.syncope.core.persistence.api.dao.AnySearchDAO;
-import org.apache.syncope.core.persistence.api.dao.DynRealmDAO;
-import org.apache.syncope.core.persistence.api.dao.GroupDAO;
import org.apache.syncope.core.persistence.api.dao.PlainSchemaDAO;
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.SearchCond;
import org.apache.syncope.core.persistence.api.entity.Any;
-import org.apache.syncope.core.persistence.api.entity.AnyType;
import org.apache.syncope.core.persistence.api.entity.AnyTypeClass;
import org.apache.syncope.core.persistence.api.entity.AnyUtilsFactory;
import org.apache.syncope.core.persistence.api.entity.ExternalResource;
import org.apache.syncope.core.persistence.api.entity.Realm;
-import org.apache.syncope.core.persistence.api.entity.anyobject.ADynGroupMembership;
import org.apache.syncope.core.persistence.api.entity.anyobject.AMembership;
import org.apache.syncope.core.persistence.api.entity.anyobject.AnyObject;
import org.apache.syncope.core.persistence.api.entity.group.Group;
import org.apache.syncope.core.persistence.api.entity.group.GroupTypeExtension;
-import org.apache.syncope.core.persistence.api.entity.user.UDynGroupMembership;
import org.apache.syncope.core.persistence.api.entity.user.UMembership;
import org.apache.syncope.core.persistence.api.entity.user.User;
-import org.apache.syncope.core.persistence.api.search.SearchCondConverter;
-import org.apache.syncope.core.persistence.api.search.SearchCondVisitor;
import org.apache.syncope.core.persistence.api.utils.RealmUtils;
import org.apache.syncope.core.persistence.common.dao.AnyFinder;
-import org.apache.syncope.core.persistence.jpa.entity.anyobject.JPAADynGroupMembership;
import org.apache.syncope.core.persistence.jpa.entity.anyobject.JPAAMembership;
+import org.apache.syncope.core.persistence.jpa.entity.anyobject.JPAAnyObject;
import org.apache.syncope.core.persistence.jpa.entity.group.JPAGroup;
import org.apache.syncope.core.persistence.jpa.entity.group.JPAGroupTypeExtension;
-import org.apache.syncope.core.persistence.jpa.entity.user.JPAUDynGroupMembership;
import org.apache.syncope.core.persistence.jpa.entity.user.JPAUMembership;
+import org.apache.syncope.core.persistence.jpa.entity.user.JPAUser;
import org.apache.syncope.core.provisioning.api.event.EntityLifecycleEvent;
import org.apache.syncope.core.spring.security.AuthContextUtils;
import org.apache.syncope.core.spring.security.DelegatedAdministrationException;
import org.identityconnectors.framework.common.objects.SyncDeltaType;
import org.springframework.context.ApplicationEventPublisher;
-import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.transaction.annotation.Transactional;
@@ -80,43 +66,29 @@ public class GroupRepoExtImpl extends AbstractAnyRepoExt<Group> implements Group
protected final RealmDAO realmDAO;
- protected final AnyMatchDAO anyMatchDAO;
-
protected final UserDAO userDAO;
protected final AnyObjectDAO anyObjectDAO;
- protected final AnySearchDAO anySearchDAO;
-
- protected final SearchCondVisitor searchCondVisitor;
-
public GroupRepoExtImpl(
final AnyUtilsFactory anyUtilsFactory,
final ApplicationEventPublisher publisher,
- final DynRealmDAO dynRealmDAO,
final PlainSchemaDAO plainSchemaDAO,
final RealmDAO realmDAO,
- final AnyMatchDAO anyMatchDAO,
final UserDAO userDAO,
final AnyObjectDAO anyObjectDAO,
- final AnySearchDAO searchDAO,
- final SearchCondVisitor searchCondVisitor,
final EntityManager entityManager,
final AnyFinder anyFinder) {
super(
- dynRealmDAO,
plainSchemaDAO,
entityManager,
anyFinder,
anyUtilsFactory.getInstance(AnyTypeKind.GROUP));
this.publisher = publisher;
this.realmDAO = realmDAO;
- this.anyMatchDAO = anyMatchDAO;
this.userDAO = userDAO;
this.anyObjectDAO = anyObjectDAO;
- this.anySearchDAO = searchDAO;
- this.searchCondVisitor = searchCondVisitor;
}
@Transactional(readOnly = true)
@@ -126,17 +98,18 @@ public class GroupRepoExtImpl extends AbstractAnyRepoExt<Group> implements Group
final String key,
final String realm) {
- // 1. check if AuthContextUtils.getUsername() is owner of the group, or
- // if group is in Realm (or descendants) for which AuthContextUtils.getUsername() owns entitlement
- boolean authorized = authRealms.stream().anyMatch(authRealm -> realm.startsWith(authRealm)
- || authRealm.equals(new RealmUtils.GroupOwnerRealm(realm, key).output()));
+ // 0. check if AuthContextUtils.getUsername() is manager of the given group
+ boolean authorized = authRealms.stream().
+ map(authRealm -> RealmUtils.ManagerRealm.of(authRealm).orElse(null)).
+ filter(Objects::nonNull).
+ anyMatch(managerRealm -> key.equals(managerRealm.anyKey()));
- // 2. check if groups is in at least one DynRealm for which AuthContextUtils.getUsername() owns entitlement
- if (!authorized && key != null) {
- authorized = findDynRealms(key).stream().anyMatch(authRealms::contains);
+ // 1. check if group is in Realm (or descendants) for which AuthContextUtils.getUsername() owns entitlement
+ if (!authorized) {
+ authorized = authRealms.stream().anyMatch(realm::startsWith);
}
- if (authRealms.isEmpty() || !authorized) {
+ if (!authorized) {
throw new DelegatedAdministrationException(realm, AnyTypeKind.GROUP.name(), key);
}
}
@@ -149,6 +122,49 @@ public class GroupRepoExtImpl extends AbstractAnyRepoExt<Group> implements Group
securityChecks(authRealms, group.getKey(), group.getRealm().getFullPath());
}
+ @Override
+ public boolean isManager(final String key) {
+ Query user = entityManager.createNativeQuery(
+ "SELECT COUNT(*) FROM " + JPAUser.TABLE + " WHERE gManager_id=?");
+ user.setParameter(1, key);
+
+ Query group = entityManager.createNativeQuery(
+ "SELECT COUNT(*) FROM " + JPAGroup.TABLE + " WHERE gManager_id=?");
+ group.setParameter(1, key);
+
+ Query anyObject = entityManager.createNativeQuery(
+ "SELECT COUNT(*) FROM " + JPAAnyObject.TABLE + " WHERE gManager_id=?");
+ anyObject.setParameter(1, key);
+
+ return ((Number) user.getSingleResult()).longValue()
+ + ((Number) group.getSingleResult()).longValue()
+ + ((Number) anyObject.getSingleResult()).longValue() > 0;
+ }
+
+ @Override
+ public List<User> findManagedUsers(final String key) {
+ TypedQuery<User> query = entityManager.createQuery(
+ "SELECT e FROM " + JPAUser.class.getSimpleName() + " e WHERE e.gManager.id=:key", User.class);
+ query.setParameter("key", key);
+ return query.getResultList();
+ }
+
+ @Override
+ public List<Group> findManagedGroups(final String key) {
+ TypedQuery<Group> query = entityManager.createQuery(
+ "SELECT e FROM " + JPAGroup.class.getSimpleName() + " e WHERE e.gManager.id=:key", Group.class);
+ query.setParameter("key", key);
+ return query.getResultList();
+ }
+
+ @Override
+ public List<AnyObject> findManagedAnyObjects(final String key) {
+ TypedQuery<AnyObject> query = entityManager.createQuery(
+ "SELECT e FROM " + JPAAnyObject.class.getSimpleName() + " e WHERE e.gManager.id=:key", AnyObject.class);
+ query.setParameter("key", key);
+ return query.getResultList();
+ }
+
@Override
public Map<String, Long> countByRealm() {
Query query = entityManager.createQuery(
@@ -161,25 +177,6 @@ public class GroupRepoExtImpl extends AbstractAnyRepoExt<Group> implements Group
result -> ((Number) result[1]).longValue()));
}
- @Transactional(readOnly = true)
- @Override
- public List<Group> findOwnedByUser(final String userKey) {
- User owner = userDAO.findById(userKey).orElse(null);
- if (owner == null) {
- return List.of();
- }
-
- StringBuilder queryString = new StringBuilder("SELECT e FROM ").append(anyUtils.anyClass().getSimpleName())
- .append(" e WHERE e.userOwner=:owner ");
- userDAO.findAllGroupKeys(owner).forEach(groupKey -> queryString.
- append("OR e.groupOwner.id='").append(groupKey).append("' "));
-
- TypedQuery<Group> query = entityManager.createQuery(queryString.toString(), Group.class);
- query.setParameter("owner", owner);
-
- return query.getResultList();
- }
-
@Transactional(readOnly = true)
@Override
public Collection<String> findAllResourceKeys(final String key) {
@@ -241,74 +238,8 @@ public class GroupRepoExtImpl extends AbstractAnyRepoExt<Group> implements Group
return entityManager.merge(group);
}
- @Override
- public Group saveAndRefreshDynMemberships(final Group group) {
- Group merged = save(group);
-
- // refresh dynamic memberships
- clearUDynMembers(merged);
- if (merged.getUDynMembership() != null) {
- SearchCond cond = SearchCondConverter.convert(searchCondVisitor, merged.getUDynMembership().getFIQLCond());
- long count = anySearchDAO.count(
- realmDAO.getRoot(), true, Set.of(SyncopeConstants.ROOT_REALM), cond, AnyTypeKind.USER);
- for (int page = 0; page <= (count / AnyDAO.DEFAULT_PAGE_SIZE); page++) {
- List<User> matching = anySearchDAO.search(
- realmDAO.getRoot(),
- true,
- Set.of(SyncopeConstants.ROOT_REALM),
- cond,
- PageRequest.of(page, AnyDAO.DEFAULT_PAGE_SIZE),
- AnyTypeKind.USER);
-
- matching.forEach(user -> {
- Query insert = entityManager.createNativeQuery(
- "INSERT INTO " + UDYNMEMB_TABLE + " VALUES(?, ?)");
- insert.setParameter(1, user.getKey());
- insert.setParameter(2, merged.getKey());
- insert.executeUpdate();
-
- publisher.publishEvent(
- new EntityLifecycleEvent<>(this, SyncDeltaType.UPDATE, user, AuthContextUtils.getDomain()));
- });
- }
- }
- clearADynMembers(merged);
- merged.getADynMemberships().forEach(memb -> {
- SearchCond cond = SearchCondConverter.convert(searchCondVisitor, memb.getFIQLCond());
- long count = anySearchDAO.count(
- realmDAO.getRoot(), true, Set.of(SyncopeConstants.ROOT_REALM), cond, AnyTypeKind.ANY_OBJECT);
- for (int page = 0; page <= (count / AnyDAO.DEFAULT_PAGE_SIZE); page++) {
- List<AnyObject> matching = anySearchDAO.search(
- realmDAO.getRoot(),
- true,
- Set.of(SyncopeConstants.ROOT_REALM),
- cond,
- PageRequest.of(page, AnyDAO.DEFAULT_PAGE_SIZE),
- AnyTypeKind.ANY_OBJECT);
-
- matching.forEach(any -> {
- Query insert = entityManager.createNativeQuery(
- "INSERT INTO " + ADYNMEMB_TABLE + " VALUES(?, ?, ?)");
- insert.setParameter(1, any.getType().getKey());
- insert.setParameter(2, any.getKey());
- insert.setParameter(3, merged.getKey());
- insert.executeUpdate();
-
- publisher.publishEvent(
- new EntityLifecycleEvent<>(this, SyncDeltaType.UPDATE, any, AuthContextUtils.getDomain()));
- });
- }
- });
-
- dynRealmDAO.refreshDynMemberships(merged);
-
- return merged;
- }
-
@Override
public void delete(final Group group) {
- dynRealmDAO.removeDynMemberships(group.getKey());
-
findAMemberships(group).forEach(membership -> {
AnyObject leftEnd = membership.getLeftEnd();
leftEnd.remove(membership);
@@ -331,9 +262,6 @@ public class GroupRepoExtImpl extends AbstractAnyRepoExt<Group> implements Group
new EntityLifecycleEvent<>(this, SyncDeltaType.UPDATE, leftEnd, AuthContextUtils.getDomain()));
});
- clearUDynMembers(group);
- clearADynMembers(group);
-
entityManager.remove(group);
}
@@ -346,218 +274,4 @@ public class GroupRepoExtImpl extends AbstractAnyRepoExt<Group> implements Group
return query.getResultList();
}
-
- @Override
- public long countADynMembers(final Group group) {
- Query query = entityManager.createNativeQuery(
- "SELECT COUNT(DISTINCT any_id) FROM " + ADYNMEMB_TABLE + " WHERE group_id=?");
- query.setParameter(1, group.getKey());
-
- return ((Number) query.getSingleResult()).longValue();
- }
-
- @Override
- public long countUDynMembers(final Group group) {
- if (group.getUDynMembership() == null) {
- return 0;
- }
-
- Query query = entityManager.createNativeQuery(
- "SELECT COUNT(DISTINCT any_id) FROM " + UDYNMEMB_TABLE + " WHERE group_id=?");
- query.setParameter(1, group.getKey());
-
- return ((Number) query.getSingleResult()).longValue();
- }
-
- @Transactional(readOnly = true)
- @Override
- public List<String> findADynMembers(final Group group) {
- List<String> result = new ArrayList<>();
-
- group.getADynMemberships().forEach(memb -> {
- Query query = entityManager.createNativeQuery(
- "SELECT DISTINCT any_id FROM " + ADYNMEMB_TABLE + " WHERE group_id=? AND anyType_id=?");
- query.setParameter(1, group.getKey());
- query.setParameter(2, memb.getAnyType().getKey());
-
- @SuppressWarnings("unchecked")
- List<Object> queryResult = query.getResultList();
- result.addAll(queryResult.stream().
- map(Object::toString).
- filter(anyObject -> !result.contains(anyObject)).
- toList());
- });
-
- return result;
- }
-
- @Override
- public List<String> findUDynMembers(final Group group) {
- if (group.getUDynMembership() == null) {
- return List.of();
- }
-
- Query query = entityManager.createNativeQuery(
- "SELECT DISTINCT any_id FROM " + UDYNMEMB_TABLE + " WHERE group_id=?");
- query.setParameter(1, group.getKey());
-
- @SuppressWarnings("unchecked")
- List<Object> result = query.getResultList();
- return result.stream().
- map(Object::toString).
- toList();
- }
-
- @Override
- public void clearADynMembers(final Group group) {
- Query delete = entityManager.createNativeQuery("DELETE FROM " + ADYNMEMB_TABLE + " WHERE group_id=?");
- delete.setParameter(1, group.getKey());
- delete.executeUpdate();
- }
-
- @Override
- public void clearUDynMembers(final Group group) {
- Query delete = entityManager.createNativeQuery("DELETE FROM " + UDYNMEMB_TABLE + " WHERE group_id=?");
- delete.setParameter(1, group.getKey());
- delete.executeUpdate();
- }
-
- protected List<ADynGroupMembership> findWithADynMemberships(final AnyType anyType) {
- TypedQuery<ADynGroupMembership> query = entityManager.createQuery(
- "SELECT e FROM " + JPAADynGroupMembership.class.getSimpleName() + " e WHERE e.anyType=:anyType",
- ADynGroupMembership.class);
- query.setParameter("anyType", anyType);
- return query.getResultList();
- }
-
- @Transactional
- @Override
- public GroupDAO.DynMembershipInfo refreshDynMemberships(final AnyObject anyObject) {
- Set<String> before = new HashSet<>();
- Set<String> after = new HashSet<>();
- findWithADynMemberships(anyObject.getType()).forEach(memb -> {
- boolean matches = anyMatchDAO.matches(
- anyObject, SearchCondConverter.convert(searchCondVisitor, memb.getFIQLCond()));
- if (matches) {
- after.add(memb.getGroup().getKey());
- }
-
- Query query = entityManager.createNativeQuery(
- "SELECT COUNT(group_id) FROM " + ADYNMEMB_TABLE + " WHERE group_id=? AND any_id=?");
- query.setParameter(1, memb.getGroup().getKey());
- query.setParameter(2, anyObject.getKey());
- boolean existing = ((Number) query.getSingleResult()).longValue() > 0;
- if (existing) {
- before.add(memb.getGroup().getKey());
- }
-
- if (matches && !existing) {
- Query insert = entityManager.createNativeQuery(
- "INSERT INTO " + ADYNMEMB_TABLE + " VALUES(?, ?, ?)");
- insert.setParameter(1, anyObject.getType().getKey());
- insert.setParameter(2, anyObject.getKey());
- insert.setParameter(3, memb.getGroup().getKey());
- insert.executeUpdate();
- } else if (!matches && existing) {
- Query delete = entityManager.createNativeQuery(
- "DELETE FROM " + ADYNMEMB_TABLE + " WHERE group_id=? AND any_id=?");
- delete.setParameter(1, memb.getGroup().getKey());
- delete.setParameter(2, anyObject.getKey());
- delete.executeUpdate();
- }
-
- publisher.publishEvent(new EntityLifecycleEvent<>(
- this, SyncDeltaType.UPDATE, memb.getGroup(), AuthContextUtils.getDomain()));
- });
-
- return new GroupDAO.DynMembershipInfo(before, after);
- }
-
- @Override
- public Set<String> removeDynMemberships(final AnyObject anyObject) {
- List<Group> dynGroups = anyObjectDAO.findDynGroups(anyObject.getKey());
-
- Query delete = entityManager.createNativeQuery("DELETE FROM " + ADYNMEMB_TABLE + " WHERE any_id=?");
- delete.setParameter(1, anyObject.getKey());
- delete.executeUpdate();
-
- Set<String> before = new HashSet<>();
- dynGroups.forEach(group -> {
- before.add(group.getKey());
-
- publisher.publishEvent(new EntityLifecycleEvent<>(
- this, SyncDeltaType.UPDATE, group, AuthContextUtils.getDomain()));
- });
-
- return before;
- }
-
- protected List<UDynGroupMembership> findWithUDynMemberships() {
- TypedQuery<UDynGroupMembership> query = entityManager.createQuery(
- "SELECT e FROM " + JPAUDynGroupMembership.class.getSimpleName() + " e",
- UDynGroupMembership.class);
-
- return query.getResultList();
- }
-
- @Transactional
- @Override
- public GroupDAO.DynMembershipInfo refreshDynMemberships(final User user) {
- Set<String> before = new HashSet<>();
- Set<String> after = new HashSet<>();
- findWithUDynMemberships().forEach(memb -> {
- boolean matches = anyMatchDAO.matches(
- user, SearchCondConverter.convert(searchCondVisitor, memb.getFIQLCond()));
- if (matches) {
- after.add(memb.getGroup().getKey());
- }
-
- Query query = entityManager.createNativeQuery(
- "SELECT COUNT(group_id) FROM " + UDYNMEMB_TABLE + " WHERE group_id=? AND any_id=?");
- query.setParameter(1, memb.getGroup().getKey());
- query.setParameter(2, user.getKey());
- boolean existing = ((Number) query.getSingleResult()).longValue() > 0;
- if (existing) {
- before.add(memb.getGroup().getKey());
- }
-
- if (matches && !existing) {
- Query insert = entityManager.createNativeQuery(
- "INSERT INTO " + UDYNMEMB_TABLE + " VALUES(?, ?)");
- insert.setParameter(1, user.getKey());
- insert.setParameter(2, memb.getGroup().getKey());
- insert.executeUpdate();
- } else if (!matches && existing) {
- Query delete = entityManager.createNativeQuery(
- "DELETE FROM " + UDYNMEMB_TABLE + " WHERE group_id=? AND any_id=?");
- delete.setParameter(1, memb.getGroup().getKey());
- delete.setParameter(2, user.getKey());
- delete.executeUpdate();
- }
-
- publisher.publishEvent(new EntityLifecycleEvent<>(
- this, SyncDeltaType.UPDATE, memb.getGroup(), AuthContextUtils.getDomain()));
- });
-
- return new GroupDAO.DynMembershipInfo(before, after);
- }
-
- @Override
- public Set<String> removeDynMemberships(final User user) {
- List<Group> dynGroups = userDAO.findDynGroups(user.getKey());
-
- Query delete = entityManager.createNativeQuery("DELETE FROM " + UDYNMEMB_TABLE + " WHERE any_id=?");
- delete.setParameter(1, user.getKey());
- delete.executeUpdate();
-
- Set<String> before = new HashSet<>();
- dynGroups.forEach(group -> {
- before.add(group.getKey());
-
- publisher.publishEvent(new EntityLifecycleEvent<>(
- this, SyncDeltaType.UPDATE, group, AuthContextUtils.getDomain()));
- });
-
- return before;
- }
}
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/repo/RoleRepoExt.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/repo/RoleRepoExt.java
index 44ed439c99..bfa3fcd12c 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/repo/RoleRepoExt.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/repo/RoleRepoExt.java
@@ -18,25 +18,11 @@
*/
package org.apache.syncope.core.persistence.jpa.dao.repo;
-import java.util.List;
import org.apache.syncope.core.persistence.api.entity.Role;
-import org.apache.syncope.core.persistence.api.entity.user.User;
public interface RoleRepoExt {
- String DYNMEMB_TABLE = "DynRoleMembers";
-
Role save(Role role);
void delete(Role role);
-
- Role saveAndRefreshDynMemberships(Role role);
-
- List<String> findDynMembers(Role role);
-
- void clearDynMembers(Role role);
-
- void refreshDynMemberships(User user);
-
- void removeDynMemberships(String key);
}
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/repo/RoleRepoExtImpl.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/repo/RoleRepoExtImpl.java
index a3e94a69b4..f71a29bcfc 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/repo/RoleRepoExtImpl.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/repo/RoleRepoExtImpl.java
@@ -19,52 +19,32 @@
package org.apache.syncope.core.persistence.jpa.dao.repo;
import jakarta.persistence.EntityManager;
-import jakarta.persistence.Query;
import jakarta.persistence.TypedQuery;
-import java.util.List;
-import org.apache.syncope.common.lib.types.AnyTypeKind;
-import org.apache.syncope.core.persistence.api.dao.AnyMatchDAO;
-import org.apache.syncope.core.persistence.api.dao.AnySearchDAO;
import org.apache.syncope.core.persistence.api.dao.DelegationDAO;
import org.apache.syncope.core.persistence.api.entity.Role;
import org.apache.syncope.core.persistence.api.entity.user.User;
-import org.apache.syncope.core.persistence.api.search.SearchCondConverter;
-import org.apache.syncope.core.persistence.api.search.SearchCondVisitor;
import org.apache.syncope.core.persistence.jpa.entity.JPARole;
import org.apache.syncope.core.persistence.jpa.entity.user.JPAUser;
import org.apache.syncope.core.provisioning.api.event.EntityLifecycleEvent;
import org.apache.syncope.core.spring.security.AuthContextUtils;
import org.identityconnectors.framework.common.objects.SyncDeltaType;
import org.springframework.context.ApplicationEventPublisher;
-import org.springframework.transaction.annotation.Transactional;
public class RoleRepoExtImpl implements RoleRepoExt {
protected final ApplicationEventPublisher publisher;
- protected final AnyMatchDAO anyMatchDAO;
-
- protected final AnySearchDAO anySearchDAO;
-
protected final DelegationDAO delegationDAO;
- protected final SearchCondVisitor searchCondVisitor;
-
protected final EntityManager entityManager;
public RoleRepoExtImpl(
final ApplicationEventPublisher publisher,
- final AnyMatchDAO anyMatchDAO,
- final AnySearchDAO anySearchDAO,
final DelegationDAO delegationDAO,
- final SearchCondVisitor searchCondVisitor,
final EntityManager entityManager) {
this.publisher = publisher;
- this.anyMatchDAO = anyMatchDAO;
- this.anySearchDAO = anySearchDAO;
this.delegationDAO = delegationDAO;
- this.searchCondVisitor = searchCondVisitor;
this.entityManager = entityManager;
}
@@ -74,31 +54,6 @@ public class RoleRepoExtImpl implements RoleRepoExt {
return entityManager.merge(role);
}
- @Override
- public Role saveAndRefreshDynMemberships(final Role role) {
- Role merged = save(role);
-
- // refresh dynamic memberships
- clearDynMembers(merged);
- if (merged.getDynMembershipCond() != null) {
- List<User> matching = anySearchDAO.search(
- SearchCondConverter.convert(searchCondVisitor, merged.getDynMembershipCond()),
- AnyTypeKind.USER);
-
- matching.forEach(user -> {
- Query insert = entityManager.createNativeQuery("INSERT INTO " + DYNMEMB_TABLE + " VALUES(?, ?)");
- insert.setParameter(1, user.getKey());
- insert.setParameter(2, merged.getKey());
- insert.executeUpdate();
-
- publisher.publishEvent(
- new EntityLifecycleEvent<>(this, SyncDeltaType.UPDATE, user, AuthContextUtils.getDomain()));
- });
- }
-
- return merged;
- }
-
@Override
public void delete(final Role role) {
TypedQuery<User> query = entityManager.createQuery(
@@ -111,72 +66,8 @@ public class RoleRepoExtImpl implements RoleRepoExt {
new EntityLifecycleEvent<>(this, SyncDeltaType.UPDATE, user, AuthContextUtils.getDomain()));
});
- clearDynMembers(role);
-
delegationDAO.findByRoles(role).forEach(delegation -> delegation.getRoles().remove(role));
entityManager.remove(role);
}
-
- @Override
- public List<String> findDynMembers(final Role role) {
- if (role.getDynMembershipCond() == null) {
- return List.of();
- }
-
- Query query = entityManager.createNativeQuery("SELECT any_id FROM " + DYNMEMB_TABLE + " WHERE role_id=?");
- query.setParameter(1, role.getKey());
-
- @SuppressWarnings("unchecked")
- List<Object> result = query.getResultList();
- return result.stream().
- map(Object::toString).
- toList();
- }
-
- @Override
- public void clearDynMembers(final Role role) {
- Query delete = entityManager.createNativeQuery("DELETE FROM " + DYNMEMB_TABLE + " WHERE role_id=?");
- delete.setParameter(1, role.getKey());
- delete.executeUpdate();
- }
-
- @Transactional
- @Override
- public void refreshDynMemberships(final User user) {
- entityManager.createQuery(
- "SELECT e FROM " + JPARole.class.getSimpleName() + " e "
- + "WHERE e.dynMembershipCond IS NOT NULL", Role.class).getResultStream().forEach(role -> {
- boolean matches = anyMatchDAO.matches(
- user,
- SearchCondConverter.convert(searchCondVisitor, role.getDynMembershipCond()));
-
- Query query = entityManager.createNativeQuery(
- "SELECT COUNT(role_id) FROM " + DYNMEMB_TABLE + " WHERE any_id=? AND role_id=?");
- query.setParameter(1, user.getKey());
- query.setParameter(2, role.getKey());
- boolean existing = ((Number) query.getSingleResult()).longValue() > 0;
-
- if (matches && !existing) {
- Query insert = entityManager.createNativeQuery(
- "INSERT INTO " + DYNMEMB_TABLE + " VALUES(?, ?)");
- insert.setParameter(1, user.getKey());
- insert.setParameter(2, role.getKey());
- insert.executeUpdate();
- } else if (!matches && existing) {
- Query delete = entityManager.createNativeQuery(
- "DELETE FROM " + DYNMEMB_TABLE + " WHERE role_id=? AND any_id=?");
- delete.setParameter(1, role.getKey());
- delete.setParameter(2, user.getKey());
- delete.executeUpdate();
- }
- });
- }
-
- @Override
- public void removeDynMemberships(final String key) {
- Query delete = entityManager.createNativeQuery("DELETE FROM " + DYNMEMB_TABLE + " WHERE any_id=?");
- delete.setParameter(1, key);
- delete.executeUpdate();
- }
}
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/repo/UserRepoExt.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/repo/UserRepoExt.java
index f91d920675..7be164041c 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/repo/UserRepoExt.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/repo/UserRepoExt.java
@@ -22,9 +22,9 @@ import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Set;
-import org.apache.syncope.core.persistence.api.dao.GroupDAO;
import org.apache.syncope.core.persistence.api.entity.ExternalResource;
import org.apache.syncope.core.persistence.api.entity.Role;
+import org.apache.syncope.core.persistence.api.entity.anyobject.AnyObject;
import org.apache.syncope.core.persistence.api.entity.group.Group;
import org.apache.syncope.core.persistence.api.entity.user.UMembership;
import org.apache.syncope.core.persistence.api.entity.user.User;
@@ -33,18 +33,22 @@ public interface UserRepoExt extends AnyRepoExt<User> {
void securityChecks(Set<String> authRealms, String key, String realm, Collection<String> groups);
+ boolean isManager(String key);
+
+ List<User> findManagedUsers(String key);
+
+ List<Group> findManagedGroups(String key);
+
+ List<AnyObject> findManagedAnyObjects(String key);
+
Map<String, Long> countByRealm();
Map<String, Long> countByStatus();
void deleteMembership(UMembership membership);
- List<Role> findDynRoles(String key);
-
Collection<Role> findAllRoles(User user);
- List<Group> findDynGroups(String key);
-
Collection<Group> findAllGroups(User user);
Collection<String> findAllGroupKeys(User user);
@@ -53,8 +57,6 @@ public interface UserRepoExt extends AnyRepoExt<User> {
Collection<ExternalResource> findAllResources(User user);
- GroupDAO.DynMembershipInfo saveAndGetDynGroupMembs(User user);
-
boolean linkedAccountExists(String userKey, String connObjectKeyValue);
@Override
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/repo/UserRepoExtImpl.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/repo/UserRepoExtImpl.java
index 1a0502052e..75221b6edc 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/repo/UserRepoExtImpl.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/repo/UserRepoExtImpl.java
@@ -20,6 +20,8 @@ package org.apache.syncope.core.persistence.jpa.dao.repo;
import jakarta.persistence.EntityManager;
import jakarta.persistence.Query;
+import jakarta.persistence.TypedQuery;
+import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
import java.util.List;
@@ -28,12 +30,10 @@ import java.util.Objects;
import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors;
-import org.apache.commons.lang3.tuple.Pair;
import org.apache.syncope.common.lib.types.AnyTypeKind;
import org.apache.syncope.common.lib.types.IdRepoEntitlement;
import org.apache.syncope.core.persistence.api.dao.AccessTokenDAO;
import org.apache.syncope.core.persistence.api.dao.DelegationDAO;
-import org.apache.syncope.core.persistence.api.dao.DynRealmDAO;
import org.apache.syncope.core.persistence.api.dao.FIQLQueryDAO;
import org.apache.syncope.core.persistence.api.dao.GroupDAO;
import org.apache.syncope.core.persistence.api.dao.PlainSchemaDAO;
@@ -42,12 +42,16 @@ import org.apache.syncope.core.persistence.api.entity.AnyUtilsFactory;
import org.apache.syncope.core.persistence.api.entity.ExternalResource;
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.anyobject.AnyObject;
import org.apache.syncope.core.persistence.api.entity.group.Group;
import org.apache.syncope.core.persistence.api.entity.user.UMembership;
import org.apache.syncope.core.persistence.api.entity.user.User;
import org.apache.syncope.core.persistence.api.utils.RealmUtils;
import org.apache.syncope.core.persistence.common.dao.AnyFinder;
+import org.apache.syncope.core.persistence.jpa.entity.anyobject.JPAAnyObject;
+import org.apache.syncope.core.persistence.jpa.entity.group.JPAGroup;
import org.apache.syncope.core.persistence.jpa.entity.user.JPALinkedAccount;
+import org.apache.syncope.core.persistence.jpa.entity.user.JPAUMembership;
import org.apache.syncope.core.persistence.jpa.entity.user.JPAUser;
import org.apache.syncope.core.spring.security.AuthContextUtils;
import org.apache.syncope.core.spring.security.DelegatedAdministrationException;
@@ -71,7 +75,6 @@ public class UserRepoExtImpl extends AbstractAnyRepoExt<User> implements UserRep
public UserRepoExtImpl(
final AnyUtilsFactory anyUtilsFactory,
- final DynRealmDAO dynRealmDAO,
final PlainSchemaDAO plainSchemaDAO,
final RoleDAO roleDAO,
final AccessTokenDAO accessTokenDAO,
@@ -83,7 +86,6 @@ public class UserRepoExtImpl extends AbstractAnyRepoExt<User> implements UserRep
final AnyFinder anyFinder) {
super(
- dynRealmDAO,
plainSchemaDAO,
entityManager,
anyFinder,
@@ -96,6 +98,96 @@ public class UserRepoExtImpl extends AbstractAnyRepoExt<User> implements UserRep
this.securityProperties = securityProperties;
}
+ @Override
+ public boolean isManager(final String key) {
+ Query user = entityManager.createNativeQuery(
+ "SELECT COUNT(*) FROM " + JPAUser.TABLE + " WHERE uManager_id=?");
+ user.setParameter(1, key);
+
+ Query group = entityManager.createNativeQuery(
+ "SELECT COUNT(*) FROM " + JPAGroup.TABLE + " WHERE uManager_id=?");
+ group.setParameter(1, key);
+
+ Query anyObject = entityManager.createNativeQuery(
+ "SELECT COUNT(*) FROM " + JPAAnyObject.TABLE + " WHERE uManager_id=?");
+ anyObject.setParameter(1, key);
+
+ return ((Number) user.getSingleResult()).longValue()
+ + ((Number) group.getSingleResult()).longValue()
+ + ((Number) anyObject.getSingleResult()).longValue() > 0;
+ }
+
+ @Override
+ public List<User> findManagedUsers(final String key) {
+ List<User> result = new ArrayList<>();
+
+ // 1. users having uManager set to the requested user
+ TypedQuery<User> users = entityManager.createQuery(
+ "SELECT e FROM " + JPAUser.class.getSimpleName() + " e WHERE e.uManager.id=:key", User.class);
+ users.setParameter("key", key);
+ result.addAll(users.getResultList());
+
+ // 2. user members of groups having uManager set to the requested user
+ findManagedGroupKeys(key).forEach(group -> groupDAO.findUMembers(group).
+ forEach(member -> Optional.ofNullable(entityManager.find(JPAUser.class, member)).
+ ifPresent(result::add)));
+
+ // 3. users managed by groups the requested user is member of
+ Query query = entityManager.createNativeQuery(
+ "SELECT DISTINCT group_id FROM " + JPAUMembership.TABLE + " WHERE user_id=?");
+ query.setParameter(1, key);
+ @SuppressWarnings("unchecked")
+ List<Object> groups = query.getResultList();
+ groups.stream().map(String.class::cast).forEach(group -> result.addAll(groupDAO.findManagedUsers(group)));
+
+ return result.stream().distinct().toList();
+ }
+
+ protected List<String> findManagedGroupKeys(final String key) {
+ Query query = entityManager.createNativeQuery(
+ "SELECT DISTINCT id FROM " + JPAGroup.TABLE + " WHERE uManager_id=?");
+ query.setParameter(1, key);
+
+ @SuppressWarnings("unchecked")
+ List<Object> result = query.getResultList();
+ return result.stream().map(String.class::cast).toList();
+ }
+
+ @Override
+ public List<Group> findManagedGroups(final String key) {
+ return findManagedGroupKeys(key).stream().
+ map(group -> Optional.ofNullable(entityManager.find(JPAGroup.class, group))).
+ flatMap(Optional::stream).
+ map(Group.class::cast).
+ toList();
+ }
+
+ @Override
+ public List<AnyObject> findManagedAnyObjects(final String key) {
+ List<AnyObject> result = new ArrayList<>();
+
+ // 1. anyObjects having uManager set to the requested user
+ TypedQuery<AnyObject> anyObjects = entityManager.createQuery(
+ "SELECT e FROM " + JPAAnyObject.class.getSimpleName() + " e WHERE e.uManager.id=:key", AnyObject.class);
+ anyObjects.setParameter("key", key);
+ result.addAll(anyObjects.getResultList());
+
+ // 2. anyObject members of groups having uManager set to the requested user
+ findManagedGroupKeys(key).forEach(group -> groupDAO.findUMembers(group).
+ forEach(member -> Optional.ofNullable(entityManager.find(JPAAnyObject.class, member)).
+ ifPresent(result::add)));
+
+ // 3. anyObject managed by groups the requested user is member of
+ Query query = entityManager.createNativeQuery(
+ "SELECT DISTINCT group_id FROM " + JPAUMembership.TABLE + " WHERE user_id=?");
+ query.setParameter(1, key);
+ @SuppressWarnings("unchecked")
+ List<Object> groups = query.getResultList();
+ groups.stream().map(String.class::cast).forEach(group -> result.addAll(groupDAO.findManagedAnyObjects(group)));
+
+ return result.stream().distinct().toList();
+ }
+
@Override
public Map<String, Long> countByRealm() {
Query query = entityManager.createQuery(
@@ -128,18 +220,21 @@ public class UserRepoExtImpl extends AbstractAnyRepoExt<User> implements UserRep
final String realm,
final Collection<String> groups) {
- // 1. check if AuthContextUtils.getUsername() is owner of at least one group of which user is member
+ // 0. check if AuthContextUtils.getUsername() is manager of the given user
boolean authorized = authRealms.stream().
- map(authRealm -> RealmUtils.GroupOwnerRealm.of(authRealm).orElse(null)).
+ map(authRealm -> RealmUtils.ManagerRealm.of(authRealm).orElse(null)).
filter(Objects::nonNull).
- anyMatch(pair -> groups.contains(pair.groupKey()));
+ anyMatch(managerRealm -> key.equals(managerRealm.anyKey()));
- // 2. check if user is in at least one DynRealm for which AuthContextUtils.getUsername() owns entitlement
- if (!authorized && key != null) {
- authorized = findDynRealms(key).stream().anyMatch(authRealms::contains);
+ // 1. check if AuthContextUtils.getUsername() is manager of at least one group of which user is member
+ if (!authorized) {
+ authorized = authRealms.stream().
+ map(authRealm -> RealmUtils.ManagerRealm.of(authRealm).orElse(null)).
+ filter(Objects::nonNull).
+ anyMatch(managerRealm -> groups.contains(managerRealm.anyKey()));
}
- // 3. check if user is in Realm (or descendants) for which AuthContextUtils.getUsername() owns entitlement
+ // 2. check if user is in Realm (or descendants) for which AuthContextUtils.getUsername() owns entitlement
if (!authorized) {
authorized = authRealms.stream().anyMatch(realm::startsWith);
}
@@ -182,37 +277,21 @@ public class UserRepoExtImpl extends AbstractAnyRepoExt<User> implements UserRep
return merged;
}
- protected Pair<User, GroupDAO.DynMembershipInfo> doSave(final User user) {
- entityManager.flush();
+ @SuppressWarnings("unchecked")
+ @Override
+ public <S extends User> S save(final S user) {
+ checkBeforeSave(user);
+
User merged = entityManager.merge(user);
// ensure that entity listeners are invoked at this point
entityManager.flush();
- roleDAO.refreshDynMemberships(merged);
- GroupDAO.DynMembershipInfo dynGroupMembs = groupDAO.refreshDynMemberships(merged);
- dynRealmDAO.refreshDynMemberships(merged);
-
- return Pair.of(merged, dynGroupMembs);
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public <S extends User> S save(final S user) {
- return (S) doSave(checkBeforeSave(user)).getLeft();
- }
-
- @Override
- public GroupDAO.DynMembershipInfo saveAndGetDynGroupMembs(final User user) {
- return doSave(checkBeforeSave(user)).getRight();
+ return (S) merged;
}
@Override
public void delete(final User user) {
- roleDAO.removeDynMemberships(user.getKey());
- groupDAO.removeDynMemberships(user);
- dynRealmDAO.removeDynMemberships(user.getKey());
-
delegationDAO.findByDelegating(user).forEach(delegationDAO::delete);
delegationDAO.findByDelegated(user).forEach(delegationDAO::delete);
@@ -228,52 +307,14 @@ public class UserRepoExtImpl extends AbstractAnyRepoExt<User> implements UserRep
public Collection<Role> findAllRoles(final User user) {
Set<Role> result = new HashSet<>();
result.addAll(user.getRoles());
- result.addAll(findDynRoles(user.getKey()));
return result;
}
- @Transactional(propagation = Propagation.REQUIRES_NEW, readOnly = true)
- @Override
- public List<Role> findDynRoles(final String key) {
- Query query = entityManager.createNativeQuery(
- "SELECT role_id FROM " + RoleRepoExt.DYNMEMB_TABLE + " WHERE any_id=?");
- query.setParameter(1, key);
-
- @SuppressWarnings("unchecked")
- List<Object> result = query.getResultList();
- return result.stream().
- map(roleKey -> roleDAO.findById(roleKey.toString())).
- flatMap(Optional::stream).
- distinct().
- collect(Collectors.toList());
- }
-
- @Transactional(propagation = Propagation.REQUIRES_NEW, readOnly = true)
- @Override
- public List<Group> findDynGroups(final String key) {
- Query query = entityManager.createNativeQuery(
- "SELECT group_id FROM " + GroupRepoExt.UDYNMEMB_TABLE + " WHERE any_id=?");
- query.setParameter(1, key);
-
- @SuppressWarnings("unchecked")
- List<Object> result = query.getResultList();
- return result.stream().
- map(groupKey -> groupDAO.findById(groupKey.toString())).
- flatMap(Optional::stream).
- distinct().
- collect(Collectors.toList());
- }
-
@Transactional(propagation = Propagation.REQUIRES_NEW, readOnly = true)
@Override
public Collection<Group> findAllGroups(final User user) {
- Set<Group> result = new HashSet<>();
- result.addAll(user.getMemberships().stream().
- map(UMembership::getRightEnd).collect(Collectors.toSet()));
- result.addAll(findDynGroups(user.getKey()));
-
- return result;
+ return user.getMemberships().stream().map(UMembership::getRightEnd).collect(Collectors.toSet());
}
@Transactional(propagation = Propagation.REQUIRES_NEW, readOnly = true)
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AbstractAny.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AbstractAny.java
index 62534271c1..76eb8507fe 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AbstractAny.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AbstractAny.java
@@ -25,7 +25,11 @@ import jakarta.persistence.MappedSuperclass;
import java.time.OffsetDateTime;
import org.apache.syncope.core.persistence.api.entity.Any;
import org.apache.syncope.core.persistence.api.entity.Realm;
+import org.apache.syncope.core.persistence.api.entity.group.Group;
+import org.apache.syncope.core.persistence.api.entity.user.User;
import org.apache.syncope.core.persistence.common.validation.AnyCheck;
+import org.apache.syncope.core.persistence.jpa.entity.group.JPAGroup;
+import org.apache.syncope.core.persistence.jpa.entity.user.JPAUser;
@AnyCheck
@MappedSuperclass
@@ -63,6 +67,12 @@ public abstract class AbstractAny extends AbstractAttributable implements Any {
@ManyToOne(fetch = FetchType.EAGER, optional = false)
private JPARealm realm;
+ @ManyToOne
+ private JPAUser uManager;
+
+ @ManyToOne
+ private JPAGroup gManager;
+
@Column(nullable = true)
private String status;
@@ -143,6 +153,28 @@ public abstract class AbstractAny extends AbstractAttributable implements Any {
this.realm = (JPARealm) realm;
}
+ @Override
+ public User getUManager() {
+ return uManager;
+ }
+
+ @Override
+ public void setUManager(final User manager) {
+ checkType(manager, JPAUser.class);
+ this.uManager = (JPAUser) manager;
+ }
+
+ @Override
+ public Group getGManager() {
+ return gManager;
+ }
+
+ @Override
+ public void setGManager(final Group manager) {
+ checkType(manager, JPAGroup.class);
+ this.gManager = (JPAGroup) manager;
+ }
+
@Override
public String getStatus() {
return status;
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AbstractDynMembership.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AbstractDynMembership.java
deleted file mode 100644
index 4dd4727c02..0000000000
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AbstractDynMembership.java
+++ /dev/null
@@ -1,44 +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.core.persistence.jpa.entity;
-
-import jakarta.persistence.MappedSuperclass;
-import jakarta.validation.constraints.NotNull;
-import org.apache.syncope.core.persistence.api.entity.Any;
-import org.apache.syncope.core.persistence.api.entity.DynMembership;
-
-@MappedSuperclass
-public abstract class AbstractDynMembership<A extends Any>
- extends AbstractGeneratedKeyEntity implements DynMembership<A> {
-
- private static final long serialVersionUID = 921821654690948787L;
-
- @NotNull
- private String fiql;
-
- @Override
- public String getFIQLCond() {
- return fiql;
- }
-
- @Override
- public void setFIQLCond(final String fiql) {
- this.fiql = fiql;
- }
-}
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AbstractEntityFactory.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AbstractEntityFactory.java
index 25f86b426c..5252e878c4 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AbstractEntityFactory.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AbstractEntityFactory.java
@@ -29,8 +29,6 @@ import org.apache.syncope.core.persistence.api.entity.Batch;
import org.apache.syncope.core.persistence.api.entity.ConnInstance;
import org.apache.syncope.core.persistence.api.entity.Delegation;
import org.apache.syncope.core.persistence.api.entity.DerSchema;
-import org.apache.syncope.core.persistence.api.entity.DynRealm;
-import org.apache.syncope.core.persistence.api.entity.DynRealmMembership;
import org.apache.syncope.core.persistence.api.entity.Entity;
import org.apache.syncope.core.persistence.api.entity.EntityFactory;
import org.apache.syncope.core.persistence.api.entity.ExternalResource;
@@ -58,7 +56,6 @@ import org.apache.syncope.core.persistence.api.entity.am.PasswordManagement;
import org.apache.syncope.core.persistence.api.entity.am.SAML2IdPEntity;
import org.apache.syncope.core.persistence.api.entity.am.SAML2SPClientApp;
import org.apache.syncope.core.persistence.api.entity.am.WAConfigEntry;
-import org.apache.syncope.core.persistence.api.entity.anyobject.ADynGroupMembership;
import org.apache.syncope.core.persistence.api.entity.anyobject.AMembership;
import org.apache.syncope.core.persistence.api.entity.anyobject.ARelationship;
import org.apache.syncope.core.persistence.api.entity.anyobject.AnyObject;
@@ -91,7 +88,6 @@ import org.apache.syncope.core.persistence.api.entity.task.PushTask;
import org.apache.syncope.core.persistence.api.entity.task.SchedTask;
import org.apache.syncope.core.persistence.api.entity.user.LinkedAccount;
import org.apache.syncope.core.persistence.api.entity.user.SecurityQuestion;
-import org.apache.syncope.core.persistence.api.entity.user.UDynGroupMembership;
import org.apache.syncope.core.persistence.api.entity.user.UMembership;
import org.apache.syncope.core.persistence.api.entity.user.URelationship;
import org.apache.syncope.core.persistence.api.entity.user.User;
@@ -105,7 +101,6 @@ import org.apache.syncope.core.persistence.jpa.entity.am.JPAPasswordManagement;
import org.apache.syncope.core.persistence.jpa.entity.am.JPASAML2IdPEntity;
import org.apache.syncope.core.persistence.jpa.entity.am.JPASAML2SPClientApp;
import org.apache.syncope.core.persistence.jpa.entity.am.JPAWAConfigEntry;
-import org.apache.syncope.core.persistence.jpa.entity.anyobject.JPAADynGroupMembership;
import org.apache.syncope.core.persistence.jpa.entity.anyobject.JPAAMembership;
import org.apache.syncope.core.persistence.jpa.entity.anyobject.JPAARelationship;
import org.apache.syncope.core.persistence.jpa.entity.anyobject.JPAAnyObject;
@@ -138,7 +133,6 @@ import org.apache.syncope.core.persistence.jpa.entity.task.JPAPushTask;
import org.apache.syncope.core.persistence.jpa.entity.task.JPASchedTask;
import org.apache.syncope.core.persistence.jpa.entity.user.JPALinkedAccount;
import org.apache.syncope.core.persistence.jpa.entity.user.JPASecurityQuestion;
-import org.apache.syncope.core.persistence.jpa.entity.user.JPAUDynGroupMembership;
import org.apache.syncope.core.persistence.jpa.entity.user.JPAUMembership;
import org.apache.syncope.core.persistence.jpa.entity.user.JPAURelationship;
import org.apache.syncope.core.persistence.jpa.entity.user.JPAUser;
@@ -153,10 +147,6 @@ abstract class AbstractEntityFactory implements EntityFactory {
if (reference.equals(Realm.class)) {
result = (E) new JPARealm();
- } else if (reference.equals(DynRealm.class)) {
- result = (E) new JPADynRealm();
- } else if (reference.equals(DynRealmMembership.class)) {
- result = (E) new JPADynRealmMembership();
} else if (reference.equals(AnyTemplateRealm.class)) {
result = (E) new JPAAnyTemplateRealm();
} else if (reference.equals(AccountPolicy.class)) {
@@ -245,10 +235,6 @@ abstract class AbstractEntityFactory implements EntityFactory {
result = (E) new JPASecurityQuestion();
} else if (reference.equals(AuditConf.class)) {
result = (E) new JPAAuditConf();
- } else if (reference.equals(ADynGroupMembership.class)) {
- result = (E) new JPAADynGroupMembership();
- } else if (reference.equals(UDynGroupMembership.class)) {
- result = (E) new JPAUDynGroupMembership();
} else if (reference.equals(AccessToken.class)) {
result = (E) new JPAAccessToken();
} else if (reference.equals(Implementation.class)) {
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPADynRealm.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPADynRealm.java
deleted file mode 100644
index d78f54b466..0000000000
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPADynRealm.java
+++ /dev/null
@@ -1,65 +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.core.persistence.jpa.entity;
-
-import jakarta.persistence.Cacheable;
-import jakarta.persistence.CascadeType;
-import jakarta.persistence.Entity;
-import jakarta.persistence.FetchType;
-import jakarta.persistence.OneToMany;
-import jakarta.persistence.Table;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Optional;
-import org.apache.syncope.core.persistence.api.entity.AnyType;
-import org.apache.syncope.core.persistence.api.entity.DynRealm;
-import org.apache.syncope.core.persistence.api.entity.DynRealmMembership;
-import org.apache.syncope.core.persistence.common.validation.DynRealmCheck;
-
-@Entity
-@Table(name = JPADynRealm.TABLE)
-@Cacheable
-@DynRealmCheck
-public class JPADynRealm extends AbstractProvidedKeyEntity implements DynRealm {
-
- private static final long serialVersionUID = -6851035842423560341L;
-
- public static final String TABLE = "DynRealm";
-
- @OneToMany(cascade = CascadeType.ALL, orphanRemoval = true, fetch = FetchType.EAGER, mappedBy = "dynRealm")
- private List<JPADynRealmMembership> dynMemberships = new ArrayList<>();
-
- @Override
- public boolean add(final DynRealmMembership dynRealmMembership) {
- checkType(dynRealmMembership, JPADynRealmMembership.class);
- return this.dynMemberships.add((JPADynRealmMembership) dynRealmMembership);
- }
-
- @Override
- public Optional<? extends DynRealmMembership> getDynMembership(final AnyType anyType) {
- return dynMemberships.stream().
- filter(dynRealmMembership -> anyType != null && anyType.equals(dynRealmMembership.getAnyType())).
- findFirst();
- }
-
- @Override
- public List<? extends DynRealmMembership> getDynMemberships() {
- return dynMemberships;
- }
-}
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPADynRealmMembership.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPADynRealmMembership.java
deleted file mode 100644
index 0996ef8087..0000000000
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPADynRealmMembership.java
+++ /dev/null
@@ -1,78 +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.core.persistence.jpa.entity;
-
-import jakarta.persistence.Entity;
-import jakarta.persistence.ManyToOne;
-import jakarta.persistence.OneToOne;
-import jakarta.persistence.Table;
-import jakarta.validation.constraints.NotNull;
-import org.apache.syncope.core.persistence.api.entity.AnyType;
-import org.apache.syncope.core.persistence.api.entity.DynRealm;
-import org.apache.syncope.core.persistence.api.entity.DynRealmMembership;
-
-@Entity
-@Table(name = JPADynRealmMembership.TABLE)
-public class JPADynRealmMembership extends AbstractGeneratedKeyEntity implements DynRealmMembership {
-
- private static final long serialVersionUID = 8157856850557493134L;
-
- public static final String TABLE = "DynRealmMembership";
-
- @OneToOne
- private JPADynRealm dynRealm;
-
- @ManyToOne
- private JPAAnyType anyType;
-
- @NotNull
- private String fiql;
-
- @Override
- public DynRealm getDynRealm() {
- return dynRealm;
- }
-
- @Override
- public void setDynRealm(final DynRealm dynRealm) {
- checkType(dynRealm, JPADynRealm.class);
- this.dynRealm = (JPADynRealm) dynRealm;
- }
-
- @Override
- public AnyType getAnyType() {
- return anyType;
- }
-
- @Override
- public void setAnyType(final AnyType anyType) {
- checkType(anyType, JPAAnyType.class);
- this.anyType = (JPAAnyType) anyType;
- }
-
- @Override
- public String getFIQLCond() {
- return fiql;
- }
-
- @Override
- public void setFIQLCond(final String fiql) {
- this.fiql = fiql;
- }
-}
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPARole.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPARole.java
index 4217566456..01a733dd81 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPARole.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPARole.java
@@ -39,7 +39,6 @@ import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
-import org.apache.syncope.core.persistence.api.entity.DynRealm;
import org.apache.syncope.core.persistence.api.entity.Realm;
import org.apache.syncope.core.persistence.api.entity.Role;
import org.apache.syncope.core.provisioning.api.serialization.POJOHelper;
@@ -62,8 +61,6 @@ public class JPARole extends AbstractProvidedKeyEntity implements Role {
@Transient
private Set<String> entitlementsSet = new HashSet<>();
- private String dynMembershipCond;
-
@Lob
private String anyLayout;
@@ -77,31 +74,11 @@ public class JPARole extends AbstractProvidedKeyEntity implements Role {
@Valid
private List<JPARealm> realms = new ArrayList<>();
- @ManyToMany(fetch = FetchType.EAGER)
- @JoinTable(joinColumns =
- @JoinColumn(name = "role_id"),
- inverseJoinColumns =
- @JoinColumn(name = "dynamicRealm_id"),
- uniqueConstraints =
- @UniqueConstraint(columnNames = { "role_id", "dynamicRealm_id" }))
- @Valid
- private List<JPADynRealm> dynRealms = new ArrayList<>();
-
@Override
public Set<String> getEntitlements() {
return entitlementsSet;
}
- @Override
- public String getDynMembershipCond() {
- return dynMembershipCond;
- }
-
- @Override
- public void setDynMembershipCond(final String dynMembershipCond) {
- this.dynMembershipCond = dynMembershipCond;
- }
-
@Override
public boolean add(final Realm realm) {
checkType(realm, JPARealm.class);
@@ -113,17 +90,6 @@ public class JPARole extends AbstractProvidedKeyEntity implements Role {
return realms;
}
- @Override
- public boolean add(final DynRealm dynamicRealm) {
- checkType(dynamicRealm, JPADynRealm.class);
- return dynRealms.contains((JPADynRealm) dynamicRealm) || dynRealms.add((JPADynRealm) dynamicRealm);
- }
-
- @Override
- public List<? extends DynRealm> getDynRealms() {
- return dynRealms;
- }
-
@Override
public String getAnyLayout() {
return anyLayout;
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/anyobject/JPAADynGroupMembership.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/anyobject/JPAADynGroupMembership.java
deleted file mode 100644
index 83857fcf3e..0000000000
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/anyobject/JPAADynGroupMembership.java
+++ /dev/null
@@ -1,68 +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.core.persistence.jpa.entity.anyobject;
-
-import jakarta.persistence.Entity;
-import jakarta.persistence.ManyToOne;
-import jakarta.persistence.OneToOne;
-import jakarta.persistence.Table;
-import org.apache.syncope.core.persistence.api.entity.AnyType;
-import org.apache.syncope.core.persistence.api.entity.anyobject.ADynGroupMembership;
-import org.apache.syncope.core.persistence.api.entity.anyobject.AnyObject;
-import org.apache.syncope.core.persistence.api.entity.group.Group;
-import org.apache.syncope.core.persistence.jpa.entity.AbstractDynMembership;
-import org.apache.syncope.core.persistence.jpa.entity.JPAAnyType;
-import org.apache.syncope.core.persistence.jpa.entity.group.JPAGroup;
-
-@Entity
-@Table(name = JPAADynGroupMembership.TABLE)
-public class JPAADynGroupMembership extends AbstractDynMembership<AnyObject> implements ADynGroupMembership {
-
- private static final long serialVersionUID = -7336814163949640354L;
-
- public static final String TABLE = "ADynGroupMembership";
-
- @OneToOne
- private JPAGroup group;
-
- @ManyToOne
- private JPAAnyType anyType;
-
- @Override
- public Group getGroup() {
- return group;
- }
-
- @Override
- public void setGroup(final Group role) {
- checkType(role, JPAGroup.class);
- this.group = (JPAGroup) role;
- }
-
- @Override
- public AnyType getAnyType() {
- return anyType;
- }
-
- @Override
- public void setAnyType(final AnyType anyType) {
- checkType(anyType, JPAAnyType.class);
- this.anyType = (JPAAnyType) anyType;
- }
-}
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGroup.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGroup.java
index a194df7146..25eb993712 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGroup.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGroup.java
@@ -27,9 +27,7 @@ import jakarta.persistence.FetchType;
import jakarta.persistence.JoinColumn;
import jakarta.persistence.JoinTable;
import jakarta.persistence.ManyToMany;
-import jakarta.persistence.ManyToOne;
import jakarta.persistence.OneToMany;
-import jakarta.persistence.OneToOne;
import jakarta.persistence.Table;
import jakarta.persistence.Transient;
import jakarta.persistence.UniqueConstraint;
@@ -46,19 +44,13 @@ import org.apache.syncope.core.persistence.api.entity.AnyTypeClass;
import org.apache.syncope.core.persistence.api.entity.ExternalResource;
import org.apache.syncope.core.persistence.api.entity.PlainAttr;
import org.apache.syncope.core.persistence.api.entity.Relationship;
-import org.apache.syncope.core.persistence.api.entity.anyobject.ADynGroupMembership;
import org.apache.syncope.core.persistence.api.entity.group.GRelationship;
import org.apache.syncope.core.persistence.api.entity.group.Group;
import org.apache.syncope.core.persistence.api.entity.group.GroupTypeExtension;
-import org.apache.syncope.core.persistence.api.entity.user.UDynGroupMembership;
-import org.apache.syncope.core.persistence.api.entity.user.User;
import org.apache.syncope.core.persistence.common.validation.GroupCheck;
import org.apache.syncope.core.persistence.jpa.entity.AbstractRelatable;
import org.apache.syncope.core.persistence.jpa.entity.JPAAnyTypeClass;
import org.apache.syncope.core.persistence.jpa.entity.JPAExternalResource;
-import org.apache.syncope.core.persistence.jpa.entity.anyobject.JPAADynGroupMembership;
-import org.apache.syncope.core.persistence.jpa.entity.user.JPAUDynGroupMembership;
-import org.apache.syncope.core.persistence.jpa.entity.user.JPAUser;
@Entity
@Table(name = JPAGroup.TABLE)
@@ -77,12 +69,6 @@ public class JPAGroup
@NotNull
private String name;
- @ManyToOne
- private JPAUser userOwner;
-
- @ManyToOne
- private JPAGroup groupOwner;
-
private String plainAttrs;
@Transient
@@ -106,13 +92,6 @@ public class JPAGroup
@UniqueConstraint(columnNames = { "group_id", "anyTypeClass_id" }))
private List<JPAAnyTypeClass> auxClasses = new ArrayList<>();
- @OneToOne(cascade = CascadeType.ALL, orphanRemoval = true, mappedBy = "group")
- @Valid
- private JPAUDynGroupMembership uDynMembership;
-
- @OneToMany(cascade = CascadeType.ALL, orphanRemoval = true, fetch = FetchType.EAGER, mappedBy = "group")
- private List<JPAADynGroupMembership> aDynMemberships = new ArrayList<>();
-
@OneToMany(cascade = CascadeType.ALL, orphanRemoval = true, fetch = FetchType.EAGER, mappedBy = "group")
private List<JPAGroupTypeExtension> typeExtensions = new ArrayList<>();
@@ -151,28 +130,6 @@ public class JPAGroup
return resources;
}
- @Override
- public User getUserOwner() {
- return userOwner;
- }
-
- @Override
- public void setUserOwner(final User userOwner) {
- checkType(userOwner, JPAUser.class);
- this.userOwner = (JPAUser) userOwner;
- }
-
- @Override
- public Group getGroupOwner() {
- return groupOwner;
- }
-
- @Override
- public void setGroupOwner(final Group group) {
- checkType(group, JPAGroup.class);
- this.groupOwner = (JPAGroup) group;
- }
-
@Override
public List<PlainAttr> getPlainAttrsList() {
return plainAttrsList;
@@ -213,17 +170,6 @@ public class JPAGroup
toList();
}
- @Override
- public UDynGroupMembership getUDynMembership() {
- return uDynMembership;
- }
-
- @Override
- public void setUDynMembership(final UDynGroupMembership uDynMembership) {
- checkType(uDynMembership, JPAUDynGroupMembership.class);
- this.uDynMembership = (JPAUDynGroupMembership) uDynMembership;
- }
-
@Override
public boolean add(final AnyTypeClass auxClass) {
checkType(auxClass, JPAAnyTypeClass.class);
@@ -235,24 +181,6 @@ public class JPAGroup
return auxClasses;
}
- @Override
- public boolean add(final ADynGroupMembership dynGroupMembership) {
- checkType(dynGroupMembership, JPAADynGroupMembership.class);
- return aDynMemberships.add((JPAADynGroupMembership) dynGroupMembership);
- }
-
- @Override
- public Optional<? extends ADynGroupMembership> getADynMembership(final AnyType anyType) {
- return aDynMemberships.stream().
- filter(dynGroupMembership -> anyType != null && anyType.equals(dynGroupMembership.getAnyType())).
- findFirst();
- }
-
- @Override
- public List<? extends ADynGroupMembership> getADynMemberships() {
- return aDynMemberships;
- }
-
@Override
public boolean add(final GroupTypeExtension typeExtension) {
checkType(typeExtension, JPAGroupTypeExtension.class);
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/user/JPAUDynGroupMembership.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/user/JPAUDynGroupMembership.java
deleted file mode 100644
index 1a851cf335..0000000000
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/user/JPAUDynGroupMembership.java
+++ /dev/null
@@ -1,51 +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.core.persistence.jpa.entity.user;
-
-import jakarta.persistence.Entity;
-import jakarta.persistence.OneToOne;
-import jakarta.persistence.Table;
-import org.apache.syncope.core.persistence.api.entity.group.Group;
-import org.apache.syncope.core.persistence.api.entity.user.UDynGroupMembership;
-import org.apache.syncope.core.persistence.api.entity.user.User;
-import org.apache.syncope.core.persistence.jpa.entity.AbstractDynMembership;
-import org.apache.syncope.core.persistence.jpa.entity.group.JPAGroup;
-
-@Entity
-@Table(name = JPAUDynGroupMembership.TABLE)
-public class JPAUDynGroupMembership extends AbstractDynMembership<User> implements UDynGroupMembership {
-
- private static final long serialVersionUID = -7336814163949640354L;
-
- public static final String TABLE = "UDynGroupMembership";
-
- @OneToOne
- private JPAGroup group;
-
- @Override
- public Group getGroup() {
- return group;
- }
-
- @Override
- public void setGroup(final Group group) {
- checkType(group, JPAGroup.class);
- this.group = (JPAGroup) group;
- }
-}
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/openjpa/EntityValidationListener.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/openjpa/EntityValidationListener.java
index 20f31a6b12..2c3384ff2c 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/openjpa/EntityValidationListener.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/openjpa/EntityValidationListener.java
@@ -27,7 +27,6 @@ import org.apache.commons.lang3.ClassUtils;
import org.apache.syncope.core.persistence.api.ApplicationContextProvider;
import org.apache.syncope.core.persistence.api.attrvalue.InvalidEntityException;
import org.apache.syncope.core.persistence.api.entity.Any;
-import org.apache.syncope.core.persistence.api.entity.DynMembership;
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.ProvidedKeyEntity;
@@ -61,7 +60,6 @@ public class EntityValidationListener {
&& !Policy.class.equals(interf)
&& !Groupable.class.equals(interf)
&& !Any.class.equals(interf)
- && !DynMembership.class.equals(interf)
&& Entity.class.isAssignableFrom(interf)) {
entityInt = interf;
diff --git a/core/persistence-jpa/src/main/resources/META-INF/indexes.xml b/core/persistence-jpa/src/main/resources/META-INF/indexes.xml
index 9940f5d025..26420dfd84 100644
--- a/core/persistence-jpa/src/main/resources/META-INF/indexes.xml
+++ b/core/persistence-jpa/src/main/resources/META-INF/indexes.xml
@@ -40,17 +40,6 @@ under the License.
<entry key="AnyObject_lower_name">CREATE INDEX AnyObject_lower_name ON AnyObject(type_id,LOWER(name))</entry>
<entry key="AnyObject_plainAttrs_idx">CREATE INDEX AnyObject_plainAttrs_idx ON AnyObject USING gin ((plainAttrs) jsonb_path_ops)</entry>
- <entry key="UDynGroupMembers_any_id">CREATE INDEX UDynGroupMembers_any_id ON UDynGroupMembers(any_id)</entry>
- <entry key="UDynGroupMembers_group_id">CREATE INDEX UDynGroupMembers_group_id ON UDynGroupMembers(group_id)</entry>
- <entry key="ADynGroupMembers_any_id">CREATE INDEX ADynGroupMembers_any_id ON ADynGroupMembers(any_id)</entry>
- <entry key="ADynGroupMembers_group_id">CREATE INDEX ADynGroupMembers_group_id ON ADynGroupMembers(group_id)</entry>
-
- <entry key="DynRoleMembers_any_id">CREATE INDEX DynRoleMembers_any_id ON DynRoleMembers(any_id)</entry>
- <entry key="DynRoleMembers_role_id">CREATE INDEX DynRoleMembers_role_id ON DynRoleMembers(role_id)</entry>
-
- <entry key="DynRealmMembers_any_id">CREATE INDEX DynRealmMembers_any_id ON DynRealmMembers(any_id)</entry>
- <entry key="DynRealmMembers_realm_id">CREATE INDEX DynRealmMembers_dynRealm_id ON DynRealmMembers(dynRealm_id)</entry>
-
<entry key="UMembership_GroupIndex">CREATE INDEX UMembership_GroupIndex ON UMembership(group_id)</entry>
<entry key="UMembership_UserIndex">CREATE INDEX UMembership_UserIndex ON UMembership(user_id)</entry>
<entry key="AMembership_GroupIndex">CREATE INDEX AMembership_GroupIndex ON AMembership(group_id)</entry>
diff --git a/core/persistence-jpa/src/main/resources/META-INF/mariadb/indexes.xml b/core/persistence-jpa/src/main/resources/META-INF/mariadb/indexes.xml
index 8bc611e0ae..0db0870b87 100644
--- a/core/persistence-jpa/src/main/resources/META-INF/mariadb/indexes.xml
+++ b/core/persistence-jpa/src/main/resources/META-INF/mariadb/indexes.xml
@@ -32,17 +32,6 @@ under the License.
<entry key="AnyObject_realm_id">CREATE INDEX AnyObject_realm_id ON AnyObject(realm_id)</entry>
<entry key="AnyObject_name">CREATE UNIQUE INDEX AnyObject_name ON AnyObject(type_id,name)</entry>
- <entry key="UDynGroupMembers_any_id">CREATE INDEX UDynGroupMembers_any_id ON UDynGroupMembers(any_id)</entry>
- <entry key="UDynGroupMembers_group_id">CREATE INDEX UDynGroupMembers_group_id ON UDynGroupMembers(group_id)</entry>
- <entry key="ADynGroupMembers_any_id">CREATE INDEX ADynGroupMembers_any_id ON ADynGroupMembers(any_id)</entry>
- <entry key="ADynGroupMembers_group_id">CREATE INDEX ADynGroupMembers_group_id ON ADynGroupMembers(group_id)</entry>
-
- <entry key="DynRoleMembers_any_id">CREATE INDEX DynRoleMembers_any_id ON DynRoleMembers(any_id)</entry>
- <entry key="DynRoleMembers_role_id">CREATE INDEX DynRoleMembers_role_id ON DynRoleMembers(role_id)</entry>
-
- <entry key="DynRealmMembers_any_id">CREATE INDEX DynRealmMembers_any_id ON DynRealmMembers(any_id)</entry>
- <entry key="DynRealmMembers_realm_id">CREATE INDEX DynRealmMembers_dynRealm_id ON DynRealmMembers(dynRealm_id)</entry>
-
<entry key="UMembership_GroupIndex">CREATE INDEX UMembership_GroupIndex ON UMembership(group_id)</entry>
<entry key="UMembership_UserIndex">CREATE INDEX UMembership_UserIndex ON UMembership(user_id)</entry>
<entry key="AMembership_GroupIndex">CREATE INDEX AMembership_GroupIndex ON AMembership(group_id)</entry>
diff --git a/core/persistence-jpa/src/main/resources/META-INF/mariadb/views.xml b/core/persistence-jpa/src/main/resources/META-INF/mariadb/views.xml
index 00af8ffba2..7a69486d13 100644
--- a/core/persistence-jpa/src/main/resources/META-INF/mariadb/views.xml
+++ b/core/persistence-jpa/src/main/resources/META-INF/mariadb/views.xml
@@ -20,32 +20,6 @@ under the License.
<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
<properties>
- <entry key="UDynGroupMembers">
- CREATE TABLE UDynGroupMembers(
- any_id CHAR(36),
- group_id CHAR(36),
- UNIQUE(any_id, group_id))
- </entry>
- <entry key="ADynGroupMembers">
- CREATE TABLE ADynGroupMembers(
- anyType_id VARCHAR(255),
- any_id CHAR(36),
- group_id CHAR(36),
- UNIQUE(anyType_id, any_id, group_id))
- </entry>
- <entry key="DynRoleMembers">
- CREATE TABLE DynRoleMembers(
- any_id CHAR(36),
- role_id VARCHAR(255),
- UNIQUE(any_id, role_id))
- </entry>
- <entry key="DynRealmMembers">
- CREATE TABLE DynRealmMembers(
- any_id CHAR(36),
- dynRealm_id VARCHAR(255),
- UNIQUE(any_id, dynRealm_id))
- </entry>
-
<!-- user -->
<entry key="user_search">
CREATE VIEW user_search AS
diff --git a/core/persistence-jpa/src/main/resources/META-INF/mysql/indexes.xml b/core/persistence-jpa/src/main/resources/META-INF/mysql/indexes.xml
index 8bc611e0ae..0db0870b87 100644
--- a/core/persistence-jpa/src/main/resources/META-INF/mysql/indexes.xml
+++ b/core/persistence-jpa/src/main/resources/META-INF/mysql/indexes.xml
@@ -32,17 +32,6 @@ under the License.
<entry key="AnyObject_realm_id">CREATE INDEX AnyObject_realm_id ON AnyObject(realm_id)</entry>
<entry key="AnyObject_name">CREATE UNIQUE INDEX AnyObject_name ON AnyObject(type_id,name)</entry>
- <entry key="UDynGroupMembers_any_id">CREATE INDEX UDynGroupMembers_any_id ON UDynGroupMembers(any_id)</entry>
- <entry key="UDynGroupMembers_group_id">CREATE INDEX UDynGroupMembers_group_id ON UDynGroupMembers(group_id)</entry>
- <entry key="ADynGroupMembers_any_id">CREATE INDEX ADynGroupMembers_any_id ON ADynGroupMembers(any_id)</entry>
- <entry key="ADynGroupMembers_group_id">CREATE INDEX ADynGroupMembers_group_id ON ADynGroupMembers(group_id)</entry>
-
- <entry key="DynRoleMembers_any_id">CREATE INDEX DynRoleMembers_any_id ON DynRoleMembers(any_id)</entry>
- <entry key="DynRoleMembers_role_id">CREATE INDEX DynRoleMembers_role_id ON DynRoleMembers(role_id)</entry>
-
- <entry key="DynRealmMembers_any_id">CREATE INDEX DynRealmMembers_any_id ON DynRealmMembers(any_id)</entry>
- <entry key="DynRealmMembers_realm_id">CREATE INDEX DynRealmMembers_dynRealm_id ON DynRealmMembers(dynRealm_id)</entry>
-
<entry key="UMembership_GroupIndex">CREATE INDEX UMembership_GroupIndex ON UMembership(group_id)</entry>
<entry key="UMembership_UserIndex">CREATE INDEX UMembership_UserIndex ON UMembership(user_id)</entry>
<entry key="AMembership_GroupIndex">CREATE INDEX AMembership_GroupIndex ON AMembership(group_id)</entry>
diff --git a/core/persistence-jpa/src/main/resources/META-INF/mysql/views.xml b/core/persistence-jpa/src/main/resources/META-INF/mysql/views.xml
index 00af8ffba2..4f96eb297b 100644
--- a/core/persistence-jpa/src/main/resources/META-INF/mysql/views.xml
+++ b/core/persistence-jpa/src/main/resources/META-INF/mysql/views.xml
@@ -19,32 +19,6 @@ under the License.
-->
<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
<properties>
-
- <entry key="UDynGroupMembers">
- CREATE TABLE UDynGroupMembers(
- any_id CHAR(36),
- group_id CHAR(36),
- UNIQUE(any_id, group_id))
- </entry>
- <entry key="ADynGroupMembers">
- CREATE TABLE ADynGroupMembers(
- anyType_id VARCHAR(255),
- any_id CHAR(36),
- group_id CHAR(36),
- UNIQUE(anyType_id, any_id, group_id))
- </entry>
- <entry key="DynRoleMembers">
- CREATE TABLE DynRoleMembers(
- any_id CHAR(36),
- role_id VARCHAR(255),
- UNIQUE(any_id, role_id))
- </entry>
- <entry key="DynRealmMembers">
- CREATE TABLE DynRealmMembers(
- any_id CHAR(36),
- dynRealm_id VARCHAR(255),
- UNIQUE(any_id, dynRealm_id))
- </entry>
<!-- user -->
<entry key="user_search">
diff --git a/core/persistence-jpa/src/main/resources/META-INF/oracle/indexes.xml b/core/persistence-jpa/src/main/resources/META-INF/oracle/indexes.xml
index f86e5e81b7..2f6b094fd6 100644
--- a/core/persistence-jpa/src/main/resources/META-INF/oracle/indexes.xml
+++ b/core/persistence-jpa/src/main/resources/META-INF/oracle/indexes.xml
@@ -40,17 +40,6 @@ under the License.
<entry key="SyncopeUser_plainAttrs_Index">CREATE SEARCH INDEX SyncopeUser_plainAttrs_Index ON SyncopeUser(plainAttrs) FOR JSON</entry>
<entry key="LinkedAccount_plainAttrs_Index">CREATE SEARCH INDEX LinkedAccount_plainAttrs_Index ON LinkedAccount(plainAttrs) FOR JSON</entry>
- <entry key="UDynGroupMembers_any_id">CREATE INDEX UDynGroupMembers_any_id ON UDynGroupMembers(any_id)</entry>
- <entry key="UDynGroupMembers_group_id">CREATE INDEX UDynGroupMembers_group_id ON UDynGroupMembers(group_id)</entry>
- <entry key="ADynGroupMembers_any_id">CREATE INDEX ADynGroupMembers_any_id ON ADynGroupMembers(any_id)</entry>
- <entry key="ADynGroupMembers_group_id">CREATE INDEX ADynGroupMembers_group_id ON ADynGroupMembers(group_id)</entry>
-
- <entry key="DynRoleMembers_any_id">CREATE INDEX DynRoleMembers_any_id ON DynRoleMembers(any_id)</entry>
- <entry key="DynRoleMembers_role_id">CREATE INDEX DynRoleMembers_role_id ON DynRoleMembers(role_id)</entry>
-
- <entry key="DynRealmMembers_any_id">CREATE INDEX DynRealmMembers_any_id ON DynRealmMembers(any_id)</entry>
- <entry key="DynRealmMembers_realm_id">CREATE INDEX DynRealmMembers_dynRealm_id ON DynRealmMembers(dynRealm_id)</entry>
-
<entry key="UMembership_GroupIndex">CREATE INDEX UMembership_GroupIndex ON UMembership(group_id)</entry>
<entry key="UMembership_UserIndex">CREATE INDEX UMembership_UserIndex ON UMembership(user_id)</entry>
<entry key="AMembership_GroupIndex">CREATE INDEX AMembership_GroupIndex ON AMembership(group_id)</entry>
diff --git a/core/persistence-jpa/src/main/resources/META-INF/oracle/views.xml b/core/persistence-jpa/src/main/resources/META-INF/oracle/views.xml
index 9f0a69149f..5134bbc2b1 100644
--- a/core/persistence-jpa/src/main/resources/META-INF/oracle/views.xml
+++ b/core/persistence-jpa/src/main/resources/META-INF/oracle/views.xml
@@ -19,32 +19,6 @@ under the License.
-->
<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
<properties>
-
- <entry key="UDynGroupMembers">
- CREATE TABLE UDynGroupMembers(
- any_id CHAR(36),
- group_id CHAR(36),
- UNIQUE(any_id, group_id))
- </entry>
- <entry key="ADynGroupMembers">
- CREATE TABLE ADynGroupMembers(
- anyType_id VARCHAR(255),
- any_id CHAR(36),
- group_id CHAR(36),
- UNIQUE(anyType_id, any_id, group_id))
- </entry>
- <entry key="DynRoleMembers">
- CREATE TABLE DynRoleMembers(
- any_id CHAR(36),
- role_id VARCHAR(255),
- UNIQUE(any_id, role_id))
- </entry>
- <entry key="DynRealmMembers">
- CREATE TABLE DynRealmMembers(
- any_id CHAR(36),
- dynRealm_id VARCHAR(255),
- UNIQUE(any_id, dynRealm_id))
- </entry>
<!-- user -->
<entry key="user_search_urelationship">
diff --git a/core/persistence-jpa/src/main/resources/META-INF/views.xml b/core/persistence-jpa/src/main/resources/META-INF/views.xml
index 9f0a69149f..5134bbc2b1 100644
--- a/core/persistence-jpa/src/main/resources/META-INF/views.xml
+++ b/core/persistence-jpa/src/main/resources/META-INF/views.xml
@@ -19,32 +19,6 @@ under the License.
-->
<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
<properties>
-
- <entry key="UDynGroupMembers">
- CREATE TABLE UDynGroupMembers(
- any_id CHAR(36),
- group_id CHAR(36),
- UNIQUE(any_id, group_id))
- </entry>
- <entry key="ADynGroupMembers">
- CREATE TABLE ADynGroupMembers(
- anyType_id VARCHAR(255),
- any_id CHAR(36),
- group_id CHAR(36),
- UNIQUE(anyType_id, any_id, group_id))
- </entry>
- <entry key="DynRoleMembers">
- CREATE TABLE DynRoleMembers(
- any_id CHAR(36),
- role_id VARCHAR(255),
- UNIQUE(any_id, role_id))
- </entry>
- <entry key="DynRealmMembers">
- CREATE TABLE DynRealmMembers(
- any_id CHAR(36),
- dynRealm_id VARCHAR(255),
- UNIQUE(any_id, dynRealm_id))
- </entry>
<!-- user -->
<entry key="user_search_urelationship">
diff --git a/core/persistence-jpa/src/main/resources/domains/MasterContent.xml b/core/persistence-jpa/src/main/resources/domains/MasterContent.xml
index 9cc0874406..1045a74ba6 100644
--- a/core/persistence-jpa/src/main/resources/domains/MasterContent.xml
+++ b/core/persistence-jpa/src/main/resources/domains/MasterContent.xml
@@ -106,6 +106,4 @@ we are happy to inform you that the password request was successfully executed f
<Notification id="bef0c250-e8a7-4848-bb63-2564fc409ce2" active="1" recipientAttrName="email" selfAsRecipient="1"
sender="admin@syncope.apache.org" subject="Password Reset successful" template_id="confirmPasswordReset"
traceLevel="FAILURES" events='["[CUSTOM]:[]:[]:[confirmPasswordReset]:[SUCCESS]"]'/>
-
- <SyncopeRole id="GROUP_OWNER" entitlements='["USER_SEARCH","USER_READ","USER_CREATE","USER_UPDATE","USER_DELETE","ANYTYPECLASS_READ","ANYTYPE_LIST","ANYTYPECLASS_LIST","RELATIONSHIPTYPE_LIST","ANYTYPE_READ","REALM_SEARCH","GROUP_SEARCH","GROUP_READ","GROUP_UPDATE","GROUP_DELETE"]'/>
</dataset>
diff --git a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/AnySearchTest.java b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/AnySearchTest.java
index 1891f8c4e8..03c1ce7f3a 100644
--- a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/AnySearchTest.java
+++ b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/AnySearchTest.java
@@ -26,11 +26,9 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
import java.text.ParseException;
import java.util.ArrayList;
-import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
-import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors;
import java.util.stream.Stream;
@@ -45,7 +43,6 @@ import org.apache.syncope.core.persistence.api.dao.GroupDAO;
import org.apache.syncope.core.persistence.api.dao.PlainSchemaDAO;
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.UserDAO;
import org.apache.syncope.core.persistence.api.dao.search.AnyCond;
import org.apache.syncope.core.persistence.api.dao.search.AnyTypeCond;
@@ -107,9 +104,6 @@ public class AnySearchTest extends AbstractTest {
@Autowired
private RealmSearchDAO realmSearchDAO;
- @Autowired
- private RoleDAO roleDAO;
-
@Autowired
private PlainSchemaDAO plainSchemaDAO;
@@ -321,6 +315,24 @@ public class AnySearchTest extends AbstractTest {
assertEquals("rossini", users.getFirst().getUsername());
}
+ @Test
+ public void searchByUManager() {
+ AnyCond anyCond = new AnyCond(AttrCond.Type.EQ);
+ anyCond.setSchema("uManager");
+ anyCond.setExpression("823074dc-d280-436d-a7dd-07399fae48ec");
+
+ List<Group> groups = searchDAO.search(SearchCond.of(anyCond), AnyTypeKind.GROUP);
+ assertNotNull(groups);
+ assertEquals(1, groups.size());
+ assertEquals("director", groups.getFirst().getName());
+
+ anyCond.setExpression("puccini");
+ groups = searchDAO.search(SearchCond.of(anyCond), AnyTypeKind.GROUP);
+ assertNotNull(groups);
+ assertEquals(1, groups.size());
+ assertEquals("director", groups.getFirst().getName());
+ }
+
@Test
public void searchByPageAndSize() {
AttrCond fullnameLeafCond = new AttrCond(AttrCond.Type.LIKE);
@@ -687,19 +699,14 @@ public class AnySearchTest extends AbstractTest {
}
@Test
- public void asGroupOwner() {
+ public void asGroupManager() {
// prepare authentication
- Map<String, Set<String>> entForRealms = new HashMap<>();
- roleDAO.findById(RoleDAO.GROUP_OWNER_ROLE).orElseThrow().getEntitlements().forEach(entitlement -> {
- Set<String> realms = Optional.ofNullable(entForRealms.get(entitlement)).orElseGet(() -> {
- Set<String> r = new HashSet<>();
- entForRealms.put(entitlement, r);
- return r;
- });
-
- realms.add(new RealmUtils.GroupOwnerRealm(
- SyncopeConstants.ROOT_REALM, "37d15e4c-cdc1-460b-a591-8505c8133806").output());
- });
+ Map<String, Set<String>> entForRealms = Map.of(
+ IdRepoEntitlement.GROUP_SEARCH,
+ Set.of(new RealmUtils.ManagerRealm(
+ SyncopeConstants.ROOT_REALM,
+ AnyTypeKind.GROUP,
+ "37d15e4c-cdc1-460b-a591-8505c8133806").output()));
Set<SyncopeGrantedAuthority> authorities = new HashSet<>();
entForRealms.forEach((key, value) -> {
diff --git a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/outer/AnySearchTest.java b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/outer/AnySearchTest.java
index 968e110d47..cedcdaeff4 100644
--- a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/outer/AnySearchTest.java
+++ b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/outer/AnySearchTest.java
@@ -30,21 +30,16 @@ import org.apache.syncope.common.lib.SyncopeClientException;
import org.apache.syncope.common.lib.SyncopeConstants;
import org.apache.syncope.common.lib.types.AnyTypeKind;
import org.apache.syncope.common.lib.types.ClientExceptionType;
-import org.apache.syncope.common.lib.types.IdRepoEntitlement;
import org.apache.syncope.core.persistence.api.attrvalue.PlainAttrValidationManager;
import org.apache.syncope.core.persistence.api.dao.AnyObjectDAO;
import org.apache.syncope.core.persistence.api.dao.AnySearchDAO;
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.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.RoleCond;
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.Role;
import org.apache.syncope.core.persistence.api.entity.anyobject.AMembership;
import org.apache.syncope.core.persistence.api.entity.anyobject.AnyObject;
import org.apache.syncope.core.persistence.api.entity.group.Group;
@@ -76,41 +71,9 @@ public class AnySearchTest extends AbstractTest {
@Autowired
private RealmDAO realmDAO;
- @Autowired
- private RealmSearchDAO realmSearchDAO;
-
- @Autowired
- private RoleDAO roleDAO;
-
@Autowired
private PlainAttrValidationManager validator;
- @Test
- public void searchByDynMembership() {
- // 1. create role with dynamic membership
- Role role = entityFactory.newEntity(Role.class);
- role.setKey("new");
- role.add(realmDAO.getRoot());
- role.add(realmSearchDAO.findByFullPath("/even/two").orElseThrow());
- role.getEntitlements().add(IdRepoEntitlement.AUDIT_LIST);
- role.getEntitlements().add(IdRepoEntitlement.AUDIT_SET);
- role.setDynMembershipCond("cool==true");
-
- role = roleDAO.saveAndRefreshDynMemberships(role);
- assertNotNull(role);
-
- entityManager.flush();
-
- // 2. search user by this dynamic role
- RoleCond roleCond = new RoleCond();
- roleCond.setRole(role.getKey());
-
- List<User> users = searchDAO.search(SearchCond.of(roleCond), AnyTypeKind.USER);
- assertNotNull(users);
- assertEquals(1, users.size());
- assertEquals("c9b2dec2-00a7-4855-97c0-d854842b4b24", users.getFirst().getKey());
- }
-
@Test
public void searchAsGroupOwner() {
// 1. define rossini as member of director
@@ -142,7 +105,8 @@ public class AnySearchTest extends AbstractTest {
// 3. search all users with director owner's entitlements: only rossini is returned
users = searchDAO.search(
group.getRealm(), true,
- Set.of(new RealmUtils.GroupOwnerRealm(group.getRealm().getFullPath(), group.getKey()).output()),
+ Set.of(new RealmUtils.ManagerRealm(
+ group.getRealm().getFullPath(), AnyTypeKind.GROUP, group.getKey()).output()),
SearchCond.of(anyCond), PageRequest.of(0, 100), AnyTypeKind.USER);
assertNotNull(users);
assertEquals(1, users.size());
diff --git a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/outer/DynRealmTest.java b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/outer/DynRealmTest.java
deleted file mode 100644
index 8268624411..0000000000
--- a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/outer/DynRealmTest.java
+++ /dev/null
@@ -1,169 +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.core.persistence.jpa.outer;
-
-import static org.junit.jupiter.api.Assertions.assertEquals;
-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.fail;
-
-import java.util.List;
-import org.apache.syncope.common.lib.types.AnyTypeKind;
-import org.apache.syncope.core.persistence.api.attrvalue.PlainAttrValidationManager;
-import org.apache.syncope.core.persistence.api.dao.AnyMatchDAO;
-import org.apache.syncope.core.persistence.api.dao.AnySearchDAO;
-import org.apache.syncope.core.persistence.api.dao.AnyTypeDAO;
-import org.apache.syncope.core.persistence.api.dao.DynRealmDAO;
-import org.apache.syncope.core.persistence.api.dao.PlainSchemaDAO;
-import org.apache.syncope.core.persistence.api.dao.UserDAO;
-import org.apache.syncope.core.persistence.api.dao.search.DynRealmCond;
-import org.apache.syncope.core.persistence.api.dao.search.SearchCond;
-import org.apache.syncope.core.persistence.api.entity.DynRealm;
-import org.apache.syncope.core.persistence.api.entity.DynRealmMembership;
-import org.apache.syncope.core.persistence.api.entity.user.User;
-import org.apache.syncope.core.persistence.jpa.AbstractTest;
-import org.junit.jupiter.api.Test;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.transaction.annotation.Transactional;
-
-@Transactional
-public class DynRealmTest extends AbstractTest {
-
- @Autowired
- private AnyMatchDAO anyMatchDAO;
-
- @Autowired
- private AnyTypeDAO anyTypeDAO;
-
- @Autowired
- private DynRealmDAO dynRealmDAO;
-
- @Autowired
- private AnySearchDAO searchDAO;
-
- @Autowired
- private UserDAO userDAO;
-
- @Autowired
- private PlainSchemaDAO plainSchemaDAO;
-
- @Autowired
- private PlainAttrValidationManager plainAttrValidationManager;
-
- @Test
- public void misc() {
- DynRealm dynRealm = entityFactory.newEntity(DynRealm.class);
- dynRealm.setKey("/name");
-
- DynRealmMembership memb = entityFactory.newEntity(DynRealmMembership.class);
- memb.setDynRealm(dynRealm);
- memb.setAnyType(anyTypeDAO.getUser());
- memb.setFIQLCond("cool==true");
-
- dynRealm.add(memb);
- memb.setDynRealm(dynRealm);
-
- // invalid key (starts with /)
- try {
- dynRealmDAO.save(dynRealm);
- fail("This should not happen");
- } catch (Exception e) {
- assertNotNull(e);
- }
-
- dynRealm.setKey("name");
- DynRealm actual = dynRealmDAO.saveAndRefreshDynMemberships(dynRealm);
- assertNotNull(actual);
-
- entityManager.flush();
-
- DynRealmCond dynRealmCond = new DynRealmCond();
- dynRealmCond.setDynRealm(actual.getKey());
- List<User> matching = searchDAO.search(SearchCond.of(dynRealmCond), AnyTypeKind.USER);
- assertNotNull(matching);
- assertFalse(matching.isEmpty());
- User user = matching.getFirst();
- assertTrue(anyMatchDAO.matches(user, SearchCond.of(dynRealmCond)));
-
- assertTrue(userDAO.findDynRealms(user.getKey()).contains(actual.getKey()));
- }
-
- @Test
- public void issueSYNCOPE1806() {
- // 1. create two dyn realms with same condition
- DynRealm realm1 = entityFactory.newEntity(DynRealm.class);
- realm1.setKey("realm1");
-
- DynRealmMembership memb1 = entityFactory.newEntity(DynRealmMembership.class);
- memb1.setDynRealm(realm1);
- memb1.setAnyType(anyTypeDAO.getUser());
- memb1.setFIQLCond("cool==true");
-
- realm1.add(memb1);
- memb1.setDynRealm(realm1);
-
- realm1 = dynRealmDAO.saveAndRefreshDynMemberships(realm1);
-
- DynRealm realm2 = entityFactory.newEntity(DynRealm.class);
- realm2.setKey("realm2");
-
- DynRealmMembership memb2 = entityFactory.newEntity(DynRealmMembership.class);
- memb2.setDynRealm(realm2);
- memb2.setAnyType(anyTypeDAO.getUser());
- memb2.setFIQLCond("cool==true");
-
- realm2.add(memb2);
- memb2.setDynRealm(realm2);
-
- realm2 = dynRealmDAO.saveAndRefreshDynMemberships(realm2);
-
- entityManager.flush();
-
- // 2. verify that dynamic members are the same
- DynRealmCond dynRealmCond1 = new DynRealmCond();
- dynRealmCond1.setDynRealm(realm1.getKey());
- List<User> matching1 = searchDAO.search(SearchCond.of(dynRealmCond1), AnyTypeKind.USER);
-
- DynRealmCond dynRealmCond2 = new DynRealmCond();
- dynRealmCond2.setDynRealm(realm2.getKey());
- List<User> matching2 = searchDAO.search(SearchCond.of(dynRealmCond2), AnyTypeKind.USER);
-
- assertEquals(matching1, matching2);
- assertEquals(1, matching1.size());
- assertTrue(matching1.stream().anyMatch(u -> "c9b2dec2-00a7-4855-97c0-d854842b4b24".equals(u.getKey())));
-
- // 3. update an user to let them become part of both dyn realms
- anyUtilsFactory.getInstance(AnyTypeKind.USER).addAttr(
- plainAttrValidationManager,
- "823074dc-d280-436d-a7dd-07399fae48ec",
- plainSchemaDAO.findById("cool").orElseThrow(),
- "true");
-
- entityManager.flush();
-
- // 4. verify that dynamic members are still the same
- matching1 = searchDAO.search(SearchCond.of(dynRealmCond1), AnyTypeKind.USER);
- matching2 = searchDAO.search(SearchCond.of(dynRealmCond2), AnyTypeKind.USER);
- assertEquals(matching1, matching2);
- assertEquals(2, matching1.size());
- assertTrue(matching1.stream().anyMatch(u -> "c9b2dec2-00a7-4855-97c0-d854842b4b24".equals(u.getKey())));
- assertTrue(matching1.stream().anyMatch(u -> "823074dc-d280-436d-a7dd-07399fae48ec".equals(u.getKey())));
- }
-}
diff --git a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/outer/GroupTest.java b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/outer/GroupTest.java
index dea60cddf4..f78b9dce06 100644
--- a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/outer/GroupTest.java
+++ b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/outer/GroupTest.java
@@ -20,17 +20,12 @@ package org.apache.syncope.core.persistence.jpa.outer;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
-import static org.junit.jupiter.api.Assertions.assertNotNull;
-import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;
-import jakarta.persistence.Query;
import java.util.Collection;
import java.util.HashSet;
import java.util.List;
-import java.util.Optional;
-import java.util.Set;
import java.util.stream.Collectors;
import org.apache.syncope.common.lib.SyncopeConstants;
import org.apache.syncope.core.persistence.api.attrvalue.InvalidEntityException;
@@ -47,18 +42,12 @@ import org.apache.syncope.core.persistence.api.dao.RelationshipTypeDAO;
import org.apache.syncope.core.persistence.api.dao.UserDAO;
import org.apache.syncope.core.persistence.api.entity.PlainAttr;
import org.apache.syncope.core.persistence.api.entity.RelationshipType;
-import org.apache.syncope.core.persistence.api.entity.anyobject.ADynGroupMembership;
-import org.apache.syncope.core.persistence.api.entity.anyobject.AnyObject;
import org.apache.syncope.core.persistence.api.entity.group.GRelationship;
import org.apache.syncope.core.persistence.api.entity.group.Group;
import org.apache.syncope.core.persistence.api.entity.group.GroupTypeExtension;
-import org.apache.syncope.core.persistence.api.entity.user.UDynGroupMembership;
import org.apache.syncope.core.persistence.api.entity.user.UMembership;
import org.apache.syncope.core.persistence.api.entity.user.User;
import org.apache.syncope.core.persistence.jpa.AbstractTest;
-import org.apache.syncope.core.persistence.jpa.dao.repo.GroupRepoExt;
-import org.apache.syncope.core.persistence.jpa.entity.anyobject.JPAADynGroupMembership;
-import org.apache.syncope.core.persistence.jpa.entity.user.JPAUDynGroupMembership;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Pageable;
@@ -123,7 +112,7 @@ public class GroupTest extends AbstractTest {
assertEquals(
memberships.stream().map(m -> m.getLeftEnd().getKey()).collect(Collectors.toSet()),
- new HashSet<>(groupDAO.findUMembers("37d15e4c-cdc1-460b-a591-8505c8133806")));
+ new HashSet<>(groupDAO.findUMembers("37d15e4c-cdc1-460b-a591-8505c8133806")));
assertTrue(groupDAO.existsUMembership(
"74cd8ece-715a-44a4-a736-e17b46c4e7e6", "37d15e4c-cdc1-460b-a591-8505c8133806"));
@@ -138,7 +127,7 @@ public class GroupTest extends AbstractTest {
}
@Test
- public void saveWithTwoOwners() {
+ public void saveWithTwoManagers() {
assertThrows(InvalidEntityException.class, () -> {
Group root = groupDAO.findByName("root").orElseThrow();
@@ -147,39 +136,39 @@ public class GroupTest extends AbstractTest {
Group group = entityFactory.newEntity(Group.class);
group.setRealm(realmDAO.getRoot());
group.setName("error");
- group.setUserOwner(user);
- group.setGroupOwner(root);
+ group.setUManager(user);
+ group.setGManager(root);
groupDAO.save(group);
});
}
@Test
- public void findOwnedByUser() {
+ public void findByUManager() {
Group group = groupDAO.findById("ebf97068-aa4b-4a85-9f01-680e8c4cf227").orElseThrow();
User user = userDAO.findById("823074dc-d280-436d-a7dd-07399fae48ec").orElseThrow();
- assertEquals(user, group.getUserOwner());
+ assertEquals(user, group.getUManager());
- List<Group> ownedGroups = groupDAO.findOwnedByUser(user.getKey());
- assertFalse(ownedGroups.isEmpty());
- assertEquals(1, ownedGroups.size());
- assertTrue(ownedGroups.contains(group));
+ List<Group> managed = userDAO.findManagedGroups(user.getKey());
+ assertFalse(managed.isEmpty());
+ assertEquals(1, managed.size());
+ assertTrue(managed.contains(group));
}
@Test
- public void findOwnedByGroup() {
+ public void findByGManager() {
Group root = groupDAO.findByName("root").orElseThrow();
Group group = entityFactory.newEntity(Group.class);
group.setRealm(realmDAO.getRoot());
group.setName("error");
- group.setGroupOwner(root);
+ group.setGManager(root);
group = groupDAO.save(group);
entityManager.flush();
- List<Group> owned = groupDAO.findOwnedByGroup(root.getKey());
- assertEquals(List.of(group), owned);
+ List<Group> managed = groupDAO.findManagedGroups(root.getKey());
+ assertEquals(List.of(group), managed);
}
@Test
@@ -230,196 +219,6 @@ public class GroupTest extends AbstractTest {
assertTrue(plainSchemaDAO.findById("icon").isPresent());
}
- /**
- * Static copy of {@link org.apache.syncope.core.persistence.jpa.dao.repo.UserRepoExtImpl} method with same
- * signature: required for avoiding creating of a new transaction - good for general use case but bad for the way
- * how this test class is architected.
- */
- private List<Group> findDynGroups(final User user) {
- Query query = entityManager.createNativeQuery(
- "SELECT group_id FROM " + GroupRepoExt.UDYNMEMB_TABLE + " WHERE any_id=?");
- query.setParameter(1, user.getKey());
-
- @SuppressWarnings("unchecked")
- List<Object> result = query.getResultList();
- return result.stream().
- map(groupKey -> groupDAO.findById(groupKey.toString())).
- flatMap(Optional::stream).
- distinct().
- collect(Collectors.toList());
- }
-
- @Test
- public void udynMembership() {
- // 0. create user matching the condition below
- User user = entityFactory.newEntity(User.class);
- user.setUsername("username");
- user.setRealm(realmSearchDAO.findByFullPath("/even/two").orElseThrow());
- user.add(anyTypeClassDAO.findById("other").orElseThrow());
-
- PlainAttr attr = new PlainAttr();
- attr.setSchema("cool");
- attr.add(validator, "true");
- user.add(attr);
-
- user = userDAO.save(user);
- String newUserKey = user.getKey();
- assertNotNull(newUserKey);
-
- // 1. create group with dynamic membership
- Group group = entityFactory.newEntity(Group.class);
... 8166 lines suppressed ...