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 2017/07/11 15:46:52 UTC
[4/4] syncope git commit: [SYNCOPE-1152] Cleanup complete
[SYNCOPE-1152] Cleanup complete
Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/20596e2e
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/20596e2e
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/20596e2e
Branch: refs/heads/master
Commit: 20596e2e02e841f7897f39669a98a1f70e386f4e
Parents: a7b54fa
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Tue Jul 11 17:46:18 2017 +0200
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Tue Jul 11 17:46:36 2017 +0200
----------------------------------------------------------------------
.../console/commons/AnyTypeComparator.java | 47 --------
.../console/layout/FormLayoutInfoUtils.java | 26 ++---
.../NotificationWizardBuilder.java | 5 +-
.../syncope/client/console/panels/AnyPanel.java | 9 +-
.../client/console/panels/AnyTypesPanel.java | 2 +-
.../console/panels/GroupDirectoryPanel.java | 4 +-
.../console/panels/MembersTogglePanel.java | 20 ++--
.../syncope/client/console/panels/Realm.java | 28 ++---
.../console/panels/RoleDirectoryPanel.java | 2 +-
.../console/policies/PolicySpecModalPanel.java | 15 +--
.../console/rest/AnyTypeClassRestClient.java | 2 +-
.../client/console/rest/AnyTypeRestClient.java | 57 +++++++++-
.../client/console/rest/ConfRestClient.java | 10 --
.../client/console/rest/SchemaRestClient.java | 2 +-
.../console/status/ResourceStatusModal.java | 10 +-
.../client/console/tasks/PushTaskFilters.java | 2 +-
.../console/tasks/TemplatesTogglePanel.java | 12 +-
.../client/console/widgets/NumberWidget.java | 15 +--
.../console/wizards/AbstractMappingPanel.java | 2 +-
.../console/wizards/any/DynamicMemberships.java | 2 +-
.../console/wizards/any/Relationships.java | 6 +-
.../wizards/any/TypeExtensionWizardBuilder.java | 9 +-
.../resources/ProvisionWizardBuilder.java | 19 +---
.../enduser/resources/AnyTypeClassResource.java | 11 +-
.../enduser/resources/AnyTypeResource.java | 76 -------------
.../resources/ExternalResourceResource.java | 8 +-
.../client/enduser/resources/GroupResource.java | 8 +-
.../enduser/resources/SchemaResource.java | 51 ++++-----
.../enduser/resources/UserClassesResource.java | 75 +++++++++++++
.../app/js/controllers/UserController.js | 12 +-
.../resources/app/js/services/anyService.js | 6 +-
.../syncope/common/lib/info/PlatformInfo.java | 38 +++++++
.../common/lib/types/StandardEntitlement.java | 14 +++
.../common/rest/api/service/GroupService.java | 15 ---
.../common/rest/api/service/SyncopeService.java | 39 +++++++
.../syncope/core/logic/AnyTypeClassLogic.java | 7 +-
.../apache/syncope/core/logic/AnyTypeLogic.java | 7 +-
.../syncope/core/logic/ConfigurationLogic.java | 3 +-
.../syncope/core/logic/ConnectorLogic.java | 3 +-
.../apache/syncope/core/logic/GroupLogic.java | 15 +--
.../syncope/core/logic/ResourceLogic.java | 2 +-
.../apache/syncope/core/logic/RoleLogic.java | 3 +
.../core/logic/SecurityQuestionLogic.java | 5 +-
.../apache/syncope/core/logic/SyncopeLogic.java | 111 ++++++++++++++++++-
.../jpa/dao/JPAExternalResourceDAO.java | 24 +++-
.../persistence/jpa/inner/ResourceTest.java | 35 +++++-
.../persistence/jpa/outer/PlainSchemaTest.java | 36 ++++++
.../provisioning/api/data/GroupDataBinder.java | 4 +
.../java/data/GroupDataBinderImpl.java | 28 +++--
.../java/ResourceDataBinderTest.java | 36 ++++++
.../core/rest/cxf/service/GroupServiceImpl.java | 6 -
.../rest/cxf/service/SyncopeServiceImpl.java | 21 ++++
.../apache/syncope/fit/console/UsersITCase.java | 7 ++
.../syncope/fit/core/AuthenticationITCase.java | 8 +-
.../apache/syncope/fit/core/GroupITCase.java | 20 +++-
.../apache/syncope/fit/core/ResourceITCase.java | 18 ---
56 files changed, 656 insertions(+), 402 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/syncope/blob/20596e2e/client/console/src/main/java/org/apache/syncope/client/console/commons/AnyTypeComparator.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/commons/AnyTypeComparator.java b/client/console/src/main/java/org/apache/syncope/client/console/commons/AnyTypeComparator.java
deleted file mode 100644
index 06dcb13..0000000
--- a/client/console/src/main/java/org/apache/syncope/client/console/commons/AnyTypeComparator.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.commons;
-
-import java.io.Serializable;
-import java.util.Comparator;
-import org.apache.commons.collections4.ComparatorUtils;
-import org.apache.syncope.common.lib.to.AnyTypeTO;
-import org.apache.syncope.common.lib.types.AnyTypeKind;
-
-public class AnyTypeComparator implements Comparator<AnyTypeTO>, Serializable {
-
- private static final long serialVersionUID = -8227715253094467138L;
-
- @Override
- public int compare(final AnyTypeTO o1, final AnyTypeTO o2) {
- if (o1.getKind() == AnyTypeKind.USER) {
- return -1;
- }
- if (o2.getKind() == AnyTypeKind.USER) {
- return 1;
- }
- if (o1.getKind() == AnyTypeKind.GROUP) {
- return -1;
- }
- if (o2.getKind() == AnyTypeKind.GROUP) {
- return 1;
- }
- return ComparatorUtils.<String>naturalComparator().compare(o1.getKey(), o2.getKey());
- }
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/20596e2e/client/console/src/main/java/org/apache/syncope/client/console/layout/FormLayoutInfoUtils.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/layout/FormLayoutInfoUtils.java b/client/console/src/main/java/org/apache/syncope/client/console/layout/FormLayoutInfoUtils.java
index 58afe2c..2ac6f41 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/layout/FormLayoutInfoUtils.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/layout/FormLayoutInfoUtils.java
@@ -31,7 +31,6 @@ import org.apache.commons.lang3.tuple.Triple;
import org.apache.syncope.client.console.SyncopeConsoleSession;
import org.apache.syncope.client.console.rest.RoleRestClient;
import org.apache.syncope.common.lib.to.AnyTO;
-import org.apache.syncope.common.lib.to.AnyTypeTO;
import org.apache.syncope.common.lib.to.UserTO;
import org.apache.syncope.common.lib.types.AnyTypeKind;
import org.apache.wicket.PageReference;
@@ -46,7 +45,7 @@ public final class FormLayoutInfoUtils {
private static final ObjectMapper MAPPER = new ObjectMapper();
public static Triple<UserFormLayoutInfo, GroupFormLayoutInfo, Map<String, AnyObjectFormLayoutInfo>> fetch(
- final List<AnyTypeTO> anyTypeTOs) {
+ final List<String> anyTypes) {
List<String> ownedRoles = SyncopeConsoleSession.get().getSelfTO().getRoles();
try {
@@ -70,14 +69,13 @@ public final class FormLayoutInfoUtils {
: new GroupFormLayoutInfo();
Map<String, AnyObjectFormLayoutInfo> anyObjectFormLayoutInfos = new HashMap<>();
- for (AnyTypeTO anyTypeTO : anyTypeTOs) {
- if (!anyTypeTO.getKey().equals(AnyTypeKind.USER.name())
- && !anyTypeTO.getKey().equals(AnyTypeKind.GROUP.name())) {
+ for (String anyType : anyTypes) {
+ if (!anyType.equals(AnyTypeKind.USER.name()) && !anyType.equals(AnyTypeKind.GROUP.name())) {
anyObjectFormLayoutInfos.put(
- anyTypeTO.getKey(),
- tree.has(anyTypeTO.getKey())
- ? MAPPER.treeToValue(tree.get(anyTypeTO.getKey()), AnyObjectFormLayoutInfo.class)
+ anyType,
+ tree.has(anyType)
+ ? MAPPER.treeToValue(tree.get(anyType), AnyObjectFormLayoutInfo.class)
: new AnyObjectFormLayoutInfo());
}
}
@@ -89,7 +87,7 @@ public final class FormLayoutInfoUtils {
}
}
- public static String defaultConsoleLayoutInfoIfEmpty(final String content, final List<AnyTypeTO> anyTypeTOs) {
+ public static String defaultConsoleLayoutInfoIfEmpty(final String content, final List<String> anyTypes) {
String result;
if (StringUtils.isBlank(content)) {
@@ -98,11 +96,9 @@ public final class FormLayoutInfoUtils {
tree.set(AnyTypeKind.USER.name(), MAPPER.valueToTree(new UserFormLayoutInfo()));
tree.set(AnyTypeKind.GROUP.name(), MAPPER.valueToTree(new GroupFormLayoutInfo()));
- for (AnyTypeTO anyTypeTO : anyTypeTOs) {
- if (!anyTypeTO.getKey().equals(AnyTypeKind.USER.name())
- && !anyTypeTO.getKey().equals(AnyTypeKind.GROUP.name())) {
-
- tree.set(anyTypeTO.getKey(), MAPPER.valueToTree(new AnyObjectFormLayoutInfo()));
+ for (String anyType : anyTypes) {
+ if (!anyType.equals(AnyTypeKind.USER.name()) && !anyType.equals(AnyTypeKind.GROUP.name())) {
+ tree.set(anyType, MAPPER.valueToTree(new AnyObjectFormLayoutInfo()));
}
}
@@ -145,7 +141,7 @@ public final class FormLayoutInfoUtils {
pageRef.getClass()).
newInstance(anyTO, anyTypeClasses, anyFormLayout, pageRef);
}
- } catch (NoSuchMethodException | SecurityException | InstantiationException | IllegalAccessException
+ } catch (NoSuchMethodException | SecurityException | InstantiationException | IllegalAccessException
| IllegalArgumentException | InvocationTargetException e) {
throw new IllegalArgumentException("Could not instantiate " + anyFormLayout.getFormClass().getName(), e);
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/20596e2e/client/console/src/main/java/org/apache/syncope/client/console/notifications/NotificationWizardBuilder.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/notifications/NotificationWizardBuilder.java b/client/console/src/main/java/org/apache/syncope/client/console/notifications/NotificationWizardBuilder.java
index 41fa708..7000c4c 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/notifications/NotificationWizardBuilder.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/notifications/NotificationWizardBuilder.java
@@ -45,7 +45,6 @@ import org.apache.syncope.client.console.wicket.markup.html.form.MultiFieldPanel
import org.apache.syncope.client.console.wicket.markup.html.form.MultiPanel;
import org.apache.syncope.client.console.wizards.AjaxWizardBuilder;
import org.apache.syncope.common.lib.EntityTOUtils;
-import org.apache.syncope.common.lib.to.AnyTypeTO;
import org.apache.syncope.common.lib.to.DerSchemaTO;
import org.apache.syncope.common.lib.to.MailTemplateTO;
import org.apache.syncope.common.lib.to.NotificationTO;
@@ -217,9 +216,7 @@ public class NotificationWizardBuilder extends AjaxWizardBuilder<NotificationWra
}
});
- type.setChoices(CollectionUtils.collect(
- new AnyTypeRestClient().list(),
- EntityTOUtils.<AnyTypeTO>keyTransformer(), new ArrayList<String>()));
+ type.setChoices(new AnyTypeRestClient().list());
type.addRequiredLabel();
add(type);
http://git-wip-us.apache.org/repos/asf/syncope/blob/20596e2e/client/console/src/main/java/org/apache/syncope/client/console/panels/AnyPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/AnyPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/AnyPanel.java
index 7e2ed3d..8cffcc1 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/AnyPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/AnyPanel.java
@@ -36,6 +36,7 @@ import org.apache.syncope.client.console.panels.search.SearchClausePanel;
import org.apache.syncope.client.console.panels.search.SearchUtils;
import org.apache.syncope.client.console.panels.search.UserSearchPanel;
import org.apache.syncope.client.console.rest.AnyTypeClassRestClient;
+import org.apache.syncope.client.console.rest.AnyTypeRestClient;
import org.apache.syncope.client.console.wicket.markup.html.bootstrap.tabs.Accordion;
import org.apache.syncope.client.lib.SyncopeClient;
import org.apache.syncope.common.lib.SyncopeConstants;
@@ -86,14 +87,14 @@ public class AnyPanel extends Panel implements ModalPanel {
public AnyPanel(
final String id,
- final AnyTypeTO anyTypeTO,
+ final String anyType,
final RealmTO realmTO,
final Triple<UserFormLayoutInfo, GroupFormLayoutInfo, Map<String, AnyObjectFormLayoutInfo>> formLayoutInfo,
final boolean enableSearch,
final PageReference pageRef) {
super(id);
- this.anyTypeTO = anyTypeTO;
+ this.anyTypeTO = new AnyTypeRestClient().read(anyType);
this.realmTO = realmTO;
this.formLayoutInfo = formLayoutInfo;
this.pageRef = pageRef;
@@ -281,9 +282,9 @@ public class AnyPanel extends Panel implements ModalPanel {
case ANY_OBJECT:
fiql = dynRealm == null
? SyncopeClient.getAnyObjectSearchConditionBuilder(anyTypeTO.getKey()).is("key").notNullValue()
- .query()
+ .query()
: SyncopeClient.getAnyObjectSearchConditionBuilder(anyTypeTO.getKey()).inDynRealms(dynRealm)
- .query();
+ .query();
final AnyObjectTO anyObjectTO = new AnyObjectTO();
anyObjectTO.setRealm(realmTO.getFullPath());
http://git-wip-us.apache.org/repos/asf/syncope/blob/20596e2e/client/console/src/main/java/org/apache/syncope/client/console/panels/AnyTypesPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/AnyTypesPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/AnyTypesPanel.java
index 2460d7f..1d0e1d8 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/AnyTypesPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/AnyTypesPanel.java
@@ -205,7 +205,7 @@ public class AnyTypesPanel extends TypesDirectoryPanel<AnyTypeTO, AnyTypesPanel.
@Override
public Iterator<AnyTypeTO> iterator(final long first, final long count) {
- final List<AnyTypeTO> list = restClient.list();
+ final List<AnyTypeTO> list = restClient.listAnyTypes();
Collections.sort(list, comparator);
return list.subList((int) first, (int) first + (int) count).iterator();
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/20596e2e/client/console/src/main/java/org/apache/syncope/client/console/panels/GroupDirectoryPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/GroupDirectoryPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/GroupDirectoryPanel.java
index b560f82..6ea455a 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/GroupDirectoryPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/GroupDirectoryPanel.java
@@ -100,9 +100,9 @@ public class GroupDirectoryPanel extends AnyDirectoryPanel<GroupTO, GroupRestCli
final AnyTypeTO anyTypeTO = typeRestClient.read(type);
- ModalPanel panel = new AnyPanel(BaseModal.CONTENT_ID, anyTypeTO, null, null, false, pageRef) {
+ ModalPanel panel = new AnyPanel(BaseModal.CONTENT_ID, type, null, null, false, pageRef) {
- private static final long serialVersionUID = 1L;
+ private static final long serialVersionUID = 7980820232811890502L;
@Override
protected Panel getDirectoryPanel(final String id) {
http://git-wip-us.apache.org/repos/asf/syncope/blob/20596e2e/client/console/src/main/java/org/apache/syncope/client/console/panels/MembersTogglePanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/MembersTogglePanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/MembersTogglePanel.java
index ebde283..70d2dda 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/MembersTogglePanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/MembersTogglePanel.java
@@ -19,7 +19,6 @@
package org.apache.syncope.client.console.panels;
import java.io.Serializable;
-import java.util.ArrayList;
import java.util.List;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.Predicate;
@@ -29,9 +28,7 @@ import org.apache.syncope.client.console.pages.BasePage;
import org.apache.syncope.client.console.rest.AnyTypeRestClient;
import org.apache.syncope.client.console.wicket.markup.html.form.AjaxDropDownChoicePanel;
import org.apache.syncope.client.console.wicket.markup.html.form.FieldPanel;
-import org.apache.syncope.common.lib.EntityTOUtils;
import org.apache.syncope.common.lib.SyncopeClientException;
-import org.apache.syncope.common.lib.to.AnyTypeTO;
import org.apache.syncope.common.lib.to.GroupTO;
import org.apache.syncope.common.lib.types.AnyTypeKind;
import org.apache.wicket.PageReference;
@@ -57,14 +54,15 @@ public abstract class MembersTogglePanel extends TogglePanel<Serializable> {
@Override
protected List<String> load() {
- return CollectionUtils.collect(
- CollectionUtils.select(new AnyTypeRestClient().list(), new Predicate<AnyTypeTO>() {
-
- @Override
- public boolean evaluate(final AnyTypeTO object) {
- return object.getKind() != AnyTypeKind.GROUP;
- }
- }), EntityTOUtils.<AnyTypeTO>keyTransformer(), new ArrayList<String>());
+ List<String> result = new AnyTypeRestClient().list();
+ CollectionUtils.filter(result, new Predicate<String>() {
+
+ @Override
+ public boolean evaluate(final String anyType) {
+ return !AnyTypeKind.GROUP.name().equals(anyType);
+ }
+ });
+ return result;
}
};
http://git-wip-us.apache.org/repos/asf/syncope/blob/20596e2e/client/console/src/main/java/org/apache/syncope/client/console/panels/Realm.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/Realm.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/Realm.java
index 0d74c95..2a62ae1 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/Realm.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/Realm.java
@@ -22,14 +22,12 @@ import de.agilecoders.wicket.core.markup.html.bootstrap.dialog.Modal;
import de.agilecoders.wicket.core.markup.html.bootstrap.tabs.AjaxBootstrapTabbedPanel;
import java.io.Serializable;
import java.util.ArrayList;
-import java.util.Collections;
import java.util.List;
import java.util.Map;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.tuple.Pair;
import org.apache.commons.lang3.tuple.Triple;
import org.apache.syncope.client.console.SyncopeConsoleApplication;
-import org.apache.syncope.client.console.commons.AnyTypeComparator;
import org.apache.syncope.client.console.commons.ConnIdSpecialName;
import org.apache.syncope.client.console.commons.Constants;
import org.apache.syncope.client.console.commons.ITabComponent;
@@ -44,12 +42,10 @@ import org.apache.syncope.client.console.wicket.markup.html.form.ActionsPanel;
import org.apache.syncope.client.console.wizards.WizardMgtPanel;
import org.apache.syncope.client.console.wizards.any.ConnObjectPanel;
import org.apache.syncope.common.lib.SyncopeConstants;
-import org.apache.syncope.common.lib.to.AnyTypeTO;
import org.apache.syncope.common.lib.to.ConnObjectTO;
import org.apache.syncope.common.lib.to.PropagationStatus;
import org.apache.syncope.common.lib.to.ProvisioningResult;
import org.apache.syncope.common.lib.to.RealmTO;
-import org.apache.syncope.common.lib.types.AnyTypeKind;
import org.apache.syncope.common.lib.types.PropagationTaskExecStatus;
import org.apache.syncope.common.lib.types.StandardEntitlement;
import org.apache.wicket.Component;
@@ -71,19 +67,19 @@ public abstract class Realm extends WizardMgtPanel<RealmTO> {
private final RealmTO realmTO;
- private final List<AnyTypeTO> anyTypeTOs;
+ private final List<String> anyTypes;
protected final RealmWizardBuilder wizardBuilder;
public Realm(final String id, final RealmTO realmTO, final PageReference pageRef, final int selectedIndex) {
super(id, true);
this.realmTO = realmTO;
- this.anyTypeTOs = new AnyTypeRestClient().list();
+ this.anyTypes = new AnyTypeRestClient().list();
setPageRef(pageRef);
- AjaxBootstrapTabbedPanel<ITab> tabbedPanel
- = new AjaxBootstrapTabbedPanel<>("tabbedPanel", buildTabList(pageRef));
+ AjaxBootstrapTabbedPanel<ITab> tabbedPanel =
+ new AjaxBootstrapTabbedPanel<>("tabbedPanel", buildTabList(pageRef));
tabbedPanel.setSelectedTab(selectedIndex);
addInnerObject(tabbedPanel);
this.wizardBuilder = new RealmWizardBuilder(pageRef);
@@ -153,7 +149,7 @@ public abstract class Realm extends WizardMgtPanel<RealmTO> {
}
}, ActionLink.ActionType.DELETE, StandardEntitlement.REALM_DELETE, true).hideLabel();
}
-
+
RealmDetails panel = new RealmDetails(panelId, realmTO, actionPanel, false);
panel.setContentEnabled(false);
actionPanel.setEnabled(true);
@@ -167,21 +163,19 @@ public abstract class Realm extends WizardMgtPanel<RealmTO> {
}
});
- final Triple<UserFormLayoutInfo, GroupFormLayoutInfo, Map<String, AnyObjectFormLayoutInfo>> formLayoutInfo
- = FormLayoutInfoUtils.fetch(anyTypeTOs);
+ final Triple<UserFormLayoutInfo, GroupFormLayoutInfo, Map<String, AnyObjectFormLayoutInfo>> formLayoutInfo =
+ FormLayoutInfoUtils.fetch(anyTypes);
- Collections.sort(anyTypeTOs, new AnyTypeComparator());
- for (final AnyTypeTO anyTypeTO : anyTypeTOs) {
+ for (final String anyType : anyTypes) {
tabs.add(new ITabComponent(
- new Model<>(anyTypeTO.getKey()),
- AnyTypeKind.GROUP.name().equals(anyTypeTO.getKey())
- ? null : new String[] { String.format("%s_SEARCH", anyTypeTO.getKey()) }) {
+ new Model<>(anyType),
+ StandardEntitlement.ANYTYPE_READ, String.format("%s_SEARCH", anyType)) {
private static final long serialVersionUID = 1169585538404171118L;
@Override
public WebMarkupContainer getPanel(final String panelId) {
- return new AnyPanel(panelId, anyTypeTO, realmTO, formLayoutInfo, true, pageRef);
+ return new AnyPanel(panelId, anyType, realmTO, formLayoutInfo, true, pageRef);
}
@Override
http://git-wip-us.apache.org/repos/asf/syncope/blob/20596e2e/client/console/src/main/java/org/apache/syncope/client/console/panels/RoleDirectoryPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/RoleDirectoryPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/RoleDirectoryPanel.java
index bb7d9d9..d7d8a9d 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/RoleDirectoryPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/RoleDirectoryPanel.java
@@ -166,7 +166,7 @@ public class RoleDirectoryPanel extends DirectoryPanel<RoleTO, RoleWrapper, Role
final AnyTypeTO anyTypeTO = typeRestClient.read(AnyTypeKind.USER.name());
- ModalPanel panel = new AnyPanel(BaseModal.CONTENT_ID, anyTypeTO, null, null, false, pageRef) {
+ ModalPanel panel = new AnyPanel(BaseModal.CONTENT_ID, anyTypeTO.getKey(), null, null, false, pageRef) {
private static final long serialVersionUID = -7514498203393023415L;
http://git-wip-us.apache.org/repos/asf/syncope/blob/20596e2e/client/console/src/main/java/org/apache/syncope/client/console/policies/PolicySpecModalPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/policies/PolicySpecModalPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/policies/PolicySpecModalPanel.java
index e5fdc7f..fbe0c4e 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/policies/PolicySpecModalPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/policies/PolicySpecModalPanel.java
@@ -43,7 +43,6 @@ import org.apache.syncope.client.console.wicket.markup.html.form.AjaxPalettePane
import org.apache.syncope.client.console.wicket.markup.html.form.MultiPanel;
import org.apache.syncope.common.lib.policy.PullPolicyTO;
import org.apache.syncope.common.lib.to.AbstractSchemaTO;
-import org.apache.syncope.common.lib.to.AnyTypeTO;
import org.apache.syncope.common.lib.types.AnyTypeKind;
import org.apache.syncope.common.lib.types.ConflictResolutionAction;
import org.apache.syncope.common.lib.types.SchemaType;
@@ -84,8 +83,8 @@ public class PolicySpecModalPanel extends AbstractModalPanel<PullPolicyTO> {
private List<CorrelationRule> rules = CollectionUtils.collect(
policyTO.getSpecification().getCorrelationRules() == null
- ? Collections.<String>emptySet()
- : policyTO.getSpecification().getCorrelationRules().keySet(),
+ ? Collections.<String>emptySet()
+ : policyTO.getSpecification().getCorrelationRules().keySet(),
new Transformer<String, CorrelationRule>() {
@Override
@@ -154,15 +153,7 @@ public class PolicySpecModalPanel extends AbstractModalPanel<PullPolicyTO> {
AjaxDropDownChoicePanel<String> anyType = new AjaxDropDownChoicePanel<>(
"anyType", "any.type", new PropertyModel<String>(rule.getObject(), "any")).
setNullValid(true).
- setChoices(CollectionUtils.collect(
- new AnyTypeRestClient().list(),
- new Transformer<AnyTypeTO, String>() {
-
- @Override
- public String transform(final AnyTypeTO input) {
- return input.getKey();
- }
- }, new ArrayList<String>()));
+ setChoices(new AnyTypeRestClient().list());
add(anyType);
final AjaxDropDownChoicePanel<String> ruleType = new AjaxDropDownChoicePanel<>(
http://git-wip-us.apache.org/repos/asf/syncope/blob/20596e2e/client/console/src/main/java/org/apache/syncope/client/console/rest/AnyTypeClassRestClient.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/rest/AnyTypeClassRestClient.java b/client/console/src/main/java/org/apache/syncope/client/console/rest/AnyTypeClassRestClient.java
index 1fe66ca..7382436 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/rest/AnyTypeClassRestClient.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/rest/AnyTypeClassRestClient.java
@@ -61,7 +61,7 @@ public class AnyTypeClassRestClient extends BaseRestClient {
public List<AnyTypeClassTO> list(final Collection<String> anyTypeClassNames) {
List<AnyTypeClassTO> anyTypeClassTOs = new ArrayList<>();
for (String anyTypeClass : anyTypeClassNames) {
- anyTypeClassTOs.add(getService(AnyTypeClassService.class).read(anyTypeClass));
+ anyTypeClassTOs.add(read(anyTypeClass));
}
return anyTypeClassTOs;
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/20596e2e/client/console/src/main/java/org/apache/syncope/client/console/rest/AnyTypeRestClient.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/rest/AnyTypeRestClient.java b/client/console/src/main/java/org/apache/syncope/client/console/rest/AnyTypeRestClient.java
index 39db455..f422c2b 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/rest/AnyTypeRestClient.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/rest/AnyTypeRestClient.java
@@ -18,11 +18,14 @@
*/
package org.apache.syncope.client.console.rest;
+import java.io.Serializable;
import java.util.Collections;
+import java.util.Comparator;
import java.util.List;
-import org.apache.syncope.client.console.commons.AnyTypeComparator;
+import org.apache.commons.collections4.ComparatorUtils;
import org.apache.syncope.common.lib.SyncopeClientException;
import org.apache.syncope.common.lib.to.AnyTypeTO;
+import org.apache.syncope.common.lib.types.AnyTypeKind;
import org.apache.syncope.common.rest.api.service.AnyTypeService;
public class AnyTypeRestClient extends BaseRestClient {
@@ -41,7 +44,7 @@ public class AnyTypeRestClient extends BaseRestClient {
return type;
}
- public List<AnyTypeTO> list() {
+ public List<AnyTypeTO> listAnyTypes() {
List<AnyTypeTO> types = Collections.emptyList();
try {
@@ -54,6 +57,12 @@ public class AnyTypeRestClient extends BaseRestClient {
return types;
}
+ public List<String> list() {
+ List<String> types = getSyncopeService().platform().getAnyTypes();
+ Collections.sort(types, new AnyTypeKeyComparator());
+ return types;
+ }
+
public void create(final AnyTypeTO anyTypeTO) {
getService(AnyTypeService.class).create(anyTypeTO);
}
@@ -65,4 +74,48 @@ public class AnyTypeRestClient extends BaseRestClient {
public void delete(final String key) {
getService(AnyTypeService.class).delete(key);
}
+
+ private static class AnyTypeComparator implements Comparator<AnyTypeTO>, Serializable {
+
+ private static final long serialVersionUID = -8227715253094467138L;
+
+ @Override
+ public int compare(final AnyTypeTO o1, final AnyTypeTO o2) {
+ if (o1.getKind() == AnyTypeKind.USER) {
+ return -1;
+ }
+ if (o2.getKind() == AnyTypeKind.USER) {
+ return 1;
+ }
+ if (o1.getKind() == AnyTypeKind.GROUP) {
+ return -1;
+ }
+ if (o2.getKind() == AnyTypeKind.GROUP) {
+ return 1;
+ }
+ return ComparatorUtils.<String>naturalComparator().compare(o1.getKey(), o2.getKey());
+ }
+ }
+
+ private static class AnyTypeKeyComparator implements Comparator<String>, Serializable {
+
+ private static final long serialVersionUID = -7778622183107320760L;
+
+ @Override
+ public int compare(final String o1, final String o2) {
+ if (AnyTypeKind.USER.name().equals(o1)) {
+ return -1;
+ }
+ if (AnyTypeKind.USER.name().equals(o2)) {
+ return 1;
+ }
+ if (AnyTypeKind.GROUP.name().equals(o1)) {
+ return -1;
+ }
+ if (AnyTypeKind.GROUP.name().equals(2)) {
+ return 1;
+ }
+ return ComparatorUtils.<String>naturalComparator().compare(o1, o2);
+ }
+ }
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/20596e2e/client/console/src/main/java/org/apache/syncope/client/console/rest/ConfRestClient.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/rest/ConfRestClient.java b/client/console/src/main/java/org/apache/syncope/client/console/rest/ConfRestClient.java
index 5992380..1266386 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/rest/ConfRestClient.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/rest/ConfRestClient.java
@@ -20,7 +20,6 @@ package org.apache.syncope.client.console.rest;
import java.util.List;
import javax.ws.rs.core.Response;
-import org.apache.syncope.common.lib.SyncopeClientException;
import org.apache.syncope.common.lib.to.AttrTO;
import org.apache.syncope.common.rest.api.service.ConfigurationService;
@@ -32,15 +31,6 @@ public class ConfRestClient extends BaseRestClient {
return getService(ConfigurationService.class).list();
}
- public AttrTO get(final String key) {
- try {
- return getService(ConfigurationService.class).get(key);
- } catch (SyncopeClientException e) {
- LOG.error("While reading a configuration schema", e);
- }
- return null;
- }
-
public void set(final AttrTO attrTO) {
getService(ConfigurationService.class).set(attrTO);
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/20596e2e/client/console/src/main/java/org/apache/syncope/client/console/rest/SchemaRestClient.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/rest/SchemaRestClient.java b/client/console/src/main/java/org/apache/syncope/client/console/rest/SchemaRestClient.java
index e09259f..600afb3 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/rest/SchemaRestClient.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/rest/SchemaRestClient.java
@@ -56,7 +56,7 @@ public class SchemaRestClient extends BaseRestClient {
break;
default:
- for (AnyTypeTO anyTypeTO : new AnyTypeRestClient().list()) {
+ for (AnyTypeTO anyTypeTO : new AnyTypeRestClient().listAnyTypes()) {
if (anyTypeTO.getKind() != AnyTypeKind.USER && anyTypeTO.getKind() != AnyTypeKind.GROUP) {
classes.addAll(anyTypeTO.getClasses());
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/20596e2e/client/console/src/main/java/org/apache/syncope/client/console/status/ResourceStatusModal.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/status/ResourceStatusModal.java b/client/console/src/main/java/org/apache/syncope/client/console/status/ResourceStatusModal.java
index d3a61d1..1a379a9 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/status/ResourceStatusModal.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/status/ResourceStatusModal.java
@@ -18,9 +18,7 @@
*/
package org.apache.syncope.client.console.status;
-import java.util.ArrayList;
import java.util.List;
-import org.apache.commons.collections4.CollectionUtils;
import org.apache.syncope.client.console.commons.Constants;
import org.apache.syncope.client.console.commons.DirectoryDataProvider;
import org.apache.syncope.client.console.commons.status.StatusBean;
@@ -30,7 +28,6 @@ import org.apache.syncope.client.console.rest.AbstractAnyRestClient;
import org.apache.syncope.client.console.rest.AnyTypeRestClient;
import org.apache.syncope.client.console.wicket.markup.html.bootstrap.dialog.BaseModal;
import org.apache.syncope.client.console.wicket.markup.html.form.AjaxDropDownChoicePanel;
-import org.apache.syncope.common.lib.EntityTOUtils;
import org.apache.syncope.common.lib.to.ResourceTO;
import org.apache.wicket.PageReference;
import org.apache.wicket.ajax.AjaxRequestTarget;
@@ -57,13 +54,12 @@ public class ResourceStatusModal extends StatusModal<ResourceTO> {
@Override
protected List<String> load() {
- return CollectionUtils.collect(
- new AnyTypeRestClient().list(), EntityTOUtils.keyTransformer(), new ArrayList<String>());
+ return new AnyTypeRestClient().list();
}
};
- AjaxDropDownChoicePanel<String> anyTypes
- = new AjaxDropDownChoicePanel<>("anyTypes", "anyTypes", typeModel, false);
+ AjaxDropDownChoicePanel<String> anyTypes =
+ new AjaxDropDownChoicePanel<>("anyTypes", "anyTypes", typeModel, false);
anyTypes.setChoices(types);
anyTypes.hideLabel();
add(anyTypes);
http://git-wip-us.apache.org/repos/asf/syncope/blob/20596e2e/client/console/src/main/java/org/apache/syncope/client/console/tasks/PushTaskFilters.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/tasks/PushTaskFilters.java b/client/console/src/main/java/org/apache/syncope/client/console/tasks/PushTaskFilters.java
index dc8015f..c1e7e14 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/tasks/PushTaskFilters.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/tasks/PushTaskFilters.java
@@ -50,7 +50,7 @@ public class PushTaskFilters extends WizardStep {
@Override
protected List<AnyTypeTO> load() {
- return new AnyTypeRestClient().list();
+ return new AnyTypeRestClient().listAnyTypes();
}
};
http://git-wip-us.apache.org/repos/asf/syncope/blob/20596e2e/client/console/src/main/java/org/apache/syncope/client/console/tasks/TemplatesTogglePanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/tasks/TemplatesTogglePanel.java b/client/console/src/main/java/org/apache/syncope/client/console/tasks/TemplatesTogglePanel.java
index 53edb6e..625506c 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/tasks/TemplatesTogglePanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/tasks/TemplatesTogglePanel.java
@@ -19,9 +19,7 @@
package org.apache.syncope.client.console.tasks;
import java.io.Serializable;
-import java.util.ArrayList;
import java.util.List;
-import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.tuple.Pair;
import org.apache.syncope.client.console.SyncopeConsoleSession;
@@ -40,11 +38,9 @@ import org.apache.syncope.client.console.wizards.any.AnyWrapper;
import org.apache.syncope.client.console.wizards.any.GroupTemplateWizardBuilder;
import org.apache.syncope.client.console.wizards.any.TemplateWizardBuilder;
import org.apache.syncope.client.console.wizards.any.UserTemplateWizardBuilder;
-import org.apache.syncope.common.lib.EntityTOUtils;
import org.apache.syncope.common.lib.SyncopeClientException;
import org.apache.syncope.common.lib.to.AnyObjectTO;
import org.apache.syncope.common.lib.to.AnyTO;
-import org.apache.syncope.common.lib.to.AnyTypeTO;
import org.apache.syncope.common.lib.to.GroupTO;
import org.apache.syncope.common.lib.to.TemplatableTO;
import org.apache.syncope.common.lib.to.UserTO;
@@ -74,9 +70,7 @@ public abstract class TemplatesTogglePanel extends TogglePanel<Serializable> {
@Override
protected List<String> load() {
- final List<String> res = new ArrayList<>();
- CollectionUtils.collect(new AnyTypeRestClient().list(), EntityTOUtils.<AnyTypeTO>keyTransformer(), res);
- return res;
+ return new AnyTypeRestClient().list();
}
};
@@ -101,8 +95,8 @@ public abstract class TemplatesTogglePanel extends TogglePanel<Serializable> {
@Override
protected void onSubmit(final AjaxRequestTarget target, final Form<?> form) {
try {
- final AjaxWizard.NewItemActionEvent<AnyTO> payload
- = new AjaxWizard.NewItemActionEvent<>(null, target);
+ final AjaxWizard.NewItemActionEvent<AnyTO> payload =
+ new AjaxWizard.NewItemActionEvent<>(null, target);
payload.setResourceModel(new StringResourceModel("inner.template.edit", container,
Model.of(Pair.of(typeModel.getObject(), targetObject))).setDefaultValue(
http://git-wip-us.apache.org/repos/asf/syncope/blob/20596e2e/client/console/src/main/java/org/apache/syncope/client/console/widgets/NumberWidget.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/widgets/NumberWidget.java b/client/console/src/main/java/org/apache/syncope/client/console/widgets/NumberWidget.java
index 15bf597..0aa5d60 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/widgets/NumberWidget.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/widgets/NumberWidget.java
@@ -18,11 +18,8 @@
*/
package org.apache.syncope.client.console.widgets;
-import java.util.Collections;
import java.util.List;
import org.apache.syncope.client.console.SyncopeConsoleSession;
-import org.apache.syncope.client.console.commons.AnyTypeComparator;
-import org.apache.syncope.common.lib.to.AnyTypeTO;
import org.apache.syncope.client.console.rest.AnyTypeRestClient;
import org.apache.wicket.behavior.AttributeAppender;
import org.apache.wicket.markup.html.WebMarkupContainer;
@@ -55,7 +52,7 @@ public class NumberWidget extends BaseWidget {
boolean isAuthorized = true;
final PageParameters pageParameters = new PageParameters();
final Class<? extends IRequestablePage> responsePage;
- List<AnyTypeTO> anyTypeTOs = new AnyTypeRestClient().list();
+ List<String> anyTypes = new AnyTypeRestClient().list();
switch (id) {
case "totalUsers":
pageParameters.add("selectedIndex", 1);
@@ -70,10 +67,9 @@ public class NumberWidget extends BaseWidget {
case "totalAny1OrRoles":
if (icon.equals("ion ion-gear-a")) {
- Collections.sort(anyTypeTOs, new AnyTypeComparator());
Integer selectedIndex = null;
- for (int i = 0; i < anyTypeTOs.size() && selectedIndex == null; i++) {
- if (anyTypeTOs.get(i).getKey().equals(label)) {
+ for (int i = 0; i < anyTypes.size() && selectedIndex == null; i++) {
+ if (anyTypes.get(i).equals(label)) {
selectedIndex = i + 1;
pageParameters.add("selectedIndex", selectedIndex);
}
@@ -88,10 +84,9 @@ public class NumberWidget extends BaseWidget {
case "totalAny2OrResources":
if (icon.equals("ion ion-gear-a")) {
- Collections.sort(anyTypeTOs, new AnyTypeComparator());
Integer selectedIndex = null;
- for (int i = 0; i < anyTypeTOs.size() && selectedIndex == null; i++) {
- if (anyTypeTOs.get(i).getKey().equals(label)) {
+ for (int i = 0; i < anyTypes.size() && selectedIndex == null; i++) {
+ if (anyTypes.get(i).equals(label)) {
selectedIndex = i + 1;
pageParameters.add("selectedIndex", selectedIndex);
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/20596e2e/client/console/src/main/java/org/apache/syncope/client/console/wizards/AbstractMappingPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wizards/AbstractMappingPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/wizards/AbstractMappingPanel.java
index f807c13..6872cde 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/wizards/AbstractMappingPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/wizards/AbstractMappingPanel.java
@@ -307,7 +307,7 @@ public abstract class AbstractMappingPanel extends Panel {
// Purpose
// -------------------------------
WebMarkupContainer purpose = new WebMarkupContainer("purpose");
- purpose.setOutputMarkupId(Boolean.TRUE);
+ purpose.setOutputMarkupId(true);
final MappingPurposePanel purposeActions = new MappingPurposePanel(
"purposeActions", new PropertyModel<MappingPurpose>(mapItem, "purpose"), purpose);
http://git-wip-us.apache.org/repos/asf/syncope/blob/20596e2e/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/DynamicMemberships.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/DynamicMemberships.java b/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/DynamicMemberships.java
index b061431..2f73fa8 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/DynamicMemberships.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/DynamicMemberships.java
@@ -59,7 +59,7 @@ public class DynamicMemberships extends WizardStep {
@Override
protected List<AnyTypeTO> load() {
- return CollectionUtils.select(anyTypeRestClient.list(), new Predicate<AnyTypeTO>() {
+ return CollectionUtils.select(anyTypeRestClient.listAnyTypes(), new Predicate<AnyTypeTO>() {
@Override
public boolean evaluate(final AnyTypeTO t) {
http://git-wip-us.apache.org/repos/asf/syncope/blob/20596e2e/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/Relationships.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/Relationships.java b/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/Relationships.java
index c17c7ee..97e8ab6 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/Relationships.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/Relationships.java
@@ -258,7 +258,7 @@ public class Relationships extends WizardStep {
type.setChoices(availableRels);
add(type.setRenderBodyOnly(true));
- final List<AnyTypeTO> availableTypes = ListUtils.select(anyTypeRestClient.list(),
+ final List<AnyTypeTO> availableTypes = ListUtils.select(anyTypeRestClient.listAnyTypes(),
new Predicate<AnyTypeTO>() {
@Override
@@ -313,6 +313,8 @@ public class Relationships extends WizardStep {
});
}
});
+ // enable "rightType" dropdown only if "type" option is selected - SYNCOPE-1140
+ rightType.setEnabled(false);
add(rightType);
final WebMarkupContainer container = new WebMarkupContainer("searchPanelContainer");
@@ -337,8 +339,6 @@ public class Relationships extends WizardStep {
target.add(container);
}
});
- // enable "rightType" dropdown only if "type" option is selected - SYNCOPE-1140
- rightType.setEnabled(Boolean.FALSE);
rightType.getField().add(new IndicatorAjaxFormComponentUpdatingBehavior(Constants.ON_CHANGE) {
http://git-wip-us.apache.org/repos/asf/syncope/blob/20596e2e/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/TypeExtensionWizardBuilder.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/TypeExtensionWizardBuilder.java b/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/TypeExtensionWizardBuilder.java
index fc69e26..35af482 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/TypeExtensionWizardBuilder.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/TypeExtensionWizardBuilder.java
@@ -70,11 +70,11 @@ public class TypeExtensionWizardBuilder extends AjaxWizardBuilder<TypeExtensionT
wizardModel.add(new Details(modelObject));
return wizardModel;
}
-
+
@Override
protected Serializable onApplyInternal(final TypeExtensionTO modelObject) {
- final List<TypeExtensionTO> typeExtensions
- = ListUtils.select(groupTO.getTypeExtensions(), new Predicate<TypeExtensionTO>() {
+ final List<TypeExtensionTO> typeExtensions =
+ ListUtils.select(groupTO.getTypeExtensions(), new Predicate<TypeExtensionTO>() {
@Override
public boolean evaluate(final TypeExtensionTO object) {
@@ -98,8 +98,7 @@ public class TypeExtensionWizardBuilder extends AjaxWizardBuilder<TypeExtensionT
add(new Label("anyType.label", anyTypeLabel));
if (typeExtensionTO.getAnyType() == null) {
- List<String> anyTypes = CollectionUtils.collect(new AnyTypeRestClient().list(),
- EntityTOUtils.keyTransformer(), new ArrayList<String>());
+ List<String> anyTypes = new AnyTypeRestClient().list();
anyTypes.remove(AnyTypeKind.GROUP.name());
CollectionUtils.filter(anyTypes, new Predicate<String>() {
http://git-wip-us.apache.org/repos/asf/syncope/blob/20596e2e/client/console/src/main/java/org/apache/syncope/client/console/wizards/resources/ProvisionWizardBuilder.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wizards/resources/ProvisionWizardBuilder.java b/client/console/src/main/java/org/apache/syncope/client/console/wizards/resources/ProvisionWizardBuilder.java
index 869b87d..37abe22 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/wizards/resources/ProvisionWizardBuilder.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/wizards/resources/ProvisionWizardBuilder.java
@@ -37,8 +37,6 @@ import org.apache.syncope.client.console.wicket.markup.html.form.AjaxDropDownCho
import org.apache.syncope.client.console.wicket.markup.html.form.AjaxTextFieldPanel;
import org.apache.syncope.client.console.wicket.markup.html.form.FieldPanel;
import org.apache.syncope.client.console.wizards.AjaxWizardBuilder;
-import org.apache.syncope.common.lib.EntityTOUtils;
-import org.apache.syncope.common.lib.to.AnyTypeTO;
import org.apache.syncope.common.lib.to.MappingTO;
import org.apache.syncope.common.lib.to.ProvisionTO;
import org.apache.syncope.common.lib.to.ResourceTO;
@@ -78,19 +76,13 @@ public class ProvisionWizardBuilder extends AjaxWizardBuilder<ProvisionTO> {
}
}, currentlyAdded);
- final List<String> res = new ArrayList<>();
-
- CollectionUtils.filter(CollectionUtils.collect(new AnyTypeRestClient().list(),
- EntityTOUtils.<AnyTypeTO>keyTransformer(), res),
- new Predicate<String>() {
+ return ListUtils.select(new AnyTypeRestClient().list(), new Predicate<String>() {
@Override
public boolean evaluate(final String key) {
return !currentlyAdded.contains(key);
}
});
-
- return res;
}
};
@@ -210,13 +202,8 @@ public class ProvisionWizardBuilder extends AjaxWizardBuilder<ProvisionTO> {
@Override
protected void onUpdate(final AjaxRequestTarget target) {
- if (connObjectLinkCheckbox.getModelObject()) {
- connObjectLink.setEnabled(Boolean.TRUE);
- connObjectLink.setModelObject("");
- } else {
- connObjectLink.setEnabled(Boolean.FALSE);
- connObjectLink.setModelObject("");
- }
+ connObjectLink.setEnabled(connObjectLinkCheckbox.getModelObject());
+ connObjectLink.setModelObject("");
target.add(connObjectLink);
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/20596e2e/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/AnyTypeClassResource.java
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/AnyTypeClassResource.java b/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/AnyTypeClassResource.java
index f9b906e9..5a75776 100644
--- a/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/AnyTypeClassResource.java
+++ b/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/AnyTypeClassResource.java
@@ -26,11 +26,10 @@ import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import org.apache.syncope.client.enduser.SyncopeEnduserSession;
import org.apache.syncope.client.enduser.annotations.Resource;
-import org.apache.syncope.common.lib.to.AnyTypeClassTO;
-import org.apache.syncope.common.rest.api.service.AnyTypeClassService;
+import org.apache.syncope.common.rest.api.service.SyncopeService;
import org.apache.wicket.request.resource.AbstractResource;
-@Resource(key = "auxClasses", path = "/api/auxiliaryClasses")
+@Resource(key = "auxClasses", path = "/api/auxClasses")
public class AnyTypeClassResource extends BaseResource {
private static final long serialVersionUID = 7475706378304995200L;
@@ -49,15 +48,15 @@ public class AnyTypeClassResource extends BaseResource {
return response;
}
- final List<AnyTypeClassTO> anyTypeClassTOs =
- SyncopeEnduserSession.get().getService(AnyTypeClassService.class).list();
+ final List<String> anyTypeClasses = SyncopeEnduserSession.get().
+ getService(SyncopeService.class).platform().getAnyTypeClasses();
response.setTextEncoding(StandardCharsets.UTF_8.name());
response.setWriteCallback(new AbstractResource.WriteCallback() {
@Override
public void writeData(final Attributes attributes) throws IOException {
- attributes.getResponse().write(MAPPER.writeValueAsString(anyTypeClassTOs));
+ attributes.getResponse().write(MAPPER.writeValueAsString(anyTypeClasses));
}
});
response.setStatusCode(Response.Status.OK.getStatusCode());
http://git-wip-us.apache.org/repos/asf/syncope/blob/20596e2e/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/AnyTypeResource.java
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/AnyTypeResource.java b/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/AnyTypeResource.java
deleted file mode 100644
index 3af7093..0000000
--- a/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/AnyTypeResource.java
+++ /dev/null
@@ -1,76 +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.enduser.resources;
-
-import java.io.IOException;
-import java.nio.charset.StandardCharsets;
-import javax.servlet.http.HttpServletRequest;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-import org.apache.syncope.client.enduser.SyncopeEnduserSession;
-import org.apache.syncope.client.enduser.annotations.Resource;
-import org.apache.syncope.common.lib.to.AnyTypeTO;
-import org.apache.syncope.common.rest.api.service.AnyTypeService;
-import org.apache.wicket.request.resource.AbstractResource;
-
-@Resource(key = "anyType", path = "/api/anyTypes")
-public class AnyTypeResource extends BaseResource {
-
- private static final long serialVersionUID = 7475706378304995200L;
-
- @Override
- protected ResourceResponse newResourceResponse(final Attributes attributes) {
- LOG.debug("Get all available auxiliary classes");
-
- ResourceResponse response = new ResourceResponse();
- response.setContentType(MediaType.APPLICATION_JSON);
- try {
-
- HttpServletRequest request = (HttpServletRequest) attributes.getRequest().getContainerRequest();
- if (!xsrfCheck(request)) {
- LOG.error("XSRF TOKEN does not match");
- response.setError(Response.Status.BAD_REQUEST.getStatusCode(), "XSRF TOKEN does not match");
- return response;
- }
-
- String kind = attributes.getParameters().get(0).toString();
- final AnyTypeTO anyTypeTO = SyncopeEnduserSession.get().getService(AnyTypeService.class).read(kind);
-
- response.setTextEncoding(StandardCharsets.UTF_8.name());
-
- response.setWriteCallback(new AbstractResource.WriteCallback() {
-
- @Override
- public void writeData(final Attributes attributes) throws IOException {
- attributes.getResponse().write(MAPPER.writeValueAsString(anyTypeTO));
- }
- });
- response.setStatusCode(Response.Status.OK.getStatusCode());
- } catch (Exception e) {
- LOG.error("Error retrieving available any type details", e);
- response.setError(Response.Status.BAD_REQUEST.getStatusCode(), new StringBuilder()
- .append("ErrorMessage{{ ")
- .append(e.getMessage())
- .append(" }}")
- .toString());
- }
- return response;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/20596e2e/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/ExternalResourceResource.java
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/ExternalResourceResource.java b/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/ExternalResourceResource.java
index 30c518e..d354f56 100644
--- a/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/ExternalResourceResource.java
+++ b/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/ExternalResourceResource.java
@@ -26,8 +26,7 @@ import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import org.apache.syncope.client.enduser.SyncopeEnduserSession;
import org.apache.syncope.client.enduser.annotations.Resource;
-import org.apache.syncope.common.lib.to.ResourceTO;
-import org.apache.syncope.common.rest.api.service.ResourceService;
+import org.apache.syncope.common.rest.api.service.SyncopeService;
import org.apache.wicket.request.resource.AbstractResource;
import org.apache.wicket.request.resource.IResource;
@@ -50,14 +49,15 @@ public class ExternalResourceResource extends BaseResource {
return response;
}
- final List<ResourceTO> resourceTOs = SyncopeEnduserSession.get().getService(ResourceService.class).list();
+ final List<String> resources = SyncopeEnduserSession.get().
+ getService(SyncopeService.class).platform().getResources();
response.setTextEncoding(StandardCharsets.UTF_8.name());
response.setWriteCallback(new AbstractResource.WriteCallback() {
@Override
public void writeData(final IResource.Attributes attributes) throws IOException {
- attributes.getResponse().write(MAPPER.writeValueAsString(resourceTOs));
+ attributes.getResponse().write(MAPPER.writeValueAsString(resources));
}
});
response.setStatusCode(Response.Status.OK.getStatusCode());
http://git-wip-us.apache.org/repos/asf/syncope/blob/20596e2e/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/GroupResource.java
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/GroupResource.java b/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/GroupResource.java
index c885e71..863face 100644
--- a/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/GroupResource.java
+++ b/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/GroupResource.java
@@ -27,11 +27,9 @@ import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import org.apache.syncope.client.enduser.SyncopeEnduserSession;
import org.apache.syncope.client.enduser.annotations.Resource;
-import org.apache.syncope.client.lib.SyncopeClient;
import org.apache.syncope.common.lib.SyncopeConstants;
import org.apache.syncope.common.lib.to.GroupTO;
-import org.apache.syncope.common.rest.api.beans.AnyQuery;
-import org.apache.syncope.common.rest.api.service.GroupService;
+import org.apache.syncope.common.rest.api.service.SyncopeService;
import org.apache.wicket.request.resource.AbstractResource;
@Resource(key = "groups", path = "/api/groups")
@@ -56,9 +54,7 @@ public class GroupResource extends BaseResource {
String realm = URLDecoder.decode(attributes.getParameters().get("realm").
toString(SyncopeConstants.ROOT_REALM), "UTF-8");
final List<GroupTO> groupTOs = SyncopeEnduserSession.get().
- getService(GroupService.class).search(new AnyQuery.Builder().realm(realm).
- fiql(SyncopeClient.getGroupSearchConditionBuilder().isAssignable().query()).
- build()).getResult();
+ getService(SyncopeService.class).searchAssignableGroups(realm, 1, 30).getResult();
response.setTextEncoding(StandardCharsets.UTF_8.name());
response.setWriteCallback(new AbstractResource.WriteCallback() {
http://git-wip-us.apache.org/repos/asf/syncope/blob/20596e2e/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/SchemaResource.java
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/SchemaResource.java b/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/SchemaResource.java
index 332011f..91e5bbe 100644
--- a/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/SchemaResource.java
+++ b/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/SchemaResource.java
@@ -29,7 +29,6 @@ import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import org.apache.commons.collections4.CollectionUtils;
-import org.apache.commons.collections4.IterableUtils;
import org.apache.commons.collections4.Predicate;
import org.apache.commons.lang3.StringUtils;
import org.apache.syncope.client.enduser.SyncopeEnduserApplication;
@@ -40,16 +39,12 @@ import org.apache.syncope.client.enduser.model.CustomAttribute;
import org.apache.syncope.client.enduser.model.CustomAttributesInfo;
import org.apache.syncope.client.enduser.model.SchemaResponse;
import org.apache.syncope.common.lib.to.AbstractSchemaTO;
-import org.apache.syncope.common.lib.to.AnyTypeTO;
-import org.apache.syncope.common.lib.to.GroupTO;
-import org.apache.syncope.common.lib.to.PagedResult;
+import org.apache.syncope.common.lib.to.TypeExtensionTO;
import org.apache.syncope.common.lib.types.AnyTypeKind;
import org.apache.syncope.common.lib.types.SchemaType;
-import org.apache.syncope.common.rest.api.beans.AnyQuery;
import org.apache.syncope.common.rest.api.beans.SchemaQuery;
-import org.apache.syncope.common.rest.api.service.AnyTypeService;
-import org.apache.syncope.common.rest.api.service.GroupService;
import org.apache.syncope.common.rest.api.service.SchemaService;
+import org.apache.syncope.common.rest.api.service.SyncopeService;
import org.apache.wicket.request.resource.AbstractResource;
import org.apache.wicket.request.resource.IResource;
@@ -58,7 +53,6 @@ public class SchemaResource extends BaseResource {
private static final long serialVersionUID = 6453101466981543020L;
- @SuppressWarnings("unchecked")
@Override
protected AbstractResource.ResourceResponse newResourceResponse(final IResource.Attributes attributes) {
LOG.debug("Search all {} any type kind related schemas", AnyTypeKind.USER.name());
@@ -76,29 +70,22 @@ public class SchemaResource extends BaseResource {
List<String> classes = Collections.emptyList();
- final String groupParam = attributes.getParameters().get("group").toString();
- if (groupParam != null) {
- PagedResult<GroupTO> groups = SyncopeEnduserSession.get().getService(GroupService.class).search(
- new AnyQuery.Builder().realm("/").page(1).size(1000).build());
- GroupTO group = IterableUtils.find(groups.getResult(), new Predicate<GroupTO>() {
-
- @Override
- public boolean evaluate(final GroupTO item) {
- return groupParam.equals(item.getName());
- }
- });
-
- if (group != null && group.getTypeExtension(AnyTypeKind.USER.name()) != null) {
- classes = group.getTypeExtension(AnyTypeKind.USER.name()).getAuxClasses();
+ String group = attributes.getParameters().get("group").toString();
+ if (group != null) {
+ try {
+ TypeExtensionTO typeExt = SyncopeEnduserSession.get().
+ getService(SyncopeService.class).readUserTypeExtension(group);
+ classes = typeExt.getAuxClasses();
+ } catch (Exception e) {
+ LOG.error("Could not read User type extension for Group {}", group, e);
}
} else {
String anyTypeClass = attributes.getParameters().get("anyTypeClass").toString();
if (anyTypeClass != null) {
classes = Collections.singletonList(anyTypeClass);
} else {
- AnyTypeTO anyTypeUserTO = SyncopeEnduserSession.get().getService(AnyTypeService.class).
- read(AnyTypeKind.USER.name());
- classes = anyTypeUserTO.getClasses();
+ classes = SyncopeEnduserSession.get().
+ getService(SyncopeService.class).platform().getUserClasses();
}
}
@@ -113,7 +100,7 @@ public class SchemaResource extends BaseResource {
new SchemaQuery.Builder().type(SchemaType.PLAIN).anyTypeClasses(classes).build())
: customForm.get(SchemaType.PLAIN.name()).isShow()
? customizeSchemas(schemaService.list(new SchemaQuery.Builder().type(SchemaType.PLAIN).
- anyTypeClasses(classes).build()), groupParam, customForm.get(SchemaType.PLAIN.name()).
+ anyTypeClasses(classes).build()), group, customForm.get(SchemaType.PLAIN.name()).
getAttributes())
: Collections.<AbstractSchemaTO>emptyList();
final List<AbstractSchemaTO> derSchemas = classes.isEmpty()
@@ -123,7 +110,7 @@ public class SchemaResource extends BaseResource {
new SchemaQuery.Builder().type(SchemaType.DERIVED).anyTypeClasses(classes).build())
: customForm.get(SchemaType.DERIVED.name()).isShow()
? customizeSchemas(schemaService.list(new SchemaQuery.Builder().type(SchemaType.DERIVED).
- anyTypeClasses(classes).build()), groupParam, customForm.get(SchemaType.DERIVED.name()).
+ anyTypeClasses(classes).build()), group, customForm.get(SchemaType.DERIVED.name()).
getAttributes())
: Collections.<AbstractSchemaTO>emptyList();
final List<AbstractSchemaTO> virSchemas = classes.isEmpty()
@@ -133,19 +120,19 @@ public class SchemaResource extends BaseResource {
new SchemaQuery.Builder().type(SchemaType.VIRTUAL).anyTypeClasses(classes).build())
: customForm.get(SchemaType.VIRTUAL.name()).isShow()
? customizeSchemas(schemaService.list(new SchemaQuery.Builder().type(SchemaType.VIRTUAL).
- anyTypeClasses(classes).build()), groupParam, customForm.get(SchemaType.VIRTUAL.name()).
+ anyTypeClasses(classes).build()), group, customForm.get(SchemaType.VIRTUAL.name()).
getAttributes())
: Collections.<AbstractSchemaTO>emptyList();
- if (groupParam != null) {
+ if (group != null) {
for (AbstractSchemaTO schema : plainSchemas) {
- schema.setKey(compositeSchemaKey(groupParam, schema.getKey()));
+ schema.setKey(compositeSchemaKey(group, schema.getKey()));
}
for (AbstractSchemaTO schema : derSchemas) {
- schema.setKey(compositeSchemaKey(groupParam, schema.getKey()));
+ schema.setKey(compositeSchemaKey(group, schema.getKey()));
}
for (AbstractSchemaTO schema : virSchemas) {
- schema.setKey(compositeSchemaKey(groupParam, schema.getKey()));
+ schema.setKey(compositeSchemaKey(group, schema.getKey()));
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/20596e2e/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/UserClassesResource.java
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/UserClassesResource.java b/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/UserClassesResource.java
new file mode 100644
index 0000000..088b35b
--- /dev/null
+++ b/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/UserClassesResource.java
@@ -0,0 +1,75 @@
+/*
+ * 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.enduser.resources;
+
+import java.io.IOException;
+import java.nio.charset.StandardCharsets;
+import java.util.List;
+import javax.servlet.http.HttpServletRequest;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import org.apache.syncope.client.enduser.SyncopeEnduserSession;
+import org.apache.syncope.client.enduser.annotations.Resource;
+import org.apache.syncope.common.rest.api.service.SyncopeService;
+import org.apache.wicket.request.resource.AbstractResource;
+
+@Resource(key = "anyType", path = "/api/userClasses")
+public class UserClassesResource extends BaseResource {
+
+ private static final long serialVersionUID = 7475706378304995200L;
+
+ @Override
+ protected ResourceResponse newResourceResponse(final Attributes attributes) {
+ LOG.debug("Get USER classes");
+
+ ResourceResponse response = new ResourceResponse();
+ response.setContentType(MediaType.APPLICATION_JSON);
+ try {
+
+ HttpServletRequest request = (HttpServletRequest) attributes.getRequest().getContainerRequest();
+ if (!xsrfCheck(request)) {
+ LOG.error("XSRF TOKEN does not match");
+ response.setError(Response.Status.BAD_REQUEST.getStatusCode(), "XSRF TOKEN does not match");
+ return response;
+ }
+
+ final List<String> userClasses = SyncopeEnduserSession.get().
+ getService(SyncopeService.class).platform().getUserClasses();
+
+ response.setTextEncoding(StandardCharsets.UTF_8.name());
+ response.setWriteCallback(new AbstractResource.WriteCallback() {
+
+ @Override
+ public void writeData(final Attributes attributes) throws IOException {
+ attributes.getResponse().write(MAPPER.writeValueAsString(userClasses));
+ }
+ });
+ response.setStatusCode(Response.Status.OK.getStatusCode());
+ } catch (Exception e) {
+ LOG.error("Error retrieving available any type details", e);
+ response.setError(Response.Status.BAD_REQUEST.getStatusCode(), new StringBuilder()
+ .append("ErrorMessage{{ ")
+ .append(e.getMessage())
+ .append(" }}")
+ .toString());
+ }
+ return response;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/20596e2e/client/enduser/src/main/resources/META-INF/resources/app/js/controllers/UserController.js
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/resources/META-INF/resources/app/js/controllers/UserController.js b/client/enduser/src/main/resources/META-INF/resources/app/js/controllers/UserController.js
index 3bf3468..1afc42c 100644
--- a/client/enduser/src/main/resources/META-INF/resources/app/js/controllers/UserController.js
+++ b/client/enduser/src/main/resources/META-INF/resources/app/js/controllers/UserController.js
@@ -210,7 +210,7 @@ angular.module("self").controller("UserController", ['$scope', '$rootScope', '$l
var initResources = function () {
ResourceService.getResources().then(function (response) {
for (var i in response) {
- $scope.dynamicForm.resources.push(response[i].key);
+ $scope.dynamicForm.resources.push(response[i]);
}
$scope.dynamicForm.resources.sort();
});
@@ -239,13 +239,13 @@ angular.module("self").controller("UserController", ['$scope', '$rootScope', '$l
var initAuxClasses = function () {
//fetching default user classes, that should remain in any case
- AnyService.getAnyType("USER").then(function (response) {
- $scope.dynamicForm.anyUserType = response.classes;
+ AnyService.getUserClasses().then(function (response) {
+ $scope.dynamicForm.anyUserType = response;
AnyService.getAuxClasses().then(function (response) {
for (var i = 0; i < response.length; i++) {
- //we should only add schemas that aren't in the anyUserType
- if ($scope.dynamicForm.anyUserType.indexOf(response[i].key) === -1) {
- $scope.dynamicForm.auxClasses.push(response[i].key);
+ // we should only add schemas that aren't in the anyUserType
+ if ($scope.dynamicForm.anyUserType.indexOf(response[i]) === -1) {
+ $scope.dynamicForm.auxClasses.push(response[i]);
}
}
}, function (e) {
http://git-wip-us.apache.org/repos/asf/syncope/blob/20596e2e/client/enduser/src/main/resources/META-INF/resources/app/js/services/anyService.js
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/resources/META-INF/resources/app/js/services/anyService.js b/client/enduser/src/main/resources/META-INF/resources/app/js/services/anyService.js
index 59f8ec3..09edf18 100644
--- a/client/enduser/src/main/resources/META-INF/resources/app/js/services/anyService.js
+++ b/client/enduser/src/main/resources/META-INF/resources/app/js/services/anyService.js
@@ -26,7 +26,7 @@ angular.module('self')
var any = {};
any.getAuxClasses = function () {
- return $http.get("/syncope-enduser/api/auxiliaryClasses")
+ return $http.get("/syncope-enduser/api/auxClasses")
.then(function (response) {
return response.data;
}, function (response) {
@@ -36,8 +36,8 @@ angular.module('self')
});
};
- any.getAnyType = function (kind) {
- return $http.get("/syncope-enduser/api/anyTypes/" + encodeURI(kind))
+ any.getUserClasses = function () {
+ return $http.get("/syncope-enduser/api/userClasses")
.then(function (response) {
return response.data;
}, function (response) {
http://git-wip-us.apache.org/repos/asf/syncope/blob/20596e2e/common/lib/src/main/java/org/apache/syncope/common/lib/info/PlatformInfo.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/info/PlatformInfo.java b/common/lib/src/main/java/org/apache/syncope/common/lib/info/PlatformInfo.java
index 4a71624..0594db4 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/info/PlatformInfo.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/info/PlatformInfo.java
@@ -19,7 +19,9 @@
package org.apache.syncope.common.lib.info;
import com.fasterxml.jackson.annotation.JsonProperty;
+import java.util.ArrayList;
import java.util.HashSet;
+import java.util.List;
import java.util.Set;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementWrapper;
@@ -61,6 +63,14 @@ public class PlatformInfo extends AbstractBaseBean {
private String anySearchDAO;
+ private final List<String> anyTypes = new ArrayList<>();
+
+ private final List<String> userClasses = new ArrayList<>();
+
+ private final List<String> anyTypeClasses = new ArrayList<>();
+
+ private final List<String> resources = new ArrayList<>();
+
private final Set<String> entitlements = new HashSet<>();
private final Set<String> jwtSSOProviders = new HashSet<>();
@@ -160,6 +170,34 @@ public class PlatformInfo extends AbstractBaseBean {
this.anySearchDAO = anySearchDAO;
}
+ @XmlElementWrapper(name = "anyTypes")
+ @XmlElement(name = "anyType")
+ @JsonProperty("anyTypes")
+ public List<String> getAnyTypes() {
+ return anyTypes;
+ }
+
+ @XmlElementWrapper(name = "userClasses")
+ @XmlElement(name = "userClass")
+ @JsonProperty("userClasses")
+ public List<String> getUserClasses() {
+ return userClasses;
+ }
+
+ @XmlElementWrapper(name = "anyTypeClasses")
+ @XmlElement(name = "anyTypeClass")
+ @JsonProperty("anyTypeClasses")
+ public List<String> getAnyTypeClasses() {
+ return anyTypeClasses;
+ }
+
+ @XmlElementWrapper(name = "resources")
+ @XmlElement(name = "resource")
+ @JsonProperty("resources")
+ public List<String> getResources() {
+ return resources;
+ }
+
@XmlElementWrapper(name = "entitlements")
@XmlElement(name = "entitlement")
@JsonProperty("entitlements")
http://git-wip-us.apache.org/repos/asf/syncope/blob/20596e2e/common/lib/src/main/java/org/apache/syncope/common/lib/types/StandardEntitlement.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/types/StandardEntitlement.java b/common/lib/src/main/java/org/apache/syncope/common/lib/types/StandardEntitlement.java
index 9bf8de3..9657bc3 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/types/StandardEntitlement.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/types/StandardEntitlement.java
@@ -46,14 +46,22 @@ public final class StandardEntitlement {
public static final String REALM_DELETE = "REALM_DELETE";
+ public static final String ANYTYPECLASS_LIST = "ANYTYPECLASS_LIST";
+
public static final String ANYTYPECLASS_CREATE = "ANYTYPECLASS_CREATE";
+ public static final String ANYTYPECLASS_READ = "ANYTYPECLASS_READ";
+
public static final String ANYTYPECLASS_UPDATE = "ANYTYPECLASS_UPDATE";
public static final String ANYTYPECLASS_DELETE = "ANYTYPECLASS_DELETE";
+ public static final String ANYTYPE_LIST = "ANYTYPE_LIST";
+
public static final String ANYTYPE_CREATE = "ANYTYPE_CREATE";
+ public static final String ANYTYPE_READ = "ANYTYPE_READ";
+
public static final String ANYTYPE_UPDATE = "ANYTYPE_UPDATE";
public static final String ANYTYPE_DELETE = "ANYTYPE_DELETE";
@@ -108,6 +116,8 @@ public final class StandardEntitlement {
public static final String GROUP_CREATE = "GROUP_CREATE";
+ public static final String GROUP_SEARCH = "GROUP_SEARCH";
+
public static final String GROUP_READ = "GROUP_READ";
public static final String GROUP_UPDATE = "GROUP_UPDATE";
@@ -156,6 +166,8 @@ public final class StandardEntitlement {
public static final String CONFIGURATION_LIST = "CONFIGURATION_LIST";
+ public static final String CONFIGURATION_GET = "CONFIGURATION_GET";
+
public static final String CONFIGURATION_SET = "CONFIGURATION_SET";
public static final String CONFIGURATION_DELETE = "CONFIGURATION_DELETE";
@@ -262,6 +274,8 @@ public final class StandardEntitlement {
public static final String SECURITY_QUESTION_CREATE = "SECURITY_QUESTION_CREATE";
+ public static final String SECURITY_QUESTION_READ = "SECURITY_QUESTION_READ";
+
public static final String SECURITY_QUESTION_UPDATE = "SECURITY_QUESTION_UPDATE";
public static final String SECURITY_QUESTION_DELETE = "SECURITY_QUESTION_DELETE";
http://git-wip-us.apache.org/repos/asf/syncope/blob/20596e2e/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/GroupService.java
----------------------------------------------------------------------
diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/GroupService.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/GroupService.java
index 9ec56b2..549b41a 100644
--- a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/GroupService.java
+++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/GroupService.java
@@ -29,7 +29,6 @@ import javax.ws.rs.core.MediaType;
import org.apache.syncope.common.lib.patch.GroupPatch;
import org.apache.syncope.common.lib.to.ExecTO;
import org.apache.syncope.common.lib.to.GroupTO;
-import org.apache.syncope.common.lib.to.TypeExtensionTO;
import org.apache.syncope.common.lib.types.BulkMembersActionType;
/**
@@ -50,20 +49,6 @@ public interface GroupService extends AnyService<GroupTO, GroupPatch> {
List<GroupTO> own();
/**
- * Extracts type extension information, for the provided group and any type.
- *
- * @param key group key
- * @param anyTypeKey any type key
- * @return type extension information, for the provided group and any type
- */
- @GET
- @Path("{key}/{anyTypeKey}/typeExtension")
- @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
- TypeExtensionTO readTypeExtension(
- @NotNull @PathParam("key") String key,
- @NotNull @PathParam("anyTypeKey") String anyTypeKey);
-
- /**
* (De)provision all members of the given group from / onto all the resources associated to it.
*
* @param key group key